37 #define DEBUG_TYPE "loop-simplifycfg"
45 for (
auto &Block : Blocks) {
48 BasicBlock *Succ = cast_or_null<BasicBlock>(Block);
76 class LoopSimplifyCFGLegacyPass :
public LoopPass {
87 DominatorTree &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
88 LoopInfo &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
101 "Simplify loop CFG",
false,
false)
107 return new LoopSimplifyCFGLegacyPass();
Pass interface - Implemented by all 'passes'.
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.
void removeBlock(BlockT *BB)
This method completely removes BB from all data structures, including all of the Loop objects it is n...
This header provides classes for managing a pipeline of passes over loops in LLVM IR...
This is the interface for a simple mod/ref and alias analysis over globals.
Legacy pass manager pass to access dependence information.
void MergeBasicBlockIntoOnlyPred(BasicBlock *BB, DominatorTree *DT=nullptr)
BB is a block with one predecessor and its predecessor is known to have one successor (BB!)...
The adaptor from a function pass to a loop pass computes these analyses and makes them available to t...
LoopT * getLoopFor(const BlockT *BB) const
Return the inner most loop that BB lives in.
BlockT * getHeader() const
#define INITIALIZE_PASS_DEPENDENCY(depName)
This is the interface for a SCEV-based alias analysis.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
iterator_range< block_iterator > blocks() const
A set of analyses that are preserved following a run of a transformation pass.
LLVM Basic Block Representation.
Represent the analysis usage information of a pass.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE,"Assign register bank of generic virtual registers", false, false) RegBankSelect
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
This class provides an interface for updating the loop pass manager based on mutations to the loop ne...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Pass * createLoopSimplifyCFGPass()
BasicBlock * getSingleSuccessor()
Return the successor of this block if it has a single successor.
BasicBlock * getSinglePredecessor()
Return the predecessor of this block if it has a single predecessor block.
void initializeLoopSimplifyCFGLegacyPassPass(PassRegistry &)
void moveToHeader(BlockT *BB)
This method is used to move BB (which must be part of this loop) to be the loop header of the loop (t...
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.
PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM, LoopStandardAnalysisResults &AR, LPMUpdater &U)
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.
INITIALIZE_PASS_BEGIN(LoopSimplifyCFGLegacyPass,"loop-simplifycfg","Simplify loop CFG", false, false) INITIALIZE_PASS_END(LoopSimplifyCFGLegacyPass
static bool simplifyLoopCFG(Loop &L, DominatorTree &DT, LoopInfo &LI)