LLVM: lib/Transforms/Utils/SimplifyCFG.cpp File Reference (original) (raw)
Go to the source code of this file.
Classes | |
---|---|
struct | SwitchSuccWrapper |
Checking whether two cases of SI are equal depends on the contents of the BasicBlock and the incoming values of their successor PHINodes. More... | |
struct | llvm::DenseMapInfo< const SwitchSuccWrapper * > |
Namespaces | |
---|---|
namespace | llvm |
This is an optimization pass for GlobalISel generic memory operations. | |
Functions | |
---|---|
STATISTIC (NumBitMaps, "Number of switch instructions turned into bitmaps") | |
STATISTIC (NumLinearMaps, "Number of switch instructions turned into linear mapping") | |
STATISTIC (NumLookupTables, "Number of switch instructions turned into lookup tables") | |
STATISTIC (NumLookupTablesHoles, "Number of switch instructions turned into lookup tables (holes checked)") | |
STATISTIC (NumTableCmpReuses, "Number of reused switch table lookup compares") | |
STATISTIC (NumFoldValueComparisonIntoPredecessors, "Number of value comparisons folded into predecessor basic blocks") | |
STATISTIC (NumFoldBranchToCommonDest, "Number of branches folded into predecessor basic block") | |
STATISTIC (NumHoistCommonCode, "Number of common instruction 'blocks' hoisted up to the begin block") | |
STATISTIC (NumHoistCommonInstrs, "Number of common instructions hoisted up to the begin block") | |
STATISTIC (NumSinkCommonCode, "Number of common instruction 'blocks' sunk down to the end block") | |
STATISTIC (NumSinkCommonInstrs, "Number of common instructions sunk down to the end block") | |
STATISTIC (NumSpeculations, "Number of speculative executed instructions") | |
STATISTIC (NumInvokes, "Number of invokes with empty resume blocks simplified into calls") | |
STATISTIC (NumInvokesMerged, "Number of invokes that were merged together") | |
STATISTIC (NumInvokeSetsFormed, "Number of invoke sets that were formed") | |
static bool | incomingValuesAreCompatible (BasicBlock *BB, ArrayRef< BasicBlock * > IncomingBlocks, SmallPtrSetImpl< Value * > *EquivalenceSet=nullptr) |
Return true if all the PHI nodes in the basic block BB receive compatible (identical) incoming values when coming from all of the predecessor blocks that are specified in IncomingBlocks. | |
static bool | safeToMergeTerminators (Instruction *SI1, Instruction *SI2, SmallSetVector< BasicBlock *, 4 > *FailBlocks=nullptr) |
Return true if it is safe to merge these two terminator instructions together. | |
static void | addPredecessorToBlock (BasicBlock *Succ, BasicBlock *NewPred, BasicBlock *ExistPred, MemorySSAUpdater *MSSAU=nullptr) |
Update PHI nodes in Succ to indicate that there will now be entries in it from the 'NewPred' block. | |
static InstructionCost | computeSpeculationCost (const User *I, const TargetTransformInfo &TTI) |
Compute an abstract "cost" of speculating the given instruction, which is assumed to be safe to speculate. | |
static bool | dominatesMergePoint (Value *V, BasicBlock *BB, Instruction *InsertPt, SmallPtrSetImpl< Instruction * > &AggressiveInsts, InstructionCost &Cost, InstructionCost Budget, const TargetTransformInfo &TTI, AssumptionCache *AC, unsigned Depth=0) |
If we have a merge point of an "if condition" as accepted above, return true if the specified value dominates the block. | |
static ConstantInt * | getConstantInt (Value *V, const DataLayout &DL) |
Extract ConstantInt from value, looking through IntToPtr and PointerNullValue. | |
static void | eraseTerminatorAndDCECond (Instruction *TI, MemorySSAUpdater *MSSAU=nullptr) |
static void | eliminateBlockCases (BasicBlock *BB, std::vector< ValueEqualityComparisonCase > &Cases) |
Given a vector of bb/value pairs, remove any entries in the list that match the specified block. | |
static bool | valuesOverlap (std::vector< ValueEqualityComparisonCase > &C1, std::vector< ValueEqualityComparisonCase > &C2) |
Return true if there are any keys in C1 that exist in C2 as well. | |
static void | setBranchWeights (SwitchInst *SI, ArrayRef< uint32_t > Weights, bool IsExpected) |
static void | setBranchWeights (Instruction *I, uint32_t TrueWeight, uint32_t FalseWeight, bool IsExpected) |
static int | constantIntSortPredicate (ConstantInt *const *P1, ConstantInt *const *P2) |
static void | getBranchWeights (Instruction *TI, SmallVectorImpl< uint64_t > &Weights) |
Get Weights of a given terminator, the default weight is at the front of the vector. | |
static void | fitWeights (MutableArrayRef< uint64_t > Weights) |
Keep halving the weights until all can fit in uint32_t. | |
static void | cloneInstructionsIntoPredecessorBlockAndUpdateSSAUses (BasicBlock *BB, BasicBlock *PredBlock, ValueToValueMapTy &VMap) |
static bool | isSafeToHoistInvoke (BasicBlock *BB1, BasicBlock *BB2, Instruction *I1, Instruction *I2) |
static unsigned | skippedInstrFlags (Instruction *I) |
static bool | isSafeToHoistInstr (Instruction *I, unsigned Flags) |
static bool | passingValueIsAlwaysUndefined (Value *V, Instruction *I, bool PtrValueMayBeModified) |
Check if passing a value to an instruction will cause undefined behavior. | |
static bool | shouldHoistCommonInstructions (Instruction *I1, Instruction *I2, const TargetTransformInfo &TTI) |
Helper function for hoistCommonCodeFromSuccessors. | |
static void | hoistLockstepIdenticalDbgVariableRecords (Instruction *TI, Instruction *I1, SmallVectorImpl< Instruction * > &OtherInsts) |
Hoists DbgVariableRecords from I1 and OtherInstrs that are identical in lock-step to TI. | |
static bool | areIdenticalUpToCommutativity (const Instruction *I1, const Instruction *I2) |
static void | hoistConditionalLoadsStores (BranchInst *BI, SmallVectorImpl< Instruction * > &SpeculatedConditionalLoadsStores, std::optional< bool > Invert) |
If the target supports conditional faulting, we look for the following pattern: | |
static bool | isSafeCheapLoadStore (const Instruction *I, const TargetTransformInfo &TTI) |
static bool | isLifeTimeMarker (const Instruction *I) |
static bool | replacingOperandWithVariableIsCheap (const Instruction *I, int OpIdx) |
static bool | canSinkInstructions (ArrayRef< Instruction * > Insts, DenseMap< const Use *, SmallVector< Value *, 4 > > &PHIOperands) |
static void | sinkLastInstruction (ArrayRef< BasicBlock * > Blocks) |
static bool | sinkCommonCodeFromPredecessors (BasicBlock *BB, DomTreeUpdater *DTU) |
Check whether BB's predecessors end with unconditional branches. | |
static void | mergeCompatibleInvokesImpl (ArrayRef< InvokeInst * > Invokes, DomTreeUpdater *DTU) |
static bool | mergeCompatibleInvokes (BasicBlock *BB, DomTreeUpdater *DTU) |
If this block is a landingpad exception handling block, categorize all the predecessor invokes into sets, with all invokes in each set being "mergeable" together, and then merge invokes in each set together. | |
static Value * | isSafeToSpeculateStore (Instruction *I, BasicBlock *BrBB, BasicBlock *StoreBB, BasicBlock *EndBB) |
Determine if we can hoist sink a sole store instruction out of a conditional block. | |
static bool | validateAndCostRequiredSelects (BasicBlock *BB, BasicBlock *ThenBB, BasicBlock *EndBB, unsigned &SpeculatedInstructions, InstructionCost &Cost, const TargetTransformInfo &TTI) |
Estimate the cost of the insertion(s) and check that the PHI nodes can be converted to selects. | |
static bool | isProfitableToSpeculate (const BranchInst *BI, std::optional< bool > Invert, const TargetTransformInfo &TTI) |
static bool | blockIsSimpleEnoughToThreadThrough (BasicBlock *BB) |
Return true if we can thread a branch across this block. | |
static ConstantInt * | getKnownValueOnEdge (Value *V, BasicBlock *From, BasicBlock *To) |
static std::optional< bool > | foldCondBranchOnValueKnownInPredecessorImpl (BranchInst *BI, DomTreeUpdater *DTU, const DataLayout &DL, AssumptionCache *AC) |
If we have a conditional branch on something for which we know the constant value in predecessors (e.g. | |
static bool | foldCondBranchOnValueKnownInPredecessor (BranchInst *BI, DomTreeUpdater *DTU, const DataLayout &DL, AssumptionCache *AC) |
static bool | foldTwoEntryPHINode (PHINode *PN, const TargetTransformInfo &TTI, DomTreeUpdater *DTU, AssumptionCache *AC, const DataLayout &DL, bool SpeculateUnpredictables) |
Given a BB that starts with the specified two-entry PHI node, see if we can eliminate it. | |
static Value * | createLogicalOp (IRBuilderBase &Builder, Instruction::BinaryOps Opc, Value *LHS, Value *RHS, const Twine &Name="") |
static bool | extractPredSuccWeights (BranchInst *PBI, BranchInst *BI, uint64_t &PredTrueWeight, uint64_t &PredFalseWeight, uint64_t &SuccTrueWeight, uint64_t &SuccFalseWeight) |
Return true if either PBI or BI has branch weight available, and store the weights in {Pred|Succ}{True | |
static std::optional< std::tuple< BasicBlock *, Instruction::BinaryOps, bool > > | shouldFoldCondBranchesToCommonDestination (BranchInst *BI, BranchInst *PBI, const TargetTransformInfo *TTI) |
Determine if the two branches share a common destination and deduce a glue that joins the branches' conditions to arrive at the common destination if that would be profitable. | |
static bool | performBranchToCommonDestFolding (BranchInst *BI, BranchInst *PBI, DomTreeUpdater *DTU, MemorySSAUpdater *MSSAU, const TargetTransformInfo *TTI) |
static bool | isVectorOp (Instruction &I) |
Return if an instruction's type or any of its operands' types are a vector type. | |
static StoreInst * | findUniqueStoreInBlocks (BasicBlock *BB1, BasicBlock *BB2) |
static Value * | ensureValueAvailableInSuccessor (Value *V, BasicBlock *BB, Value *AlternativeV=nullptr) |
static bool | mergeConditionalStoreToAddress (BasicBlock *PTB, BasicBlock *PFB, BasicBlock *QTB, BasicBlock *QFB, BasicBlock *PostBB, Value *Address, bool InvertPCond, bool InvertQCond, DomTreeUpdater *DTU, const DataLayout &DL, const TargetTransformInfo &TTI) |
static bool | mergeConditionalStores (BranchInst *PBI, BranchInst *QBI, DomTreeUpdater *DTU, const DataLayout &DL, const TargetTransformInfo &TTI) |
static bool | tryWidenCondBranchToCondBranch (BranchInst *PBI, BranchInst *BI, DomTreeUpdater *DTU) |
If the previous block ended with a widenable branch, determine if reusing the target block is profitable and legal. | |
static bool | SimplifyCondBranchToCondBranch (BranchInst *PBI, BranchInst *BI, DomTreeUpdater *DTU, const DataLayout &DL, const TargetTransformInfo &TTI) |
If we have a conditional branch as a predecessor of another block, this function tries to simplify it. | |
static bool | isCleanupBlockEmpty (iterator_range< BasicBlock::iterator > R) |
static bool | removeEmptyCleanup (CleanupReturnInst *RI, DomTreeUpdater *DTU) |
static bool | mergeCleanupPad (CleanupReturnInst *RI) |
static bool | casesAreContiguous (SmallVectorImpl< ConstantInt * > &Cases) |
static void | createUnreachableSwitchDefault (SwitchInst *Switch, DomTreeUpdater *DTU, bool RemoveOrigDefaultBlock=true) |
static bool | eliminateDeadSwitchCases (SwitchInst *SI, DomTreeUpdater *DTU, AssumptionCache *AC, const DataLayout &DL) |
Compute masked bits for the condition of a switch and use it to remove dead cases. | |
static PHINode * | findPHIForConditionForwarding (ConstantInt *CaseValue, BasicBlock *BB, int *PhiIndex) |
If BB would be eligible for simplification by TryToSimplifyUncondBranchFromEmptyBlock (i.e. | |
static bool | forwardSwitchConditionToPHI (SwitchInst *SI) |
Try to forward the condition of a switch instruction to a phi node dominated by the switch, if that would mean that some of the destination blocks of the switch can be folded away. | |
static bool | validLookupTableConstant (Constant *C, const TargetTransformInfo &TTI) |
Return true if the backend will be able to handle initializing an array of constants like C. | |
static Constant * | lookupConstant (Value *V, const SmallDenseMap< Value *, Constant * > &ConstantPool) |
If V is a Constant, return it. | |
static Constant * | constantFold (Instruction *I, const DataLayout &DL, const SmallDenseMap< Value *, Constant * > &ConstantPool) |
Try to fold instruction I into a constant. | |
static bool | getCaseResults (SwitchInst *SI, ConstantInt *CaseVal, BasicBlock *CaseDest, BasicBlock **CommonDest, SmallVectorImpl< std::pair< PHINode *, Constant * > > &Res, const DataLayout &DL, const TargetTransformInfo &TTI) |
Try to determine the resulting constant values in phi nodes at the common destination basic block, *CommonDest, for one of the case destionations CaseDest corresponding to value CaseVal (0 for the default case), of a switch instruction SI. | |
static size_t | mapCaseToResult (ConstantInt *CaseVal, SwitchCaseResultVectorTy &UniqueResults, Constant *Result) |
static bool | initializeUniqueCases (SwitchInst *SI, PHINode *&PHI, BasicBlock *&CommonDest, SwitchCaseResultVectorTy &UniqueResults, Constant *&DefaultResult, const DataLayout &DL, const TargetTransformInfo &TTI, uintptr_t MaxUniqueResults) |
static Value * | foldSwitchToSelect (const SwitchCaseResultVectorTy &ResultVector, Constant *DefaultResult, Value *Condition, IRBuilder<> &Builder) |
static void | removeSwitchAfterSelectFold (SwitchInst *SI, PHINode *PHI, Value *SelectValue, IRBuilder<> &Builder, DomTreeUpdater *DTU) |
static bool | trySwitchToSelect (SwitchInst *SI, IRBuilder<> &Builder, DomTreeUpdater *DTU, const DataLayout &DL, const TargetTransformInfo &TTI) |
If a switch is only used to initialize one or more phi nodes in a common successor block with only two different constant values, try to replace the switch with a select. | |
static bool | isTypeLegalForLookupTable (Type *Ty, const TargetTransformInfo &TTI, const DataLayout &DL) |
static bool | isSwitchDense (uint64_t NumCases, uint64_t CaseRange) |
static bool | isSwitchDense (ArrayRef< int64_t > Values) |
static bool | shouldBuildLookupTable (SwitchInst *SI, uint64_t TableSize, const TargetTransformInfo &TTI, const DataLayout &DL, const SmallDenseMap< PHINode *, Type * > &ResultTypes) |
Determine whether a lookup table should be built for this switch, based on the number of cases, size of the table, and the types of the results. | |
static bool | shouldUseSwitchConditionAsTableIndex (ConstantInt &MinCaseVal, const ConstantInt &MaxCaseVal, bool HasDefaultResults, const SmallDenseMap< PHINode *, Type * > &ResultTypes, const DataLayout &DL, const TargetTransformInfo &TTI) |
static void | reuseTableCompare (User *PhiUser, BasicBlock *PhiBlock, BranchInst *RangeCheckBranch, Constant *DefaultValue, const SmallVectorImpl< std::pair< ConstantInt *, Constant * > > &Values) |
Try to reuse the switch table index compare. | |
static bool | switchToLookupTable (SwitchInst *SI, IRBuilder<> &Builder, DomTreeUpdater *DTU, const DataLayout &DL, const TargetTransformInfo &TTI) |
If the switch is only used to initialize one or more phi nodes in a common successor block with different constant values, replace the switch with lookup tables. | |
static bool | reduceSwitchRange (SwitchInst *SI, IRBuilder<> &Builder, const DataLayout &DL, const TargetTransformInfo &TTI) |
Try to transform a switch that has "holes" in it to a contiguous sequence of cases. | |
static bool | simplifySwitchOfPowersOfTwo (SwitchInst *SI, IRBuilder<> &Builder, const DataLayout &DL, const TargetTransformInfo &TTI) |
Tries to transform switch of powers of two to reduce switch range. | |
static bool | simplifySwitchOfCmpIntrinsic (SwitchInst *SI, IRBuilderBase &Builder, DomTreeUpdater *DTU) |
Fold switch over ucmp/scmp intrinsic to br if two of the switch arms have the same destination. | |
static bool | tryToMergeLandingPad (LandingPadInst *LPad, BranchInst *BI, BasicBlock *BB, DomTreeUpdater *DTU) |
Given an block with only a single landing pad and a unconditional branch try to find another basic block which this one can be merged with. | |
static BasicBlock * | allPredecessorsComeFromSameSource (BasicBlock *BB) |
static bool | mergeNestedCondBranch (BranchInst *BI, DomTreeUpdater *DTU) |
Fold the following pattern: bb0: br i1 cond1, label bb1, label bb2 bb1: br i1 cond2, label bb3, label bb4 bb2: br i1 cond2, label bb4, label bb3 bb3: ... bb4: ... into bb0: cond = xor i1 cond1, cond2 br i1 cond, label bb4, label bb3 bb3: ... bb4: ... NOTE: cond2 always dominates the terminator of bb0. | |
static bool | removeUndefIntroducingPredecessor (BasicBlock *BB, DomTreeUpdater *DTU, AssumptionCache *AC) |
If BB has an incoming value that will always trigger undefined behavior (eg. | |
Variables | |
---|---|
static cl::opt< unsigned > | PHINodeFoldingThreshold ("phi-node-folding-threshold", cl::Hidden, cl::init(2), cl::desc("Control the amount of phi node folding to perform (default = 2)")) |
static cl::opt< unsigned > | TwoEntryPHINodeFoldingThreshold ("two-entry-phi-node-folding-threshold", cl::Hidden, cl::init(4), cl::desc("Control the maximal total instruction cost that we are willing " "to speculatively execute to fold a 2-entry PHI node into a " "select (default = 4)")) |
static cl::opt< bool > | HoistCommon ("simplifycfg-hoist-common", cl::Hidden, cl::init(true), cl::desc("Hoist common instructions up to the parent block")) |
static cl::opt< bool > | HoistLoadsStoresWithCondFaulting ("simplifycfg-hoist-loads-stores-with-cond-faulting", cl::Hidden, cl::init(true), cl::desc("Hoist loads/stores if the target supports " "conditional faulting")) |
static cl::opt< unsigned > | HoistLoadsStoresWithCondFaultingThreshold ("hoist-loads-stores-with-cond-faulting-threshold", cl::Hidden, cl::init(6), cl::desc("Control the maximal conditional load/store that we are willing " "to speculatively execute to eliminate conditional branch " "(default = 6)")) |
static cl::opt< unsigned > | HoistCommonSkipLimit ("simplifycfg-hoist-common-skip-limit", cl::Hidden, cl::init(20), cl::desc("Allow reordering across at most this many " "instructions when hoisting")) |
static cl::opt< bool > | SinkCommon ("simplifycfg-sink-common", cl::Hidden, cl::init(true), cl::desc("Sink common instructions down to the end block")) |
static cl::opt< bool > | HoistCondStores ("simplifycfg-hoist-cond-stores", cl::Hidden, cl::init(true), cl::desc("Hoist conditional stores if an unconditional store precedes")) |
static cl::opt< bool > | MergeCondStores ("simplifycfg-merge-cond-stores", cl::Hidden, cl::init(true), cl::desc("Hoist conditional stores even if an unconditional store does not " "precede - hoist multiple conditional stores into a single " "predicated store")) |
static cl::opt< bool > | MergeCondStoresAggressively ("simplifycfg-merge-cond-stores-aggressively", cl::Hidden, cl::init(false), cl::desc("When merging conditional stores, do so even if the resultant " "basic blocks are unlikely to be if-converted as a result")) |
static cl::opt< bool > | SpeculateOneExpensiveInst ("speculate-one-expensive-inst", cl::Hidden, cl::init(true), cl::desc("Allow exactly one expensive instruction to be speculatively " "executed")) |
static cl::opt< unsigned > | MaxSpeculationDepth ("max-speculation-depth", cl::Hidden, cl::init(10), cl::desc("Limit maximum recursion depth when calculating costs of " "speculatively executed instructions")) |
static cl::opt< int > | MaxSmallBlockSize ("simplifycfg-max-small-block-size", cl::Hidden, cl::init(10), cl::desc("Max size of a block which is still considered " "small enough to thread through")) |
static cl::opt< unsigned > | BranchFoldThreshold ("simplifycfg-branch-fold-threshold", cl::Hidden, cl::init(2), cl::desc("Maximum cost of combining conditions when " "folding branches")) |
static cl::opt< unsigned > | BranchFoldToCommonDestVectorMultiplier ("simplifycfg-branch-fold-common-dest-vector-multiplier", cl::Hidden, cl::init(2), cl::desc("Multiplier to apply to threshold when determining whether or not " "to fold branch to common destination when vector operations are " "present")) |
static cl::opt< bool > | EnableMergeCompatibleInvokes ("simplifycfg-merge-compatible-invokes", cl::Hidden, cl::init(true), cl::desc("Allow SimplifyCFG to merge invokes together when appropriate")) |
static cl::opt< unsigned > | MaxSwitchCasesPerResult ("max-switch-cases-per-result", cl::Hidden, cl::init(16), cl::desc("Limit cases to analyze when converting a switch to select")) |
◆ DEBUG_TYPE
#define DEBUG_TYPE "simplifycfg"
◆ SkipFlags
Enumerator |
---|
SkipReadMem |
SkipSideEffect |
SkipImplicitControlFlow |
Definition at line 1452 of file SimplifyCFG.cpp.
◆ addPredecessorToBlock()
◆ allPredecessorsComeFromSameSource()
◆ areIdenticalUpToCommutativity()
◆ blockIsSimpleEnoughToThreadThrough()
static bool blockIsSimpleEnoughToThreadThrough ( BasicBlock * BB) | static |
---|
◆ canSinkInstructions()
Definition at line 2219 of file SimplifyCFG.cpp.
References llvm::all_of(), llvm::any_of(), assert(), llvm::CallingConv::C, llvm::canReplaceOperandWithVariable(), llvm::Instruction::CompareUsingIntersectedAttrs, llvm::equal(), llvm::ArrayRef< T >::front(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::User::getOperandUse(), I, isLifeTimeMarker(), replacingOperandWithVariableIsCheap(), and llvm::Value::uses().
Referenced by sinkCommonCodeFromPredecessors().
◆ casesAreContiguous()
◆ cloneInstructionsIntoPredecessorBlockAndUpdateSSAUses()
Definition at line 1106 of file SimplifyCFG.cpp.
References assert(), llvm::Instruction::clone(), llvm::Instruction::cloneDebugInfoFrom(), llvm::Instruction::dropUBImplyingAttrsAndMetadata(), llvm::Instruction::getDebugLoc(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::Instruction::getModule(), llvm::Value::getName(), llvm::BasicBlock::getTerminator(), llvm::Instruction::insertInto(), llvm::make_early_inc_range(), Range, llvm::RemapDbgRecordRange(), llvm::RemapInstruction(), llvm::RF_IgnoreMissingLocals, llvm::RF_NoModuleLevelChanges, llvm::Instruction::setDebugLoc(), and llvm::Value::takeName().
Referenced by performBranchToCommonDestFolding().
◆ computeSpeculationCost()
◆ constantFold()
◆ constantIntSortPredicate()
◆ createLogicalOp()
◆ createUnreachableSwitchDefault()
Definition at line 5748 of file SimplifyCFG.cpp.
References llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::applyUpdates(), llvm::BasicBlock::Create(), llvm::dbgs(), llvm::BasicBlock::getContext(), llvm::Value::getName(), llvm::BasicBlock::getParent(), llvm::is_contained(), LLVM_DEBUG, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::successors().
Referenced by eliminateDeadSwitchCases().
◆ dominatesMergePoint()
If we have a merge point of an "if condition" as accepted above, return true if the specified value dominates the block.
We don't handle the true generality of domination here, just a special case which works well enough for us.
If AggressiveInsts is non-null, and if V does not dominate BB, we check to see if V (which must be an instruction) and its recursive operands that do not dominate BB have a combined cost lower than Budget and are non-trapping. If both are true, the instruction is inserted into the set and true is returned.
The cost for most non-trapping instructions is defined as 1 except for Select whose cost is 2.
After this function returns, Cost is increased by the cost of V plus its non-dominating operands. If that cost is greater than Budget, false is returned and Cost is undefined.
Definition at line 424 of file SimplifyCFG.cpp.
References computeSpeculationCost(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::Depth, dominatesMergePoint(), llvm::SmallPtrSetImplBase::empty(), llvm::BranchInst::getSuccessor(), llvm::BasicBlock::getTerminator(), I, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::BranchInst::isConditional(), llvm::isSafeToSpeculativelyExecute(), llvm::InstructionCost::isValid(), MaxSpeculationDepth, and SpeculateOneExpensiveInst.
Referenced by dominatesMergePoint(), and foldTwoEntryPHINode().
◆ eliminateBlockCases()
static void eliminateBlockCases ( BasicBlock * BB, std::vector< ValueEqualityComparisonCase > & Cases ) | static |
---|
Given a vector of bb/value pairs, remove any entries in the list that match the specified block.
Definition at line 834 of file SimplifyCFG.cpp.
References llvm::erase().
◆ eliminateDeadSwitchCases()
Compute masked bits for the condition of a switch and use it to remove dead cases.
Definition at line 5903 of file SimplifyCFG.cpp.
References llvm::SwitchInstProfUpdateWrapper::addCase(), llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::applyUpdates(), assert(), llvm::computeKnownBits(), llvm::ComputeMaxSignificantBits(), Cond, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count(), createUnreachableSwitchDefault(), llvm::dbgs(), DL, llvm::SmallVectorBase< Size_T >::empty(), llvm::KnownBits::getBitWidth(), llvm::Type::getIntegerBitWidth(), llvm::APInt::getSignificantBits(), llvm::SwitchInstProfUpdateWrapper::getSuccessorWeight(), llvm::APInt::intersects(), llvm::APInt::isSubsetOf(), LLVM_DEBUG, llvm::KnownBits::One, llvm::popcount(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SwitchInstProfUpdateWrapper::removeCase(), llvm::SwitchInstProfUpdateWrapper::setSuccessorWeight(), llvm::Successor, and llvm::KnownBits::Zero.
◆ ensureValueAvailableInSuccessor()
Definition at line 4277 of file SimplifyCFG.cpp.
References assert(), llvm::BasicBlock::begin(), llvm::PHINode::Create(), llvm::PoisonValue::get(), getParent(), llvm::BasicBlock::getSingleSuccessor(), llvm::BasicBlock::hasNPredecessors(), I, PHI, llvm::pred_begin(), and llvm::predecessors().
Referenced by mergeConditionalStoreToAddress().
◆ eraseTerminatorAndDCECond()
◆ extractPredSuccWeights()
◆ findPHIForConditionForwarding()
◆ findUniqueStoreInBlocks()
◆ fitWeights()
◆ foldCondBranchOnValueKnownInPredecessor()
◆ foldCondBranchOnValueKnownInPredecessorImpl()
If we have a conditional branch on something for which we know the constant value in predecessors (e.g.
a phi node in the current block), thread edges from the predecessor to their ultimate destination.
Definition at line 3564 of file SimplifyCFG.cpp.
References addPredecessorToBlock(), llvm::any_of(), llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::applyUpdates(), llvm::BasicBlock::begin(), blockIsSimpleEnoughToThreadThrough(), Cond, llvm::dbgs(), DL, llvm::MapVector< KeyT, ValueT, MapType, VectorType >::empty(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::FoldSingleEntryPHINodes(), llvm::BranchInst::getCondition(), llvm::Instruction::getDebugLoc(), llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValueForBlock(), getKnownValueOnEdge(), llvm::Value::getName(), llvm::PHINode::getNumIncomingValues(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::BranchInst::getSuccessor(), llvm::BasicBlock::getTerminator(), llvm::ConstantInt::getZExtValue(), llvm::PHINode::incoming_values(), llvm::MapVector< KeyT, ValueT, MapType, VectorType >::insert(), LLVM_DEBUG, llvm::MergeBlockIntoPredecessor(), N, llvm::predecessors(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::AssumptionCache::registerAssumption(), llvm::BasicBlock::removePredecessor(), llvm::Instruction::setDebugLoc(), llvm::BranchInst::setSuccessor(), llvm::simplifyInstruction(), and llvm::SplitBlockPredecessors().
Referenced by foldCondBranchOnValueKnownInPredecessor().
◆ foldSwitchToSelect()
Definition at line 6309 of file SimplifyCFG.cpp.
References llvm::And, llvm::IRBuilderBase::CreateAnd(), llvm::IRBuilderBase::CreateICmpEQ(), llvm::IRBuilderBase::CreateOr(), llvm::IRBuilderBase::CreateSelect(), llvm::IRBuilderBase::CreateSub(), llvm::ConstantInt::getBitWidth(), llvm::Constant::getNullValue(), llvm::ConstantInt::getValue(), llvm::APInt::getZero(), llvm::Constant::isNullValue(), llvm::isPowerOf2_32(), llvm::Log2_32(), llvm::APInt::popcount(), and llvm::ArrayRef< T >::size().
Referenced by trySwitchToSelect().
◆ foldTwoEntryPHINode()
Given a BB that starts with the specified two-entry PHI node, see if we can eliminate it.
Definition at line 3737 of file SimplifyCFG.cpp.
References llvm::any_of(), llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::applyUpdates(), assert(), llvm::BasicBlock::begin(), llvm::PHINode::blocks(), llvm::copy_if(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::IRBuilderBase::CreateBr(), llvm::IRBuilderBase::CreateSelectFMF(), llvm::dbgs(), DL, dominatesMergePoint(), llvm::Instruction::eraseFromParent(), llvm::extractBranchWeights(), llvm::TargetTransformInfo::getBranchMispredictPenalty(), llvm::BranchProbability::getBranchProbability(), llvm::BranchProbability::getCompl(), llvm::BranchInst::getCondition(), llvm::GetIfCondition(), llvm::PHINode::getIncomingValue(), llvm::PHINode::getIncomingValueForBlock(), llvm::Instruction::getMetadata(), llvm::Value::getName(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::TargetTransformInfo::getPredictableBranchThreshold(), llvm::BranchInst::getSuccessor(), llvm::Value::getType(), llvm::BasicBlock::hasAddressTaken(), llvm::hoistAllInstructionsInto(), I, II, llvm::Type::isIntegerTy(), LLVM_DEBUG, llvm::PatternMatch::m_AnyIntegralConstant(), llvm::PatternMatch::m_BinOp(), llvm::PatternMatch::m_c_Select(), llvm::PatternMatch::m_CombineOr(), llvm::PatternMatch::m_ImmConstant(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::Value::replaceAllUsesWith(), llvm::simplifyInstruction(), llvm::SmallVectorBase< Size_T >::size(), llvm::Successor, llvm::successors(), std::swap(), llvm::Value::takeName(), llvm::TargetTransformInfo::TCC_Basic, and TwoEntryPHINodeFoldingThreshold.
◆ forwardSwitchConditionToPHI()
◆ getBranchWeights()
Get Weights of a given terminator, the default weight is at the front of the vector.
If TI is a conditional eq, we need to swap the branch-weight metadata.
Definition at line 1079 of file SimplifyCFG.cpp.
References assert(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::extractFromBranchWeightMD64(), llvm::SmallVectorTemplateCommon< T, typename >::front(), llvm::BranchInst::getCondition(), llvm::Instruction::getMetadata(), llvm::CmpInst::getPredicate(), llvm::SmallVectorBase< Size_T >::size(), and std::swap().
◆ getCaseResults()
Try to determine the resulting constant values in phi nodes at the common destination basic block, *CommonDest, for one of the case destionations CaseDest corresponding to value CaseVal (0 for the default case), of a switch instruction SI.
Definition at line 6163 of file SimplifyCFG.cpp.
References llvm::CallingConv::C, constantFold(), DL, llvm::Use::getUser(), I, Idx, llvm::BasicBlock::instructionsWithoutDebug(), lookupConstant(), PHI, and validLookupTableConstant().
Referenced by initializeUniqueCases(), and switchToLookupTable().
◆ getConstantInt()
◆ getKnownValueOnEdge()
◆ hoistConditionalLoadsStores()
If the target supports conditional faulting, we look for the following pattern:
BB:
...
%cond = icmp ult %x, %y
br i1 %cond, label %TrueBB, label %FalseBB
FalseBB:
store i32 1, ptr %q, align 4
...
TrueBB:
%maskedloadstore = load i32, ptr %b, align 4
store i32 %maskedloadstore, ptr %p, align 4
...
AMDGPU Mark last scratch load
and transform it into:
BB:
...
%cond = icmp ult %x, %y
%maskedloadstore = cload i32, ptr %b, %cond
cstore i32 %maskedloadstore, ptr %p, %cond
cstore i32 1, ptr %q, ~%cond
br i1 %cond, label %TrueBB, label %FalseBB
FalseBB:
...
TrueBB:
...
where cload/cstore are represented by llvm.masked.load/store intrinsics, e.g.
%vcond = bitcast i1 %cond to <1 x i1>
%v0 = call <1 x i32> @llvm.masked.load.v1i32.p0
(ptr %b, i32 4, <1 x i1> %vcond, <1 x i32> poison)
%maskedloadstore = bitcast <1 x i32> %v0 to i32
call void @llvm.masked.store.v1i32.p0
(<1 x i32> %v0, ptr %p, i32 4, <1 x i1> %vcond)
%cond.not = xor i1 %cond, true
%vcond.not = bitcast i1 %cond.not to <1 x i>
call void @llvm.masked.store.v1i32.p0
(<1 x i32> <i32 1>, ptr %q, i32 4, <1x i1> %vcond.not)
This is an optimization pass for GlobalISel generic memory operations.
So we need to turn hoisted load/store into cload/cstore.
Parameters
BI | The branch instruction. |
---|---|
SpeculatedConditionalLoadsStores | The load/store instructions that will be speculated. |
Invert | indicates if speculates FalseBB. Only used in triangle CFG. |
Definition at line 1671 of file SimplifyCFG.cpp.
References llvm::CallBase::addRangeRetAttr(), assert(), llvm::SmallVectorTemplateCommon< T, typename >::back(), Cond, llvm::Instruction::copyMetadata(), llvm::IRBuilderBase::CreateBitCast(), llvm::IRBuilderBase::CreateMaskedLoad(), llvm::IRBuilderBase::CreateMaskedStore(), llvm::IRBuilderBase::CreateXor(), llvm::at::deleteAssignmentMarkers(), llvm::FixedVectorType::get(), llvm::PHINode::getBasicBlockIndex(), llvm::getConstantRangeFromMetadata(), llvm::PHINode::getIncomingValueForBlock(), llvm::Type::getInt1Ty(), llvm::getLoadStoreType(), llvm::User::getOperand(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::ConstantInt::getTrue(), llvm::Value::getType(), I, and llvm::PHINode::setIncomingValue().
◆ hoistLockstepIdenticalDbgVariableRecords()
Hoists DbgVariableRecords from I1
and OtherInstrs
that are identical in lock-step to TI
.
This matches how dbg.* intrinsics are hoisting in hoistCommonCodeFromSuccessors. e.g. The input: I1 DVRs: { x, z }, OtherInsts: { I2 DVRs: { x, y, z } } would result in hoisting only DbgVariableRecord x.
Definition at line 1546 of file SimplifyCFG.cpp.
References llvm::all_of(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), I, llvm::make_first_range(), llvm::none_of(), Other, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::DbgRecord::removeFromParent(), llvm::SmallVectorImpl< T >::reserve(), and llvm::SmallVectorBase< Size_T >::size().
◆ incomingValuesAreCompatible()
◆ initializeUniqueCases()
Definition at line 6252 of file SimplifyCFG.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::Function::begin(), DL, getCaseResults(), llvm::BasicBlock::getFirstNonPHIOrDbg(), I, mapCaseToResult(), MaxSwitchCasesPerResult, PHI, Results, llvm::SmallVectorBase< Size_T >::size(), and llvm::Function::size().
Referenced by trySwitchToSelect().
◆ isCleanupBlockEmpty()
◆ isLifeTimeMarker()
◆ isProfitableToSpeculate()
◆ isSafeCheapLoadStore()
◆ isSafeToHoistInstr()
◆ isSafeToHoistInvoke()
◆ isSafeToSpeculateStore()
Determine if we can hoist sink a sole store instruction out of a conditional block.
We are looking for code like the following: BrBB: store i32 add, i32* arrayidx2 ... // No other stores or function calls (we could be calling a memory ... // function). cmp = icmp ult x, y br i1 cmp, label EndBB, label ThenBB ThenBB: store i32 add5, i32* arrayidx2 br label EndBB EndBB: ... We are going to transform this into: BrBB: store i32 add, i32* arrayidx2 ... // cmp = icmp ult x, y add.add5 = select i1 cmp, i32 add, add5 store i32 add.add5, i32* arrayidx2 ...
Returns
The pointer to the value of the previous store if the store can be hoisted into the predecessor block. 0 otherwise.
Definition at line 3079 of file SimplifyCFG.cpp.
References llvm::StoreInst::getAlign(), llvm::StoreInst::getPointerOperand(), llvm::Value::getType(), llvm::getUnderlyingObject(), llvm::StoreInst::getValueOperand(), I, llvm::BasicBlock::instructionsWithoutDebug(), llvm::isDereferenceablePointer(), llvm::StoreInst::isSimple(), llvm::isWritableObject(), llvm::PointerMayBeCaptured(), and llvm::reverse().
◆ isSwitchDense() [1/2]
static bool isSwitchDense ( ArrayRef< int64_t > Values) | static |
---|
◆ isSwitchDense() [2/2]
◆ isTypeLegalForLookupTable()
◆ isVectorOp()
◆ lookupConstant()
◆ mapCaseToResult()
static size_t mapCaseToResult ( ConstantInt * CaseVal, SwitchCaseResultVectorTy & UniqueResults, Constant * Result ) | static |
---|
◆ mergeCleanupPad()
◆ mergeCompatibleInvokes()
If this block is a landingpad
exception handling block, categorize all the predecessor invoke
s into sets, with all invoke
s in each set being "mergeable" together, and then merge invokes in each set together.
This is a weird mix of hoisting and sinking. Visually, it goes from: [...] [...] | | [invoke0] [invoke1] / \ / \ [cont0] [landingpad] [cont1] to: [...] [...] \ / [invoke] / \ [cont] [landingpad]
But of course we can only do that if the invokes share the landingpad
, edges invoke0->cont0 and invoke1->cont1 are "compatible", and the invoked functions are "compatible".
Definition at line 2996 of file SimplifyCFG.cpp.
References EnableMergeCompatibleInvokes, llvm::BasicBlock::isLandingPad(), mergeCompatibleInvokesImpl(), llvm::predecessors(), and llvm::ArrayRef< T >::size().
◆ mergeCompatibleInvokesImpl()
Definition at line 2844 of file SimplifyCFG.cpp.
References assert(), llvm::Instruction::clone(), llvm::BasicBlock::Create(), llvm::BasicBlock::end(), llvm::ArrayRef< T >::front(), llvm::Value::getContext(), llvm::Value::getName(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::BasicBlock::getParent(), II, llvm::Instruction::insertInto(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorImpl< T >::reserve(), llvm::InvokeInst::setNormalDest(), llvm::ArrayRef< T >::size(), and llvm::successors().
Referenced by mergeCompatibleInvokes().
◆ mergeConditionalStores()
Definition at line 4475 of file SimplifyCFG.cpp.
References Address, DL, llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::BasicBlock::getSinglePredecessor(), llvm::BasicBlock::getSingleSuccessor(), llvm::BranchInst::getSuccessor(), I, llvm::SmallPtrSetImpl< PtrType >::insert(), mergeConditionalStoreToAddress(), P, llvm::set_intersect(), and std::swap().
Referenced by SimplifyCondBranchToCondBranch().
◆ mergeConditionalStoreToAddress()
static bool mergeConditionalStoreToAddress ( BasicBlock * PTB, BasicBlock * PFB, BasicBlock * QTB, BasicBlock * QFB, BasicBlock * PostBB, Value * Address, bool InvertPCond, bool InvertQCond, DomTreeUpdater * DTU, const DataLayout & DL, const TargetTransformInfo & TTI ) | static |
---|
Definition at line 4327 of file SimplifyCFG.cpp.
References Address, assert(), llvm::IRBuilderBase::CreateNot(), llvm::IRBuilderBase::CreateOr(), llvm::IRBuilderBase::CreateStore(), ensureValueAvailableInSuccessor(), llvm::Instruction::eraseFromParent(), llvm::find(), findUniqueStoreInBlocks(), llvm::Instruction::getAAMetadata(), llvm::StoreInst::getAlign(), llvm::BasicBlock::getFirstInsertionPt(), llvm::IRBuilderBase::GetInsertPoint(), llvm::TargetTransformInfo::getInstructionCost(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::BasicBlock::getSinglePredecessor(), llvm::BasicBlock::getTerminator(), llvm::Value::getType(), llvm::StoreInst::getValueOperand(), I, llvm::BasicBlock::instructionsWithoutDebug(), llvm::StoreInst::isUnordered(), llvm::AAMDNodes::merge(), MergeCondStoresAggressively, PHINodeFoldingThreshold, llvm::pred_begin(), llvm::pred_end(), llvm::IRBuilderBase::SetCurrentDebugLocation(), llvm::IRBuilderBase::SetInsertPoint(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockPredecessors(), llvm::TargetTransformInfo::TCC_Basic, and llvm::TargetTransformInfo::TCK_SizeAndLatency.
Referenced by mergeConditionalStores().
◆ mergeNestedCondBranch()
Fold the following pattern: bb0: br i1 cond1, label bb1, label bb2 bb1: br i1 cond2, label bb3, label bb4 bb2: br i1 cond2, label bb4, label bb3 bb3: ... bb4: ... into bb0: cond = xor i1 cond1, cond2 br i1 cond, label bb4, label bb3 bb3: ... bb4: ... NOTE: cond2 always dominates the terminator of bb0.
Definition at line 7955 of file SimplifyCFG.cpp.
References llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::applyUpdates(), llvm::IRBuilderBase::CreateXor(), llvm::DominatorTreeBase< BasicBlock, false >::Delete, llvm::extractBranchWeights(), fitWeights(), llvm::BasicBlock::front(), llvm::BranchInst::getCondition(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::BranchInst::getSuccessor(), llvm::BasicBlock::getTerminator(), llvm::DominatorTreeBase< BasicBlock, false >::Insert, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::BasicBlock::removePredecessor(), setBranchWeights(), llvm::BranchInst::setCondition(), and llvm::BranchInst::setSuccessor().
◆ passingValueIsAlwaysUndefined()
Check if passing a value to an instruction will cause undefined behavior.
Definition at line 8168 of file SimplifyCFG.cpp.
References llvm::any_of(), llvm::CallingConv::C, llvm::find_if(), GEP, I, llvm::isGuaranteedToTransferExecutionToSuccessor(), llvm::PatternMatch::m_BinOp(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Value(), llvm::make_range(), llvm::PatternMatch::match(), llvm::NullPointerIsDefined(), and passingValueIsAlwaysUndefined().
Referenced by passingValueIsAlwaysUndefined(), removeUndefIntroducingPredecessor(), and validateAndCostRequiredSelects().
◆ performBranchToCommonDestFolding()
Definition at line 4010 of file SimplifyCFG.cpp.
References addPredecessorToBlock(), llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::applyUpdates(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::Instruction::cloneDebugInfoFrom(), cloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(), llvm::IRBuilderBase::CollectMetadataToCopy(), createLogicalOp(), llvm::dbgs(), llvm::SmallVectorTemplateCommon< T, typename >::end(), extractPredSuccWeights(), llvm::filterDbgVars(), fitWeights(), llvm::BranchInst::getCondition(), llvm::Instruction::getDbgRecordRange(), llvm::Instruction::getMetadata(), llvm::BasicBlock::getModule(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::BranchInst::getSuccessor(), llvm::BasicBlock::getTerminator(), llvm::InvertBranch(), llvm::BasicBlock::IsNewDbgInfoFormat, LLVM_DEBUG, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::RemapDbgRecord(), llvm::RF_IgnoreMissingLocals, llvm::RF_NoModuleLevelChanges, setBranchWeights(), llvm::BranchInst::setCondition(), llvm::Instruction::setMetadata(), llvm::BranchInst::setSuccessor(), and shouldFoldCondBranchesToCommonDestination().
Referenced by llvm::foldBranchToCommonDest().
◆ reduceSwitchRange()
Try to transform a switch that has "holes" in it to a contiguous sequence of cases.
A switch such as: switch(i) {case 5: case 9: case 13: case 17:} can be range-reduced to: switch ((i-5) / 4) {case 0: case 1: case 2: case 3:}.
This converts a sparse switch into a dense switch which allows better lowering and could also allow transforming into a lookup table.
Definition at line 7227 of file SimplifyCFG.cpp.
References assert(), llvm::sampleprof::Base, llvm::CallingConv::C, llvm::countr_zero(), llvm::IRBuilderBase::CreateIntrinsic(), llvm::IRBuilderBase::CreateSub(), DL, isSwitchDense(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::IRBuilderBase::SetInsertPoint(), and llvm::sort().
◆ removeEmptyCleanup()
Definition at line 5387 of file SimplifyCFG.cpp.
References llvm::PHINode::addIncoming(), llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::applyUpdates(), assert(), llvm::DeleteDeadBlock(), llvm::PoisonValue::get(), llvm::CleanupReturnInst::getCleanupPad(), llvm::BasicBlock::getFirstNonPHI(), llvm::PHINode::getIncomingValueForBlock(), llvm::ilist_node_with_parent< NodeTy, ParentTy, Options >::getNextNode(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::Value::getType(), llvm::CleanupReturnInst::getUnwindDest(), llvm::Value::hasOneUse(), Idx, isCleanupBlockEmpty(), llvm::Instruction::isUsedOutsideOfBlock(), llvm::make_early_inc_range(), llvm::Instruction::moveBefore(), llvm::BasicBlock::phis(), pred, llvm::predecessors(), llvm::BasicBlock::removePredecessor(), llvm::removeUnwindEdge(), llvm::User::replaceUsesOfWith(), and llvm::Value::use_empty().
◆ removeSwitchAfterSelectFold()
◆ removeUndefIntroducingPredecessor()
If BB has an incoming value that will always trigger undefined behavior (eg.
null pointer dereference), remove the branch leading here.
Definition at line 8310 of file SimplifyCFG.cpp.
References llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::applyUpdates(), Cond, llvm::BasicBlock::Create(), llvm::IRBuilderBase::CreateAssumption(), llvm::IRBuilderBase::CreateBr(), llvm::IRBuilderBase::CreateNot(), llvm::IRBuilderBase::CreateUnreachable(), llvm::DominatorTreeBase< BasicBlock, false >::Delete, llvm::Instruction::eraseFromParent(), llvm::BranchInst::getCondition(), llvm::BasicBlock::getContext(), llvm::BasicBlock::getParent(), llvm::BranchInst::getSuccessor(), llvm::BasicBlock::getTerminator(), llvm::DominatorTreeBase< BasicBlock, false >::Insert, llvm::BranchInst::isUnconditional(), passingValueIsAlwaysUndefined(), PHI, llvm::BasicBlock::phis(), llvm::AssumptionCache::registerAssumption(), llvm::BasicBlock::removePredecessor(), and llvm::IRBuilderBase::SetInsertPoint().
◆ replacingOperandWithVariableIsCheap()
◆ reuseTableCompare()
Try to reuse the switch table index compare.
Following pattern:
if (idx < tablesize)
r = table[idx];
else
r = default_value;
if (r != default_value)
...
Is optimized to:
cond = idx < tablesize;
if (cond)
r = table[idx];
else
r = default_value;
if (cond)
...
Jump threading will then eliminate the second if(cond).
Definition at line 6847 of file SimplifyCFG.cpp.
References llvm::ConstantFoldCompareInstOperands(), DL, llvm::BranchInst::getCondition(), llvm::BasicBlock::getDataLayout(), llvm::ConstantInt::getFalse(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::User::getOperand(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::CmpInst::getPredicate(), llvm::ConstantInt::getTrue(), llvm::Value::getType(), llvm::BasicBlock::getUniquePredecessor(), llvm::predecessors(), and llvm::Value::replaceAllUsesWith().
Referenced by switchToLookupTable().
◆ safeToMergeTerminators()
◆ setBranchWeights() [1/2]
◆ setBranchWeights() [2/2]
◆ shouldBuildLookupTable()
◆ shouldFoldCondBranchesToCommonDestination()
Determine if the two branches share a common destination and deduce a glue that joins the branches' conditions to arrive at the common destination if that would be profitable.
Definition at line 3971 of file SimplifyCFG.cpp.
References assert(), llvm::extractBranchWeights(), llvm::BranchProbability::getBranchProbability(), llvm::BranchProbability::getCompl(), llvm::Instruction::getMetadata(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::TargetTransformInfo::getPredictableBranchThreshold(), llvm::BranchInst::getSuccessor(), llvm::is_contained(), llvm::BranchInst::isConditional(), llvm::BranchProbability::isUnknown(), and llvm::predecessors().
Referenced by llvm::foldBranchToCommonDest(), and performBranchToCommonDestFolding().
◆ shouldHoistCommonInstructions()
◆ shouldUseSwitchConditionAsTableIndex()
◆ SimplifyCondBranchToCondBranch()
If we have a conditional branch as a predecessor of another block, this function tries to simplify it.
We know that PBI and BI are both conditional branches, and BI is in one of the successor blocks of PBI - PBI branches to BI.
Definition at line 4644 of file SimplifyCFG.cpp.
References addPredecessorToBlock(), llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::applyUpdates(), assert(), llvm::BasicBlock::begin(), Cond, llvm::BranchInst::Create(), llvm::BasicBlock::Create(), createLogicalOp(), llvm::IRBuilderBase::CreateNot(), llvm::IRBuilderBase::CreateSelect(), llvm::dbgs(), DL, llvm::extractBranchWeights(), extractPredSuccWeights(), fitWeights(), llvm::PHINode::getBasicBlockIndex(), llvm::BranchProbability::getBranchProbability(), llvm::BranchInst::getCondition(), llvm::BasicBlock::getContext(), llvm::PHINode::getIncomingValue(), llvm::PHINode::getIncomingValueForBlock(), llvm::Type::getInt1Ty(), llvm::Instruction::getMetadata(), llvm::Value::getName(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::BasicBlock::getParent(), llvm::TargetTransformInfo::getPredictableBranchThreshold(), llvm::BasicBlock::getSinglePredecessor(), llvm::BranchInst::getSuccessor(), II, llvm::BasicBlock::instructionsWithoutDebug(), llvm::BranchInst::isConditional(), LLVM_DEBUG, mergeConditionalStores(), MergeCondStores, llvm::BasicBlock::phis(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), setBranchWeights(), llvm::BranchInst::setCondition(), llvm::PHINode::setIncomingValue(), llvm::BranchInst::setSuccessor(), and tryWidenCondBranchToCondBranch().
◆ simplifySwitchOfCmpIntrinsic()
Fold switch over ucmp/scmp intrinsic to br if two of the switch arms have the same destination.
Definition at line 7382 of file SimplifyCFG.cpp.
References llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::applyUpdates(), assert(), llvm::MDBuilder::createBranchWeights(), llvm::IRBuilderBase::CreateCondBr(), llvm::IRBuilderBase::CreateICmp(), llvm::extractBranchWeights(), llvm::getBranchWeightMDNode(), llvm::ICmpInst::getSignedPredicate(), OtherSucc(), llvm::BasicBlock::removePredecessor(), llvm::SmallVectorImpl< T >::resize(), llvm::IRBuilderBase::SetInsertPoint(), std::swap(), and llvm::APInt::trySExtValue().
◆ simplifySwitchOfPowersOfTwo()
Tries to transform switch of powers of two to reduce switch range.
For example, switch like: switch (C) { case 1: case 2: case 64: case 128: } will be transformed to: switch (count_trailing_zeros(C)) { case 0: case 1: case 6: case 7: }
This transformation allows better lowering and could allow transforming into a lookup table.
Definition at line 7314 of file SimplifyCFG.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::countr_zero(), llvm::IRBuilderBase::CreateIntrinsic(), DL, llvm::SmallVectorTemplateCommon< T, typename >::front(), llvm::TargetTransformInfo::getIntrinsicInstrCost(), llvm::ConstantInt::getTrue(), llvm::Value::getType(), llvm::has_single_bit(), isSwitchDense(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::IRBuilderBase::SetInsertPoint(), llvm::SmallVectorBase< Size_T >::size(), llvm::sort(), llvm::TargetTransformInfo::TCC_Basic, and llvm::TargetTransformInfo::TCK_SizeAndLatency.
◆ sinkCommonCodeFromPredecessors()
Check whether BB's predecessors end with unconditional branches.
If it is true, sink any common code from the predecessors to BB.
Definition at line 2442 of file SimplifyCFG.cpp.
References llvm::all_of(), llvm::any_of(), assert(), canSinkInstructions(), llvm::dbgs(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::SmallPtrSetImpl< PtrType >::erase(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::LoadInst::getPointerOperandIndex(), llvm::StoreInst::getPointerOperandIndex(), I, Idx, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::IsBlockFollowedByDeoptOrUnreachable(), llvm::isSafeToSpeculativelyExecute(), LLVM_DEBUG, llvm::BasicBlock::phis(), llvm::predecessors(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), sinkLastInstruction(), llvm::SmallVectorBase< Size_T >::size(), and llvm::SplitBlockPredecessors().
◆ sinkLastInstruction()
Definition at line 2345 of file SimplifyCFG.cpp.
References llvm::Instruction::andIRFlags(), llvm::any_of(), llvm::Instruction::applyMergedLocation(), assert(), Blocks, llvm::combineMetadataForCSE(), llvm::PHINode::Create(), llvm::SmallVectorTemplateCommon< T, typename >::front(), llvm::BasicBlock::front(), llvm::Instruction::getDebugLoc(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::User::getOperandUse(), llvm::BasicBlock::getTerminator(), I, llvm::make_early_inc_range(), llvm::Instruction::moveBefore(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::Use::set(), llvm::SmallVectorBase< Size_T >::size(), Success, and llvm::Value::users().
Referenced by sinkCommonCodeFromPredecessors().
◆ skippedInstrFlags()
◆ STATISTIC() [1/15]
STATISTIC | ( | NumBitMaps | , |
---|---|---|---|
"Number of switch instructions turned into bitmaps" | |||
) |
◆ STATISTIC() [2/15]
STATISTIC | ( | NumFoldBranchToCommonDest | , |
---|---|---|---|
"Number of branches folded into predecessor basic block" | |||
) |
◆ STATISTIC() [3/15]
STATISTIC | ( | NumFoldValueComparisonIntoPredecessors | , |
---|---|---|---|
"Number of value comparisons folded into predecessor basic blocks" | |||
) |
◆ STATISTIC() [4/15]
STATISTIC | ( | NumHoistCommonCode | , |
---|---|---|---|
"Number of common instruction 'blocks' hoisted up to the begin block" | |||
) |
◆ STATISTIC() [5/15]
STATISTIC | ( | NumHoistCommonInstrs | , |
---|---|---|---|
"Number of common instructions hoisted up to the begin block" | |||
) |
◆ STATISTIC() [6/15]
STATISTIC | ( | NumInvokes | , |
---|---|---|---|
"Number of invokes with empty resume blocks simplified into calls" | |||
) |
◆ STATISTIC() [7/15]
STATISTIC | ( | NumInvokeSetsFormed | , |
---|---|---|---|
"Number of invoke sets that were formed" | |||
) |
◆ STATISTIC() [8/15]
STATISTIC | ( | NumInvokesMerged | , |
---|---|---|---|
"Number of invokes that were merged together" | |||
) |
◆ STATISTIC() [9/15]
STATISTIC | ( | NumLinearMaps | , |
---|---|---|---|
"Number of switch instructions turned into linear mapping" | |||
) |
◆ STATISTIC() [10/15]
◆ STATISTIC() [11/15]
STATISTIC | ( | NumLookupTablesHoles | , |
---|---|---|---|
"Number of switch instructions turned into lookup tables (holes checked)" | |||
) |
◆ STATISTIC() [12/15]
STATISTIC | ( | NumSinkCommonCode | , |
---|---|---|---|
"Number of common instruction 'blocks' sunk down to the end block" | |||
) |
◆ STATISTIC() [13/15]
STATISTIC | ( | NumSinkCommonInstrs | , |
---|---|---|---|
"Number of common instructions sunk down to the end block" | |||
) |
◆ STATISTIC() [14/15]
STATISTIC | ( | NumSpeculations | , |
---|---|---|---|
"Number of speculative executed instructions" | |||
) |
◆ STATISTIC() [15/15]
STATISTIC | ( | NumTableCmpReuses | , |
---|---|---|---|
"Number of reused switch table lookup compares" | |||
) |
◆ switchToLookupTable()
If the switch is only used to initialize one or more phi nodes in a common successor block with different constant values, replace the switch with lookup tables.
Definition at line 6912 of file SimplifyCFG.cpp.
References addPredecessorToBlock(), llvm::all_of(), llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::applyUpdates(), assert(), llvm::computeConstantRange(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count(), llvm::BasicBlock::Create(), llvm::IRBuilderBase::CreateBr(), llvm::IRBuilderBase::CreateCondBr(), llvm::IRBuilderBase::CreateICmpULT(), llvm::IRBuilderBase::CreateLShr(), llvm::IRBuilderBase::CreateSub(), llvm::IRBuilderBase::CreateTrunc(), llvm::IRBuilderBase::CreateZExtOrTrunc(), DL, llvm::PoisonValue::get(), getCaseResults(), llvm::Function::getFnAttribute(), llvm::Type::getInt1Ty(), llvm::ConstantInt::getIntegerType(), llvm::APInt::getLimitedValue(), llvm::ConstantInt::getLimitedValue(), llvm::Value::getName(), llvm::GlobalValue::getParent(), llvm::BasicBlock::getParent(), llvm::Type::getPrimitiveSizeInBits(), llvm::Value::getType(), llvm::ConstantRange::getUpper(), llvm::ConstantInt::getValue(), llvm::Attribute::getValueAsBool(), I, Idx, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::ConstantRange::isUpperWrapped(), Mod, llvm::NextPowerOf2(), PHI, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::BasicBlock::removePredecessor(), Results, reuseTableCompare(), llvm::IRBuilderBase::SetInsertPoint(), llvm::Value::setName(), llvm::APInt::sgt(), shouldBuildLookupTable(), llvm::TargetTransformInfo::shouldBuildLookupTables(), shouldUseSwitchConditionAsTableIndex(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::size(), llvm::APInt::slt(), llvm::APInt::ssub_ov(), and UINT64_MAX.
◆ trySwitchToSelect()
◆ tryToMergeLandingPad()
Given an block with only a single landing pad and a unconditional branch try to find another basic block which this one can be merged with.
This handles cases where we have multiple invokes with unique landing pads, but a shared handler.
We specifically choose to not worry about merging non-empty blocks here. That is a PRE/scheduling problem and is best solved elsewhere. In practice, the optimizer produces empty landing pad blocks quite frequently when dealing with exception dense code. (see: instcombine, gvn, if-else sinking in this file)
This is primarily a code size optimization. We need to avoid performing any transform which might inhibit optimization (such as our ability to specialize a particular handler via tail commoning). We do this by not merging any blocks which require us to introduce a phi. Since the same values are flowing through both blocks, we don't lose any ability to specialize. If anything, we make such specialization more likely.
TODO - This transformation could remove entries from a phi in the target block when the inputs in the phi are the same for the two blocks being merged. In some cases, this could result in removal of the PHI entirely.
Definition at line 7806 of file SimplifyCFG.cpp.
References llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::applyUpdates(), assert(), llvm::BasicBlock::begin(), llvm::IRBuilderBase::CreateUnreachable(), llvm::DominatorTreeBase< BasicBlock, false >::Delete, llvm::Instruction::eraseFromParent(), llvm::BasicBlock::getTerminator(), llvm::BasicBlock::getUniqueSuccessor(), I, II, llvm::DominatorTreeBase< BasicBlock, false >::Insert, llvm::Instruction::isIdenticalTo(), llvm::make_early_inc_range(), llvm::pred_begin(), llvm::pred_end(), llvm::predecessors(), llvm::BasicBlock::removePredecessor(), llvm::succ_begin(), and llvm::succ_end().
◆ tryWidenCondBranchToCondBranch()
If the previous block ended with a widenable branch, determine if reusing the target block is profitable and legal.
This will have the effect of "widening" PBI, but doesn't require us to reason about hosting safety.
Definition at line 4587 of file SimplifyCFG.cpp.
References llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::applyUpdates(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::BranchInst::getSuccessor(), llvm::BasicBlock::getTerminatingDeoptimizeCall(), I, llvm::isWidenableBranch(), llvm::none_of(), llvm::BasicBlock::phis(), llvm::BasicBlock::removePredecessor(), llvm::BranchInst::setSuccessor(), and llvm::succ_empty().
Referenced by SimplifyCondBranchToCondBranch().
◆ validateAndCostRequiredSelects()
Estimate the cost of the insertion(s) and check that the PHI nodes can be converted to selects.
Definition at line 3141 of file SimplifyCFG.cpp.
References llvm::CmpInst::BAD_ICMP_PREDICATE, computeSpeculationCost(), CostKind, llvm::TargetTransformInfo::getCmpSelInstrCost(), llvm::PHINode::getIncomingValueForBlock(), llvm::BasicBlock::getParent(), llvm::Value::getType(), llvm::Function::hasMinSize(), passingValueIsAlwaysUndefined(), PHINodeFoldingThreshold, llvm::BasicBlock::phis(), llvm::TargetTransformInfo::TCC_Basic, llvm::TargetTransformInfo::TCK_CodeSize, and llvm::TargetTransformInfo::TCK_SizeAndLatency.
◆ validLookupTableConstant()
◆ valuesOverlap()
static bool valuesOverlap ( std::vector< ValueEqualityComparisonCase > & C1, std::vector< ValueEqualityComparisonCase > & C2 ) | static |
---|
◆ BranchFoldThreshold
cl::opt< unsigned > BranchFoldThreshold("simplifycfg-branch-fold-threshold", cl::Hidden, cl::init(2), cl::desc("Maximum cost of combining conditions when " "folding branches")) ( "simplifycfg-branch-fold-threshold" , cl::Hidden , cl::init(2) , cl::desc("Maximum cost of combining conditions when " "folding branches") ) | static |
---|
◆ BranchFoldToCommonDestVectorMultiplier
cl::opt< unsigned > BranchFoldToCommonDestVectorMultiplier("simplifycfg-branch-fold-common-dest-vector-multiplier", cl::Hidden, cl::init(2), cl::desc("Multiplier to apply to threshold when determining whether or not " "to fold branch to common destination when vector operations are " "present")) ( "simplifycfg-branch-fold-common-dest-vector-multiplier" , cl::Hidden , cl::init(2) , cl::desc("Multiplier to apply to threshold when determining whether or not " "to fold branch to common destination when vector operations are " "present") ) | static |
---|
◆ EnableMergeCompatibleInvokes
cl::opt< bool > EnableMergeCompatibleInvokes("simplifycfg-merge-compatible-invokes", cl::Hidden, cl::init(true), cl::desc("Allow SimplifyCFG to merge invokes together when appropriate")) ( "simplifycfg-merge-compatible-invokes" , cl::Hidden , cl::init(true) , cl::desc("Allow SimplifyCFG to merge invokes together when appropriate") ) | static |
---|
◆ HoistCommon
◆ HoistCommonSkipLimit
◆ HoistCondStores
cl::opt< bool > HoistCondStores("simplifycfg-hoist-cond-stores", cl::Hidden, cl::init(true), cl::desc("Hoist conditional stores if an unconditional store precedes")) ( "simplifycfg-hoist-cond-stores" , cl::Hidden , cl::init(true) , cl::desc("Hoist conditional stores if an unconditional store precedes") ) | static |
---|
◆ HoistLoadsStoresWithCondFaulting
◆ HoistLoadsStoresWithCondFaultingThreshold
cl::opt< unsigned > HoistLoadsStoresWithCondFaultingThreshold("hoist-loads-stores-with-cond-faulting-threshold", cl::Hidden, cl::init(6), cl::desc("Control the maximal conditional load/store that we are willing " "to speculatively execute to eliminate conditional branch " "(default = 6)")) ( "hoist-loads-stores-with-cond-faulting-threshold" , cl::Hidden , cl::init(6) , cl::desc("Control the maximal conditional load/store that we are willing " "to speculatively execute to eliminate conditional branch " "(default = 6)") ) | static |
---|
◆ MaxSmallBlockSize
cl::opt< int > MaxSmallBlockSize("simplifycfg-max-small-block-size", cl::Hidden, cl::init(10), cl::desc("Max size of a block which is still considered " "small enough to thread through")) ( "simplifycfg-max-small-block-size" , cl::Hidden , cl::init(10) , cl::desc("Max size of a block which is still considered " "small enough to thread through") ) | static |
---|
◆ MaxSpeculationDepth
cl::opt< unsigned > MaxSpeculationDepth("max-speculation-depth", cl::Hidden, cl::init(10), cl::desc("Limit maximum recursion depth when calculating costs of " "speculatively executed instructions")) ( "max-speculation-depth" , cl::Hidden , cl::init(10) , cl::desc("Limit maximum recursion depth when calculating costs of " "speculatively executed instructions") ) | static |
---|
◆ MaxSwitchCasesPerResult
cl::opt< unsigned > MaxSwitchCasesPerResult("max-switch-cases-per-result", cl::Hidden, cl::init(16), cl::desc("Limit cases to analyze when converting a switch to select")) ( "max-switch-cases-per-result" , cl::Hidden , cl::init(16) , cl::desc("Limit cases to analyze when converting a switch to select") ) | static |
---|
◆ MergeCondStores
cl::opt< bool > MergeCondStores("simplifycfg-merge-cond-stores", cl::Hidden, cl::init(true), cl::desc("Hoist conditional stores even if an unconditional store does not " "precede - hoist multiple conditional stores into a single " "predicated store")) ( "simplifycfg-merge-cond-stores" , cl::Hidden , cl::init(true) , cl::desc("Hoist conditional stores even if an unconditional store does not " "precede - hoist multiple conditional stores into a single " "predicated store") ) | static |
---|
◆ MergeCondStoresAggressively
cl::opt< bool > MergeCondStoresAggressively("simplifycfg-merge-cond-stores-aggressively", cl::Hidden, cl::init(false), cl::desc("When merging conditional stores, do so even if the resultant " "basic blocks are unlikely to be if-converted as a result")) ( "simplifycfg-merge-cond-stores-aggressively" , cl::Hidden , cl::init(false) , cl::desc("When merging conditional stores, do so even if the resultant " "basic blocks are unlikely to be if-converted as a result") ) | static |
---|
◆ PHINodeFoldingThreshold
cl::opt< unsigned > PHINodeFoldingThreshold("phi-node-folding-threshold", cl::Hidden, cl::init(2), cl::desc( "Control the amount of phi node folding to perform (default = 2)")) ( "phi-node-folding-threshold" , cl::Hidden , cl::init(2) , cl::desc( "Control the amount of phi node folding to perform (default = 2)") ) | static |
---|
◆ SinkCommon
◆ SpeculateOneExpensiveInst
cl::opt< bool > SpeculateOneExpensiveInst("speculate-one-expensive-inst", cl::Hidden, cl::init(true), cl::desc("Allow exactly one expensive instruction to be speculatively " "executed")) ( "speculate-one-expensive-inst" , cl::Hidden , cl::init(true) , cl::desc("Allow exactly one expensive instruction to be speculatively " "executed") ) | static |
---|
◆ TwoEntryPHINodeFoldingThreshold
cl::opt< unsigned > TwoEntryPHINodeFoldingThreshold("two-entry-phi-node-folding-threshold", cl::Hidden, cl::init(4), cl::desc("Control the maximal total instruction cost that we are willing " "to speculatively execute to fold a 2-entry PHI node into a " "select (default = 4)")) ( "two-entry-phi-node-folding-threshold" , cl::Hidden , cl::init(4) , cl::desc("Control the maximal total instruction cost that we are willing " "to speculatively execute to fold a 2-entry PHI node into a " "select (default = 4)") ) | static |
---|