29 #define DEBUG_TYPE "loop-rotate" 33 cl::desc(
"The default maximum header size for automatic loop rotation"));
36 : EnableHeaderDuplication(EnableHeaderDuplication) {}
63 class LoopRotateLegacyPass :
public LoopPass {
64 unsigned MaxHeaderSize;
68 LoopRotateLegacyPass(
int SpecifiedMaxHeaderSize = -1) :
LoopPass(ID) {
70 if (SpecifiedMaxHeaderSize == -1)
73 MaxHeaderSize =
unsigned(SpecifiedMaxHeaderSize);
92 auto *LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
93 const auto *TTI = &getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F);
94 auto *AC = &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
95 auto *DTWP = getAnalysisIfAvailable<DominatorTreeWrapperPass>();
96 auto *DT = DTWP ? &DTWP->getDomTree() :
nullptr;
97 auto *SEWP = getAnalysisIfAvailable<ScalarEvolutionWrapperPass>();
98 auto *SE = SEWP ? &SEWP->getSE() :
nullptr;
102 MemorySSA *MSSA = &getAnalysis<MemorySSAWrapperPass>().getMSSA();
107 false, MaxHeaderSize,
false);
123 return new LoopRotateLegacyPass(MaxHeaderSize);
Pass interface - Implemented by all 'passes'.
A parsed version of the target data layout string in and methods for querying it. ...
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
PreservedAnalyses getLoopPassPreservedAnalyses()
Returns the minimum set of Analyses that all loop passes must preserve.
bool VerifyMemorySSA
Enables verification of MemorySSA.
This class represents lattice values for constants.
This header provides classes for managing a pipeline of passes over loops in LLVM IR...
An immutable pass that tracks lazily created AssumptionCache objects.
The adaptor from a function pass to a loop pass computes these analyses and makes them available to t...
const SimplifyQuery getBestSimplifyQuery(Pass &, Function &)
AnalysisUsage & addRequired()
const Module * getModule() const
Return the module owning the function this basic block belongs to, or nullptr if the function does no...
#define INITIALIZE_PASS_DEPENDENCY(depName)
Legacy analysis pass which computes MemorySSA.
INITIALIZE_PASS_BEGIN(LoopRotateLegacyPass, "loop-rotate", "Rotate Loops", false, false) INITIALIZE_PASS_END(LoopRotateLegacyPass
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
Encapsulates MemorySSA, including all data associated with memory accesses.
BlockT * getHeader() const
PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM, LoopStandardAnalysisResults &AR, LPMUpdater &U)
initializer< Ty > init(const Ty &Val)
A set of analyses that are preserved following a run of a transformation pass.
Represent the analysis usage information of a pass.
const T * getPointer() const
bool LoopRotation(Loop *L, LoopInfo *LI, const TargetTransformInfo *TTI, AssumptionCache *AC, DominatorTree *DT, ScalarEvolution *SE, MemorySSAUpdater *MSSAU, const SimplifyQuery &SQ, bool RotationOnly, unsigned Threshold, bool IsUtilMode)
Convert a loop into a loop with bottom test.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
void initializeLoopRotateLegacyPassPass(PassRegistry &)
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
TargetTransformInfo & TTI
This class provides an interface for updating the loop pass manager based on mutations to the loop ne...
void verifyMemorySSA() const
Verify that MemorySSA is self consistent (IE definitions dominate all uses, uses appear in the right ...
static cl::opt< unsigned > Threshold("loop-unswitch-threshold", cl::desc("Max loop size to unswitch"), cl::init(100), cl::Hidden)
Represents a single loop in the control flow graph.
const Function * getParent() const
Return the enclosing method, or null if none.
void getLoopAnalysisUsage(AnalysisUsage &AU)
Helper to consistently add the set of standard passes to a loop pass's AnalysisUsage.
LoopRotatePass(bool EnableHeaderDuplication=true)
This file exposes an interface to building/using memory SSA to walk memory instructions using a use/d...
A container for analyses that lazily runs them and caches their results.
Pass * createLoopRotatePass(int MaxHeaderSize=-1)
static cl::opt< unsigned > DefaultRotationThreshold("rotation-max-header-size", cl::init(16), cl::Hidden, cl::desc("The default maximum header size for automatic loop rotation"))
cl::opt< bool > EnableMSSALoopDependency
Enables memory ssa as a dependency for loop passes.