LLVM: lib/Transforms/Instrumentation/ControlHeightReduction.cpp File Reference (original) (raw)

Go to the source code of this file.

Macros
#define DEBUG_TYPE "chr"
#define CHR_DEBUG(X)
Functions
static void parseCHRFilterFiles ()
static raw_ostream & operator<< (raw_ostream &OS, const CHRStats &Stats)
static raw_ostream & operator<< (raw_ostream &OS, const CHRScope &Scope)
static bool shouldApply (Function &F, ProfileSummaryInfo &PSI)
static void dumpIR (Function &F, const char *Label, CHRStats *Stats)
static bool isHoistableInstructionType (Instruction *I)
static bool isHoistable (Instruction *I, DominatorTree &DT)
static const std::set< Value * > & getBaseValues (Value *V, DominatorTree &DT, DenseMap< Value *, std::set< Value * > > &Visited)
static bool checkHoistValue (Value *V, Instruction *InsertPoint, DominatorTree &DT, DenseSet< Instruction * > &Unhoistables, DenseSet< Instruction * > *HoistStops, DenseMap< Instruction *, bool > &Visited)
static bool extractBranchProbabilities (Instruction *I, BranchProbability &TrueProb, BranchProbability &FalseProb)
static BranchProbability getCHRBiasThreshold ()
template<typename K, typename S, typename M>
static bool checkBias (K *Key, BranchProbability TrueProb, BranchProbability FalseProb, S &TrueSet, S &FalseSet, M &BiasMap)
static bool checkBiasedBranch (BranchInst *BI, Region *R, DenseSet< Region * > &TrueBiasedRegionsGlobal, DenseSet< Region * > &FalseBiasedRegionsGlobal, DenseMap< Region *, BranchProbability > &BranchBiasMap)
static bool checkBiasedSelect (SelectInst *SI, Region *R, DenseSet< SelectInst * > &TrueBiasedSelectsGlobal, DenseSet< SelectInst * > &FalseBiasedSelectsGlobal, DenseMap< SelectInst *, BranchProbability > &SelectBiasMap)
static Instruction * getBranchInsertPoint (RegInfo &RI)
static DenseSet< Value * > getCHRConditionValuesForRegion (RegInfo &RI)
static bool shouldSplit (Instruction *InsertPoint, DenseSet< Value * > &PrevConditionValues, DenseSet< Value * > &ConditionValues, DominatorTree &DT, DenseSet< Instruction * > &Unhoistables)
static void getSelectsInScope (CHRScope *Scope, DenseSet< Instruction * > &Output)
static bool hasAtLeastTwoBiasedBranches (CHRScope *Scope)
static bool CHRScopeSorter (CHRScope *Scope1, CHRScope *Scope2)
static void hoistValue (Value *V, Instruction *HoistPoint, Region *R, HoistStopMapTy &HoistStopMap, DenseSet< Instruction * > &HoistedSet, DenseSet< PHINode * > &TrivialPHIs, DominatorTree &DT)
static void hoistScopeConditions (CHRScope *Scope, Instruction *HoistPoint, DenseSet< PHINode * > &TrivialPHIs, DominatorTree &DT)
static bool negateICmpIfUsedByBranchOrSelectOnly (ICmpInst *ICmp, Instruction *ExcludedUser, CHRScope *Scope)
static void insertTrivialPHIs (CHRScope *Scope, BasicBlock *EntryBlock, BasicBlock *ExitBlock, DenseSet< PHINode * > &TrivialPHIs)
static void assertCHRRegionsHaveBiasedBranchOrSelect (CHRScope *Scope)
static void assertBranchOrSelectConditionHoisted (CHRScope *Scope, BasicBlock *PreEntryBlock)
static void dumpScopes (SmallVectorImpl< CHRScope * > &Scopes, const char *Label)
Variables
static cl::opt< bool > DisableCHR ("disable-chr", cl::init(false), cl::Hidden, cl::desc("Disable CHR for all functions"))
static cl::opt< bool > ForceCHR ("force-chr", cl::init(false), cl::Hidden, cl::desc("Apply CHR for all functions"))
static cl::opt< double > CHRBiasThreshold ("chr-bias-threshold", cl::init(0.99), cl::Hidden, cl::desc("CHR considers a branch bias greater than this ratio as biased"))
static cl::opt< unsigned > CHRMergeThreshold ("chr-merge-threshold", cl::init(2), cl::Hidden, cl::desc("CHR merges a group of N branches/selects where N >= this value"))
static cl::opt< std::string > CHRModuleList ("chr-module-list", cl::init(""), cl::Hidden, cl::desc("Specify file to retrieve the list of modules to apply CHR to"))
static cl::opt< std::string > CHRFunctionList ("chr-function-list", cl::init(""), cl::Hidden, cl::desc("Specify file to retrieve the list of functions to apply CHR to"))
static cl::opt< unsigned > CHRDupThreshsold ("chr-dup-threshold", cl::init(3), cl::Hidden, cl::desc("Max number of duplications by CHR for a region"))
static StringSet CHRModules
static StringSet CHRFunctions

