Go to the documentation of this file.
30 #define DEBUG_TYPE "loop-rotate"
34 cl::desc(
"The default maximum header size for automatic loop rotation"));
38 cl::desc(
"Run loop-rotation in the prepare-for-lto stage. This option "
39 "should be used for testing only."));
42 : EnableHeaderDuplication(EnableHeaderDuplication),
43 PrepareForLTO(PrepareForLTO) {}
51 int Threshold = EnableHeaderDuplication ||
63 MSSAU ? MSSAU.
getPointer() :
nullptr, SQ,
false, Threshold,
80 class LoopRotateLegacyPass :
public LoopPass {
81 unsigned MaxHeaderSize;
86 LoopRotateLegacyPass(
int SpecifiedMaxHeaderSize = -1,
87 bool PrepareForLTO =
false)
90 if (SpecifiedMaxHeaderSize == -1)
93 MaxHeaderSize = unsigned(SpecifiedMaxHeaderSize);
114 auto *LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
115 const auto *
TTI = &getAnalysis<TargetTransformInfoWrapperPass>().getTTI(
F);
116 auto *AC = &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(
F);
117 auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
118 auto &SE = getAnalysis<ScalarEvolutionWrapperPass>().getSE();
123 auto *MSSAA = getAnalysisIfAvailable<MemorySSAWrapperPass>();
134 MSSAU ? MSSAU.
getPointer() :
nullptr, SQ,
false,
151 return new LoopRotateLegacyPass(MaxHeaderSize, PrepareForLTO);
A set of analyses that are preserved following a run of a transformation pass.
This is an optimization pass for GlobalISel generic memory operations.
void verifyMemorySSA(VerificationLevel=VerificationLevel::Fast) const
Verify that MemorySSA is self consistent (IE definitions dominate all uses, uses appear in the right ...
A parsed version of the target data layout string in and methods for querying it.
const Function * getParent() const
Return the enclosing method, or null if none.
Represents a single loop in the control flow graph.
void getLoopAnalysisUsage(AnalysisUsage &AU)
Helper to consistently add the set of standard passes to a loop pass's AnalysisUsage.
The adaptor from a function pass to a loop pass computes these analyses and makes them available to t...
This is an alternative analysis pass to BlockFrequencyInfoWrapperPass.
Analysis the ScalarEvolution expression for r is< loop > Outside the loop
constexpr const T * getPointer() const
Legacy analysis pass which computes MemorySSA.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
LoopRotatePass(bool EnableHeaderDuplication=true, bool PrepareForLTO=false)
Represent the analysis usage information of a pass.
PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM, LoopStandardAnalysisResults &AR, LPMUpdater &U)
const Module * getModule() const
Return the module owning the function this basic block belongs to, or nullptr if the function does no...
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
PreservedAnalyses getLoopPassPreservedAnalyses()
Returns the minimum set of Analyses that all loop passes must preserve.
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"))
This class provides an interface for updating the loop pass manager based on mutations to the loop ne...
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
initializer< Ty > init(const Ty &Val)
An analysis that produces MemorySSA for a function.
An immutable pass that tracks lazily created AssumptionCache objects.
@ TM_ForcedByUser
The transformation was directed by the user, e.g.
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
const SimplifyQuery getBestSimplifyQuery(Pass &, Function &)
TargetTransformInfo & TTI
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
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, bool PrepareForLTO=false)
Convert a loop into a loop with bottom test.
BlockT * getHeader() const
Pass * createLoopRotatePass(int MaxHeaderSize=-1, bool PrepareForLTO=false)
static cl::opt< bool > PrepareForLTOOption("rotation-prepare-for-lto", cl::init(false), cl::Hidden, cl::desc("Run loop-rotation in the prepare-for-lto stage. This option " "should be used for testing only."))
INITIALIZE_PASS_BEGIN(LoopRotateLegacyPass, "loop-rotate", "Rotate Loops", false, false) INITIALIZE_PASS_END(LoopRotateLegacyPass
Pass interface - Implemented by all 'passes'.
TransformationMode hasVectorizeTransformation(const Loop *L)
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
A container for analyses that lazily runs them and caches their results.
void initializeLoopRotateLegacyPassPass(PassRegistry &)
AnalysisUsage & addRequired()
bool VerifyMemorySSA
Enables verification of MemorySSA.
This is an alternative analysis pass to BranchProbabilityInfoWrapperPass.