37 #ifndef LLVM_TRANSFORMS_SCALAR_LOOPPASSMANAGER_H 38 #define LLVM_TRANSFORMS_SCALAR_LOOPPASSMANAGER_H 68 LPMUpdater &>::run(Loop &InitialL, LoopAnalysisManager &AM,
69 LoopStandardAnalysisResults &AnalysisResults,
72 LoopStandardAnalysisResults &, LPMUpdater &>;
86 template <
typename AnalysisT>
88 LoopStandardAnalysisResults &, LPMUpdater &>
91 LoopStandardAnalysisResults &, LPMUpdater &>> {
93 LoopStandardAnalysisResults &AR, LPMUpdater &) {
94 (void)AM.template getResult<AnalysisT>(L, AR);
100 template <
typename AnalysisT>
103 LoopStandardAnalysisResults &, LPMUpdater &>;
113 template <
typename RangeT>
123 assert(PreOrderLoops.
empty() &&
"Must start with an empty preorder walk.");
125 "Must start with an empty preorder walk worklist.");
131 }
while (!PreOrderWorklist.
empty());
133 Worklist.
insert(std::move(PreOrderLoops));
134 PreOrderLoops.
clear();
170 "Cannot delete a loop outside of the " 171 "subloop tree currently being processed.");
173 SkipCurrentLoop =
true;
185 Worklist.insert(CurrentL);
188 for (Loop *NewL : NewChildLoops)
189 assert(NewL->getParentLoop() == CurrentL &&
"All of the new loops must " 190 "be immediate children of " 191 "the current loop!");
198 SkipCurrentLoop =
true;
209 for (Loop *NewL : NewSibLoops)
210 assert(NewL->getParentLoop() == ParentL &&
211 "All of the new loops must be siblings of the current loop!");
227 SkipCurrentLoop =
true;
230 Worklist.insert(CurrentL);
240 LoopAnalysisManager &LAM;
243 bool SkipCurrentLoop;
252 LoopAnalysisManager &LAM)
253 : Worklist(Worklist), LAM(LAM) {}
263 template <
typename LoopPassT>
265 :
public PassInfoMixin<FunctionToLoopPassAdaptor<LoopPassT>> {
268 : Pass(
std::move(Pass)), LoopCanonicalizationFPM(DebugLogging) {
270 LoopCanonicalizationFPM.addPass(
LCSSAPass());
285 PA = LoopCanonicalizationFPM.run(F, AM);
314 LoopAnalysisManager &LAM =
322 LPMUpdater Updater(Worklist, LAM);
336 Updater.CurrentL = L;
337 Updater.SkipCurrentLoop =
false;
346 "Loops must remain in LCSSA form!");
369 LAM.invalidate(*L, PassPA);
373 PA.intersect(std::move(PassPA));
374 }
while (!Worklist.
empty());
405 template <
typename LoopPassT>
421 LoopStandardAnalysisResults &, LPMUpdater &);
425 #endif // LLVM_TRANSFORMS_SCALAR_LOOPPASSMANAGER_H Pass interface - Implemented by all 'passes'.
This file provides a priority worklist.
Converts loops into loop-closed SSA form.
bool insert(const T &X)
Insert a new element into the PriorityWorklist.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
This class represents lattice values for constants.
LLVM_NODISCARD T pop_back_val()
This is the interface for a simple mod/ref and alias analysis over globals.
bool isRecursivelyLCSSAForm(DominatorTree &DT, const LoopInfo &LI) const
Return true if this Loop and all inner subloops are in LCSSA form.
void push_back(const T &Elt)
This pass is responsible for loop canonicalization.
Analysis pass providing the TargetTransformInfo.
bool empty() const
Determine if the PriorityWorklist is empty or not.
Analysis pass which computes a DominatorTree.
PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM, LoopStandardAnalysisResults &AR, LPMUpdater &)
A utility pass template to force an analysis result to be available.
void addChildLoops(ArrayRef< Loop *> NewChildLoops)
Loop passes should use this method to indicate they have added new child loops of the current loop...
amdgpu Simplify well known AMD library false Value Value const Twine & Name
This is the interface for a SCEV-based alias analysis.
bool skipCurrentLoop() const
This can be queried by loop passes which run other loop passes (like pass managers) to know whether t...
Encapsulates MemorySSA, including all data associated with memory accesses.
Analysis pass that exposes the LoopInfo for a function.
auto reverse(ContainerTy &&C, typename std::enable_if< has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(C.rbegin(), C.rend()))
FunctionToLoopPassAdaptor< LoopPassT > createFunctionToLoopPassAdaptor(LoopPassT Pass, bool DebugLogging=false)
A function to deduce a loop pass type and wrap it in the templated adaptor.
A CRTP mix-in to automatically provide informational APIs needed for passes.
Adaptor that maps from a function to its loops.
void revisitCurrentLoop()
Restart the current loop.
This header provides classes for managing per-loop analyses.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
bool runBeforePass(const PassT &Pass, const IRUnitT &IR) const
BeforePass instrumentation point - takes Pass instance to be executed and constant reference to IR it...
AnalysisManager< Loop, LoopStandardAnalysisResults & > LoopAnalysisManager
The loop analysis manager.
A set of analyses that are preserved following a run of a transformation pass.
A manager for alias analyses.
Analysis pass providing a never-invalidated alias analysis result.
Analysis pass providing a never-invalidated alias analysis result.
A version of PriorityWorklist that selects small size optimized data structures for the vector and ma...
void addSiblingLoops(ArrayRef< Loop *> NewSibLoops)
Loop passes should use this method to indicate they have added new sibling loops to the current loop...
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
void markLoopAsDeleted(Loop &L, llvm::StringRef Name)
Loop passes should use this method to indicate they have deleted a loop from the nest.
Pseudo-analysis pass that exposes the PassInstrumentation to pass managers.
A function analysis which provides an AssumptionCache.
bool contains(const LoopT *L) const
Return true if the specified loop is contained within in this loop.
print lazy value Lazy Value Info Printer Pass
void runAfterPass(const PassT &Pass, const IRUnitT &IR) const
AfterPass instrumentation point - takes Pass instance that has just been executed and constant refere...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
void runAfterPassInvalidated(const PassT &Pass) const
AfterPassInvalidated instrumentation point - takes Pass instance that has just been executed...
Pass for printing a loop's contents as textual IR.
An analysis that produces MemorySSA for a function.
LLVM_NODISCARD T pop_back_val()
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Runs the loop passes across every loop in the function.
Analysis pass that exposes the ScalarEvolution for a function.
LoopT * getParentLoop() const
Analysis pass providing a never-invalidated alias analysis result.
PassManager< Loop, LoopAnalysisManager, LoopStandardAnalysisResults &, LPMUpdater & > LoopPassManager
The Loop pass manager.
LLVM_NODISCARD bool empty() const
void appendLoopsToWorklist(RangeT &&Loops, SmallPriorityWorklist< Loop *, 4 > &Worklist)
Helper to implement appending of loops onto a worklist.
Analysis pass providing the TargetLibraryInfo.
FunctionToLoopPassAdaptor(LoopPassT Pass, bool DebugLogging=false)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This templated class represents "all analyses that operate over <a particular IR unit>" (e...
This class implements an extremely fast bulk output stream that can only output to a stream...
void verifyLoop() const
Verify loop structure.
StringRef - Represent a constant reference to a string, i.e.
This is the interface for LLVM's primary stateless and local alias analysis.
A container for analyses that lazily runs them and caches their results.
This class provides instrumentation entry points for the Pass Manager, doing calls to callbacks regis...
This header defines various interfaces for pass management in LLVM.
An analysis over an "outer" IR unit that provides access to an analysis manager over an "inner" IR un...
cl::opt< bool > EnableMSSALoopDependency
Enables memory ssa as a dependency for loop passes.