LLVM: lib/Transforms/Scalar/ConstantHoisting.cpp File Reference (original) (raw)
Go to the source code of this file.
Functions | |
---|---|
STATISTIC (NumConstantsHoisted, "Number of constants hoisted") | |
STATISTIC (NumConstantsRebased, "Number of constants rebased") | |
INITIALIZE_PASS_BEGIN (ConstantHoistingLegacyPass, "consthoist", "Constant Hoisting", false, false) INITIALIZE_PASS_END(ConstantHoistingLegacyPass | |
static void | findBestInsertionSet (DominatorTree &DT, BlockFrequencyInfo &BFI, BasicBlock *Entry, SetVector< BasicBlock * > &BBs) |
Given BBs as input, find another set of BBs which collectively dominates BBs and have the minimal sum of frequencies. | |
static bool | updateOperand (Instruction *Inst, unsigned Idx, Instruction *Mat) |
Updates the operand at Idx in instruction Inst with the result of instruction Mat. | |
Variables | |
---|---|
static cl::opt< bool > | ConstHoistWithBlockFrequency ("consthoist-with-block-frequency", cl::init(true), cl::Hidden, cl::desc("Enable the use of the block frequency analysis to reduce the " "chance to execute const materialization more frequently than " "without hoisting.")) |
static cl::opt< bool > | ConstHoistGEP ("consthoist-gep", cl::init(false), cl::Hidden, cl::desc("Try hoisting constant gep expressions")) |
static cl::opt< unsigned > | MinNumOfDependentToRebase ("consthoist-min-num-to-rebase", cl::desc("Do not rebase if number of dependent constants of a Base is less " "than this number."), cl::init(0), cl::Hidden) |
consthoist | |
Constant | Hoisting |
Constant | false |
◆ DEBUG_TYPE
#define DEBUG_TYPE "consthoist"
◆ findBestInsertionSet()
Given BBs
as input, find another set of BBs which collectively dominates BBs
and have the minimal sum of frequencies.
Return the BB set found in BBs
.
Definition at line 214 of file ConstantHoisting.cpp.
References assert(), llvm::DomTreeNodeBase< NodeT >::children(), llvm::SetVector< T, Vector, Set, N >::clear(), llvm::SetVector< T, Vector, Set, N >::count(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::DomTreeNodeBase< NodeT >::getBlock(), llvm::DomTreeNodeBase< NodeT >::getIDom(), llvm::DominatorTreeBase< NodeT, IsPostDom >::getNode(), Idx, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), llvm::SetVector< T, Vector, Set, N >::insert(), llvm::SmallPtrSetImpl< PtrType >::insert(), isCandidate(), llvm::DominatorTree::isReachableFromEntry(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::reserve(), llvm::reverse(), and llvm::SmallVectorBase< Size_T >::size().
◆ INITIALIZE_PASS_BEGIN()
INITIALIZE_PASS_BEGIN | ( | ConstantHoistingLegacyPass | , |
---|---|---|---|
"consthoist" | , | ||
"Constant Hoisting" | , | ||
false | , | ||
false | |||
) |
◆ STATISTIC() [1/2]
STATISTIC | ( | NumConstantsHoisted | , |
---|---|---|---|
"Number of constants hoisted" | |||
) |
◆ STATISTIC() [2/2]
STATISTIC | ( | NumConstantsRebased | , |
---|---|---|---|
"Number of constants rebased" | |||
) |
◆ updateOperand()
Updates the operand at Idx in instruction Inst with the result of instruction Mat.
If the instruction is a PHI node then special handling for duplicate values from the same incoming basic block is required.
Returns
The update will always succeed, but the return value indicated if Mat was used for the update or not.
Definition at line 707 of file ConstantHoisting.cpp.
References Idx, PHI, and llvm::User::setOperand().
◆ consthoist
◆ ConstHoistGEP
cl::opt< bool > ConstHoistGEP("consthoist-gep", cl::init(false), cl::Hidden, cl::desc("Try hoisting constant gep expressions")) ( "consthoist-gep" , cl::init(false) , cl::Hidden , cl::desc("Try hoisting constant gep expressions") ) | static |
---|
◆ ConstHoistWithBlockFrequency
cl::opt< bool > ConstHoistWithBlockFrequency("consthoist-with-block-frequency", cl::init(true), cl::Hidden, cl::desc("Enable the use of the block frequency analysis to reduce the " "chance to execute const materialization more frequently than " "without hoisting.")) ( "consthoist-with-block-frequency" , cl::init(true) , cl::Hidden , cl::desc("Enable the use of the block frequency analysis to reduce the " "chance to execute const materialization more frequently than " "without hoisting.") ) | static |
---|
◆ false
◆ Hoisting
◆ MinNumOfDependentToRebase
cl::opt< unsigned > MinNumOfDependentToRebase("consthoist-min-num-to-rebase", cl::desc("Do not rebase if number of dependent constants of a Base is less " "than this number."), cl::init(0), cl::Hidden) ( "consthoist-min-num-to-rebase" , cl::desc("Do not rebase if number of dependent constants of a Base is less " "than this number.") , cl::init(0) , cl::Hidden ) | static |
---|