LLVM  8.0.0svn
Classes | Macros | Functions | Variables
LoopSimplifyCFG.cpp File Reference
#include "llvm/Transforms/Scalar/LoopSimplifyCFG.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/BasicAliasAnalysis.h"
#include "llvm/Analysis/DependenceAnalysis.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/LoopPass.h"
#include "llvm/Analysis/MemorySSA.h"
#include "llvm/Analysis/MemorySSAUpdater.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/IR/DomTreeUpdater.h"
#include "llvm/IR/Dominators.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Scalar/LoopPassManager.h"
#include "llvm/Transforms/Utils.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Utils/LoopUtils.h"
Include dependency graph for LoopSimplifyCFG.cpp:

Go to the source code of this file.

Classes

class  ConstantTerminatorFoldingImpl
 Helper class that can turn branches and switches with constant conditions into unconditional branches. More...
 

Macros

#define DEBUG_TYPE   "loop-simplifycfg"
 

Functions

 STATISTIC (NumTerminatorsFolded, "Number of terminators folded to unconditional branches")
 
static BasicBlockgetOnlyLiveSuccessor (BasicBlock *BB)
 If BB is a switch or a conditional branch, but only one of its successors can be reached from this block in runtime, return this successor. More...
 
static bool constantFoldTerminators (Loop &L, DominatorTree &DT, LoopInfo &LI)
 Turn branches and switches with known constant conditions into unconditional branches. More...
 
static bool mergeBlocksIntoPredecessors (Loop &L, DominatorTree &DT, LoopInfo &LI, MemorySSAUpdater *MSSAU)
 
static bool simplifyLoopCFG (Loop &L, DominatorTree &DT, LoopInfo &LI, ScalarEvolution &SE, MemorySSAUpdater *MSSAU)
 
 INITIALIZE_PASS_BEGIN (LoopSimplifyCFGLegacyPass, "loop-simplifycfg", "Simplify loop CFG", false, false) INITIALIZE_PASS_END(LoopSimplifyCFGLegacyPass
 

Variables

loop simplifycfg
 
loop Simplify loop CFG
 
loop Simplify loop false
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "loop-simplifycfg"

Definition at line 42 of file LoopSimplifyCFG.cpp.

Function Documentation

◆ constantFoldTerminators()

static bool constantFoldTerminators ( Loop L,
DominatorTree DT,
LoopInfo LI 
)
static

Turn branches and switches with known constant conditions into unconditional branches.

Definition at line 346 of file LoopSimplifyCFG.cpp.

References llvm::LoopBase< BlockT, LoopT >::getLoopLatch(), and ConstantTerminatorFoldingImpl::run().

Referenced by simplifyLoopCFG().

◆ getOnlyLiveSuccessor()

static BasicBlock* getOnlyLiveSuccessor ( BasicBlock BB)
static

If BB is a switch or a conditional branch, but only one of its successors can be reached from this block in runtime, return this successor.

Otherwise, return nullptr.

Definition at line 50 of file LoopSimplifyCFG.cpp.

References llvm::dyn_cast(), llvm::Instruction::getSuccessor(), llvm::BasicBlock::getTerminator(), llvm::ConstantInt::isZero(), and SI.

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( LoopSimplifyCFGLegacyPass  ,
"loop-simplifycfg ,
"Simplify loop CFG ,
false  ,
false   
)

◆ mergeBlocksIntoPredecessors()

static bool mergeBlocksIntoPredecessors ( Loop L,
DominatorTree DT,
LoopInfo LI,
MemorySSAUpdater MSSAU 
)
static

◆ simplifyLoopCFG()

static bool simplifyLoopCFG ( Loop L,
DominatorTree DT,
LoopInfo LI,
ScalarEvolution SE,
MemorySSAUpdater MSSAU 
)
static

◆ STATISTIC()

STATISTIC ( NumTerminatorsFolded  ,
"Number of terminators folded to unconditional branches  
)

Variable Documentation

◆ CFG

loop Simplify loop CFG

Definition at line 455 of file LoopSimplifyCFG.cpp.

◆ false

loop Simplify loop false

Definition at line 455 of file LoopSimplifyCFG.cpp.

◆ simplifycfg

loop simplifycfg

Definition at line 455 of file LoopSimplifyCFG.cpp.