CHR_DEBUG

DEBUG_TYPE

assertBranchOrSelectConditionHoisted()

void assertBranchOrSelectConditionHoisted ( CHRScope * Scope, BasicBlock * PreEntryBlock ) static

assertCHRRegionsHaveBiasedBranchOrSelect()

void assertCHRRegionsHaveBiasedBranchOrSelect ( CHRScope * Scope) static

checkBias()

template<typename K, typename S, typename M>

checkBiasedBranch()

checkBiasedSelect()

checkHoistValue()

Definition at line 524 of file ControlHeightReduction.cpp.

References assert(), checkHoistValue(), CHR_DEBUG, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::count(), llvm::dbgs(), llvm::DominatorTree::dominates(), llvm::dyn_cast(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::DominatorTreeBase< NodeT, IsPostDom >::getNode(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), I, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert_range(), and isHoistable().

Referenced by checkHoistValue(), and shouldSplit().

CHRScopeSorter()

bool CHRScopeSorter ( CHRScope * Scope1, CHRScope * Scope2 ) static

dumpIR()

dumpScopes()

extractBranchProbabilities()

getBaseValues()

getBranchInsertPoint()

getCHRBiasThreshold()

getCHRConditionValuesForRegion()

getSelectsInScope()

hasAtLeastTwoBiasedBranches()

bool hasAtLeastTwoBiasedBranches ( CHRScope * Scope) static

hoistScopeConditions()

hoistValue()

Definition at line 1422 of file ControlHeightReduction.cpp.

References assert(), CHR_DEBUG, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::count(), llvm::dbgs(), llvm::DominatorTree::dominates(), llvm::dyn_cast(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::DominatorTreeBase< NodeT, IsPostDom >::getNode(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), hoistValue(), I, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), isHoistableInstructionType(), and IT.

Referenced by hoistScopeConditions(), and hoistValue().

insertTrivialPHIs()

Definition at line 1545 of file ControlHeightReduction.cpp.

References AbstractManglingParser< Derived, Alloc >::NumOps, llvm::PHINode::addIncoming(), llvm::BasicBlock::begin(), CHR_DEBUG, llvm::SetVector< T, Vector, Set, N >::contains(), llvm::PHINode::Create(), llvm::dbgs(), llvm::dyn_cast(), I, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), llvm::SetVector< T, Vector, Set, N >::insert(), llvm::Instruction::insertBefore(), llvm::isa(), llvm::make_early_inc_range(), llvm::pred_size(), llvm::predecessors(), and Users.

isHoistable()

isHoistableInstructionType()

negateICmpIfUsedByBranchOrSelectOnly()

operator<<() [1/2]

operator<<() [2/2]

parseCHRFilterFiles()

void parseCHRFilterFiles ( ) static

shouldApply()

shouldSplit()

CHRBiasThreshold

cl::opt< double > CHRBiasThreshold("chr-bias-threshold", cl::init(0.99), cl::Hidden, cl::desc("CHR considers a branch bias greater than this ratio as biased")) ( "chr-bias-threshold" , cl::init(0.99) , cl::Hidden , cl::desc("CHR considers a branch bias greater than this ratio as biased") ) static

CHRDupThreshsold

cl::opt< unsigned > CHRDupThreshsold("chr-dup-threshold", cl::init(3), cl::Hidden, cl::desc("Max number of duplications by CHR for a region")) ( "chr-dup-threshold" , cl::init(3) , cl::Hidden , cl::desc("Max number of duplications by CHR for a region") ) static

CHRFunctionList

CHRFunctions

CHRMergeThreshold

CHRModuleList

cl::opt< std::string > CHRModuleList("chr-module-list", cl::init(""), cl::Hidden, cl::desc("Specify file to retrieve the list of modules to apply CHR to")) ( "chr-module-list" , cl::init("") , cl::Hidden , cl::desc("Specify file to retrieve the list of modules to apply CHR to") ) static

CHRModules

DisableCHR

cl::opt< bool > DisableCHR("disable-chr", cl::init(false), cl::Hidden, cl::desc("Disable CHR for all functions")) ( "disable-chr" , cl::init(false) , cl::Hidden , cl::desc("Disable CHR for all functions") ) static

ForceCHR

cl::opt< bool > ForceCHR("force-chr", cl::init(false), cl::Hidden, cl::desc("Apply CHR for all functions")) ( "force-chr" , cl::init(false) , cl::Hidden , cl::desc("Apply CHR for all functions") ) static