Go to the documentation of this file.
14 #ifndef LLVM_ANALYSIS_LOOPNESTANALYSIS_H
15 #define LLVM_ANALYSIS_LOOPNESTANALYSIS_H
51 static bool arePerfectlyNested(
const Loop &OuterLoop,
const Loop &InnerLoop,
57 const Loop &InnerLoop,
77 bool CheckUniquePred =
false);
86 if (
Loops.size() == 1)
93 auto SecondLastLoopIter = ++
Loops.rbegin();
94 return (LastLoop->
getLoopDepth() == (*SecondLastLoopIter)->getLoopDepth())
107 for (
unsigned I = 0;
I < getNumLoops(); ++
I)
108 if (getLoop(
I) == &L)
122 Depth <=
Loops.back()->getLoopDepth() &&
"Invalid depth");
124 for (
unsigned I = 0;
I < getNumLoops(); ++
I) {
125 Loop *L = getLoop(
I);
157 Loops.back()->getLoopDepth() -
Loops.front()->getLoopDepth() + 1;
158 assert(NestDepth > 0 &&
"Expecting NestDepth to be at least 1");
177 return Loops.front()->getHeader()->getParent();
190 InvalidLoopStructure,
191 OuterLoopLowerBoundUnknown
193 static LoopNestEnum analyzeLoopNestForPerfectNest(
const Loop &OuterLoop,
194 const Loop &InnerLoop,
198 raw_ostream &
operator<<(raw_ostream &,
const LoopNest &);
224 #endif // LLVM_ANALYSIS_LOOPNESTANALYSIS_H
A set of analyses that are preserved following a run of a transformation pass.
This is an optimization pass for GlobalISel generic memory operations.
Result run(Loop &L, LoopAnalysisManager &AM, LoopStandardAnalysisResults &AR)
A CRTP mix-in to automatically provide informational APIs needed for passes.
Represents a single loop in the control flow graph.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
LoopVectorTy getLoopsAtDepth(unsigned Depth) const
Get the loops in the nest at the given Depth.
The main scalar evolution driver.
The adaptor from a function pass to a loop pass computes these analyses and makes them available to t...
unsigned getLoopIndex(const Loop &L) const
Get the loop index of the given loop L.
LLVM Basic Block Representation.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
Loop * getLoop(unsigned Index) const
Return the loop at the given Index.
SmallVector< Loop *, 8 > LoopVectorTy
Loop * getInnermostLoop() const
Return the innermost loop in the loop nest if the nest has only one innermost loop,...
This class implements an extremely fast bulk output stream that can only output to a stream.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
This analysis provides information for a loop nest.
Printer pass for the LoopNest results.
PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM, LoopStandardAnalysisResults &AR, LPMUpdater &U)
const unsigned MaxPerfectDepth
bool isLoopSimplifyForm() const
Return true if the Loop is in the form that the LoopSimplify form transforms loops to,...
bool areAllLoopsRotatedForm() const
Return true if all loops in the loop nest are in rotated form.
This class provides an interface for updating the loop pass manager based on mutations to the loop ne...
#define LLVM_EXTERNAL_VISIBILITY
A special type used by analysis passes to provide an address that identifies that particular analysis...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
unsigned getLoopDepth() const
Return the nesting level of this loop.
Loop & getOutermostLoop() const
Return the outermost loop in the loop nest.
A CRTP mix-in that provides informational APIs needed for analysis passes.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
StringRef - Represent a constant reference to a string, i.e.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Function * getParent() const
Return the function to which the loop-nest belongs.
size_t getNumLoops() const
Return the number of loops in the nest.
ArrayRef< Loop * > getLoops() const
Get the loops in the nest.
unsigned getNestDepth() const
Return the loop nest depth (i.e.
unsigned getMaxPerfectDepth() const
Return the maximum perfect nesting depth.
LoopNestPrinterPass(raw_ostream &OS)
A container for analyses that lazily runs them and caches their results.
BlockVerifier::State From
bool isRotatedForm() const
Return true if the loop is in rotated form.
bool areAllLoopsSimplifyForm() const
Return true if all loops in the loop nest are in simplify form.
This class represents a loop nest and can be used to query its properties.
StringRef getName() const