Lines Matching defs:CHR
52 cl::desc("Disable CHR for all functions"));
55 cl::desc("Apply CHR for all functions"));
59 cl::desc("CHR considers a branch bias greater than this ratio as biased"));
63 cl::desc("CHR merges a group of N branches/selects where N >= this value"));
67 cl::desc("Specify file to retrieve the list of modules to apply CHR to"));
71 cl::desc("Specify file to retrieve the list of functions to apply CHR to"));
75 cl::desc("Max number of duplications by CHR for a region"));
125 // paths due to CHR.
142 // CHRScope - a sequence of regions to CHR together. It corresponds to a
260 // The instruction at which to insert the CHR conditional branch (and hoist
286 class CHR {
288 CHR(Function &Fin, BlockFrequencyInfo &BFIin, DominatorTree &DTin,
293 ~CHR() {
302 // See the comments in CHR::run() for the high level flow of the algorithm and
434 CHR_DEBUG(dbgs() << "CHR IR dump " << Label << " " << ModuleName << " "
467 // Return true if the given instruction type can be hoisted by CHR.
476 // Return true if the given instruction can be hoisted by CHR.
516 // after CHR.
675 // insert the CHR branch for a region. This is the terminator branch in the
712 // Find a CHR scope in the given region.
713 CHRScope * CHR::findScope(Region *R) {
746 // excluded, it can prevent CHR from merging adjacent regions into bigger
850 // hoisted above the the CHR branch insert point (the most dominating of
871 void CHR::checkScopeHoistable(CHRScope *Scope) {
974 CHRScope * CHR::findScopes(Region *R, Region *NextRegion, Region *ParentRegion,
1113 void CHR::splitScopes(SmallVectorImpl<CHRScope *> &Input,
1129 SmallVector<CHRScope *, 8> CHR::splitScope(
1259 void CHR::classifyBiasedScopes(SmallVectorImpl<CHRScope *> &Scopes) {
1288 void CHR::classifyBiasedScopes(CHRScope *Scope, CHRScope *OutermostScope) {
1321 void CHR::filterScopes(SmallVectorImpl<CHRScope *> &Input,
1346 void CHR::setCHRRegions(SmallVectorImpl<CHRScope *> &Input,
1369 void CHR::setCHRRegions(CHRScope *Scope, CHRScope *OutermostScope) {
1372 // are and constant-folded after CHR (in case one biased select or a branch
1422 void CHR::sortScopes(SmallVectorImpl<CHRScope *> &Input,
1446 // The trivial phi inserted by the previous CHR scope could replace a
1448 // previous CHR scope, which dominates this scope, it's safe to stop
1615 // Assert that all the CHR regions of the scope have a biased branch or select.
1673 void CHR::transformScopes(CHRScope *Scope, DenseSet<PHINode *> &TrivialPHIs) {
1705 // Insert a trivial phi at the exit block (where the CHR hot path and the
1708 // incoming values for the CHR cold paths to it below. Without this, we'd
1716 // insert the CHR branch into. Note DT gets updated. Since DT gets updated
1761 void CHR::cloneScopeBlocks(CHRScope *Scope,
1767 // CHR-optimized code and the cloned blocks will be the original unoptimized
1770 // which CHR should apply to.
1820 BranchInst *CHR::createMergedBranch(BasicBlock *PreEntryBlock,
1846 void CHR::fixupBranchesAndSelects(CHRScope *Scope,
1870 "CHR",
1882 CHR_DEBUG(dbgs() << "CHR branch bias " << Weights[0] << ":" << Weights[1]
1888 void CHR::fixupBranch(Region *R, CHRScope *Scope,
1931 void CHR::fixupSelect(SelectInst *SI, CHRScope *Scope,
1955 void CHR::addToMergedCondition(bool IsTrueBiased, Value *Cond,
1976 void CHR::transformScopes(SmallVectorImpl<CHRScope *> &CHRScopes) {
1997 bool CHR::run() {
2029 // Filter out the scopes that has only one biased region or select (CHR
2035 // Set the regions to be CHR'ed and their hoist stops for each scope.
2038 CHR_DEBUG(dumpScopes(SetScopes, "Set CHR regions"));
2041 // ones. We need to apply CHR from outer to inner so that we apply CHR only
2051 // Apply the CHR transformation.
2085 // If there is no profile summary, we should not do CHR.
2093 bool Changed = CHR(F, BFI, DT, PSI, RI, ORE).run();