LLVM: lib/Transforms/Scalar/SimplifyCFGPass.cpp File Reference (original) (raw)
Go to the source code of this file.
| Macros | |
|---|---|
| #define | DEBUG_TYPE "simplifycfg" |
| Functions | |
|---|---|
| STATISTIC (NumSimpl, "Number of blocks simplified") | |
| static bool | performBlockTailMerging (Function &F, ArrayRef< BasicBlock * > BBs, std::vector< DominatorTree::UpdateType > *Updates) |
| static bool | tailMergeBlocksWithSimilarFunctionTerminators (Function &F, DomTreeUpdater *DTU) |
| static bool | iterativelySimplifyCFG (Function &F, const TargetTransformInfo &TTI, DomTreeUpdater *DTU, const SimplifyCFGOptions &Options) |
| Call SimplifyCFG on all the blocks in the function, iterating until no more changes are made. | |
| static bool | simplifyFunctionCFGImpl (Function &F, const TargetTransformInfo &TTI, DominatorTree *DT, const SimplifyCFGOptions &Options) |
| static bool | simplifyFunctionCFG (Function &F, const TargetTransformInfo &TTI, DominatorTree *DT, const SimplifyCFGOptions &Options) |
| static void | applyCommandLineOverridesToOptions (SimplifyCFGOptions &Options) |
| INITIALIZE_PASS_BEGIN (CFGSimplifyPass, "simplifycfg", "Simplify the CFG", false, false) INITIALIZE_PASS_END(CFGSimplifyPass |
| Variables | |
|---|---|
| static cl::opt< unsigned > | UserBonusInstThreshold ("bonus-inst-threshold", cl::Hidden, cl::init(1), cl::desc("Control the number of bonus instructions (default = 1)")) |
| static cl::opt< bool > | UserKeepLoops ("keep-loops", cl::Hidden, cl::init(true), cl::desc("Preserve canonical loop structure (default = true)")) |
| static cl::opt< bool > | UserSwitchRangeToICmp ("switch-range-to-icmp", cl::Hidden, cl::init(false), cl::desc("Convert switches into an integer range comparison (default = false)")) |
| static cl::opt< bool > | UserSwitchToLookup ("switch-to-lookup", cl::Hidden, cl::init(false), cl::desc("Convert switches to lookup tables (default = false)")) |
| static cl::opt< bool > | UserForwardSwitchCond ("forward-switch-cond", cl::Hidden, cl::init(false), cl::desc("Forward switch condition to phi ops (default = false)")) |
| static cl::opt< bool > | UserHoistCommonInsts ("hoist-common-insts", cl::Hidden, cl::init(false), cl::desc("hoist common instructions (default = false)")) |
| static cl::opt< bool > | UserHoistLoadsStoresWithCondFaulting ("hoist-loads-stores-with-cond-faulting", cl::Hidden, cl::init(false), cl::desc("Hoist loads/stores if the target supports conditional faulting " "(default = false)")) |
| static cl::opt< bool > | UserSinkCommonInsts ("sink-common-insts", cl::Hidden, cl::init(false), cl::desc("Sink common instructions (default = false)")) |
| static cl::opt< bool > | UserSpeculateUnpredictables ("speculate-unpredictables", cl::Hidden, cl::init(false), cl::desc("Speculate unpredictable branches (default = false)")) |
| simplifycfg | |
| Simplify the | CFG |
| Simplify the | false |
◆ DEBUG_TYPE
#define DEBUG_TYPE "simplifycfg"
◆ applyCommandLineOverridesToOptions()
Definition at line 318 of file SimplifyCFGPass.cpp.
References Options, UserBonusInstThreshold, UserForwardSwitchCond, UserHoistCommonInsts, UserHoistLoadsStoresWithCondFaulting, UserKeepLoops, UserSinkCommonInsts, UserSpeculateUnpredictables, UserSwitchRangeToICmp, and UserSwitchToLookup.
Referenced by llvm::SimplifyCFGPass::SimplifyCFGPass(), and llvm::SimplifyCFGPass::SimplifyCFGPass().
◆ INITIALIZE_PASS_BEGIN()
| INITIALIZE_PASS_BEGIN | ( | CFGSimplifyPass | , |
|---|---|---|---|
| "simplifycfg" | , | ||
| "Simplify the CFG" | , | ||
| false | , | ||
| false | ) |
◆ iterativelySimplifyCFG()
Call SimplifyCFG on all the blocks in the function, iterating until no more changes are made.
Definition at line 229 of file SimplifyCFGPass.cpp.
References assert(), llvm::SmallPtrSetImpl< PtrType >::begin(), Changed, llvm::SmallPtrSetImpl< PtrType >::end(), F, llvm::FindFunctionBackedges(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::isBBPendingDeletion(), Options, and llvm::simplifyCFG().
Referenced by simplifyFunctionCFGImpl().
◆ performBlockTailMerging()
Definition at line 90 of file SimplifyCFGPass.cpp.
References assert(), llvm::BasicBlock::Create(), llvm::BranchInst::Create(), llvm::PHINode::Create(), llvm::BasicBlock::end(), F, llvm::DebugLoc::getMergedLocation(), llvm::Value::getName(), llvm::Instruction::getOpcode(), getType(), I, llvm::DominatorTreeBase< BasicBlock, false >::Insert, llvm::Instruction::insertInto(), llvm::User::operands(), llvm::SmallVectorImpl< T >::resize(), llvm::Instruction::setDebugLoc(), llvm::ArrayRef< T >::size(), and llvm::zip().
Referenced by tailMergeBlocksWithSimilarFunctionTerminators().
◆ simplifyFunctionCFG()
◆ simplifyFunctionCFGImpl()
◆ STATISTIC()
| STATISTIC | ( | NumSimpl | , |
|---|---|---|---|
| "Number of blocks simplified" | ) |
◆ tailMergeBlocksWithSimilarFunctionTerminators()
Definition at line 164 of file SimplifyCFGPass.cpp.
References llvm::any_of(), llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::applyUpdates(), Changed, llvm::dyn_cast_or_null(), F, llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::isBBPendingDeletion(), llvm::make_second_range(), performBlockTailMerging(), and llvm::succ_empty().
Referenced by simplifyFunctionCFGImpl().
◆ CFG
◆ false
◆ simplifycfg
◆ UserBonusInstThreshold
◆ UserForwardSwitchCond
| cl::opt< bool > UserForwardSwitchCond("forward-switch-cond", cl::Hidden, cl::init(false), cl::desc("Forward switch condition to phi ops (default = false)")) ( "forward-switch-cond" , cl::Hidden , cl::init(false) , cl::desc("Forward switch condition to phi ops (default = false)") ) | static |
|---|
◆ UserHoistCommonInsts
| cl::opt< bool > UserHoistCommonInsts("hoist-common-insts", cl::Hidden, cl::init(false), cl::desc("hoist common instructions (default = false)")) ( "hoist-common-insts" , cl::Hidden , cl::init(false) , cl::desc("hoist common instructions (default = false)") ) | static |
|---|
◆ UserHoistLoadsStoresWithCondFaulting
| cl::opt< bool > UserHoistLoadsStoresWithCondFaulting("hoist-loads-stores-with-cond-faulting", cl::Hidden, cl::init(false), cl::desc("Hoist loads/stores if the target supports conditional faulting " "(default = false)")) ( "hoist-loads-stores-with-cond-faulting" , cl::Hidden , cl::init(false) , cl::desc("Hoist loads/stores if the target supports conditional faulting " "(default = false)") ) | static |
|---|
◆ UserKeepLoops
| cl::opt< bool > UserKeepLoops("keep-loops", cl::Hidden, cl::init(true), cl::desc("Preserve canonical loop structure (default = true)")) ( "keep-loops" , cl::Hidden , cl::init(true) , cl::desc("Preserve canonical loop structure (default = true)") ) | static |
|---|
◆ UserSinkCommonInsts
| cl::opt< bool > UserSinkCommonInsts("sink-common-insts", cl::Hidden, cl::init(false), cl::desc("Sink common instructions (default = false)")) ( "sink-common-insts" , cl::Hidden , cl::init(false) , cl::desc("Sink common instructions (default = false)") ) | static |
|---|
◆ UserSpeculateUnpredictables
| cl::opt< bool > UserSpeculateUnpredictables("speculate-unpredictables", cl::Hidden, cl::init(false), cl::desc("Speculate unpredictable branches (default = false)")) ( "speculate-unpredictables" , cl::Hidden , cl::init(false) , cl::desc("Speculate unpredictable branches (default = false)") ) | static |
|---|
◆ UserSwitchRangeToICmp
| cl::opt< bool > UserSwitchRangeToICmp("switch-range-to-icmp", cl::Hidden, cl::init(false), cl::desc( "Convert switches into an integer range comparison (default = false)")) ( "switch-range-to-icmp" , cl::Hidden , cl::init(false) , cl::desc( "Convert switches into an integer range comparison (default = false)") ) | static |
|---|
◆ UserSwitchToLookup
| cl::opt< bool > UserSwitchToLookup("switch-to-lookup", cl::Hidden, cl::init(false), cl::desc("Convert switches to lookup tables (default = false)")) ( "switch-to-lookup" , cl::Hidden , cl::init(false) , cl::desc("Convert switches to lookup tables (default = false)") ) | static |
|---|