27 #define DEBUG_TYPE "loop-rotate" 31 cl::desc(
"The default maximum header size for automatic loop rotation"));
34 : EnableHeaderDuplication(EnableHeaderDuplication) {}
44 false, Threshold,
false);
54 class LoopRotateLegacyPass :
public LoopPass {
55 unsigned MaxHeaderSize;
59 LoopRotateLegacyPass(
int SpecifiedMaxHeaderSize = -1) :
LoopPass(ID) {
61 if (SpecifiedMaxHeaderSize == -1)
64 MaxHeaderSize =
unsigned(SpecifiedMaxHeaderSize);
79 auto *LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
80 const auto *TTI = &getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F);
81 auto *AC = &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
82 auto *DTWP = getAnalysisIfAvailable<DominatorTreeWrapperPass>();
83 auto *DT = DTWP ? &DTWP->getDomTree() :
nullptr;
84 auto *SEWP = getAnalysisIfAvailable<ScalarEvolutionWrapperPass>();
85 auto *SE = SEWP ? &SEWP->getSE() :
nullptr;
87 return LoopRotation(L, LI, TTI, AC, DT, SE, SQ,
false, MaxHeaderSize,
103 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. ...
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.
Compute iterated dominance frontiers using a linear time algorithm.
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)
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.
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.
bool LoopRotation(Loop *L, LoopInfo *LI, const TargetTransformInfo *TTI, AssumptionCache *AC, DominatorTree *DT, ScalarEvolution *SE, const SimplifyQuery &SQ, bool RotationOnly, unsigned Threshold, bool IsUtilMode)
Convert a loop into a loop with bottom test.
Represent the analysis usage information of a pass.
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...
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)
static int const Threshold
TODO: Write a new FunctionPass AliasAnalysis so that it can keep a cache.
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"))