14 #ifndef LLVM_TRANSFORMS_SCALAR_JUMPTHREADING_H
15 #define LLVM_TRANSFORMS_SCALAR_JUMPTHREADING_H
35 namespace jumpthreading {
65 std::unique_ptr<BlockFrequencyInfo> BFI;
66 std::unique_ptr<BranchProbabilityInfo> BPI;
67 bool HasProfileData =
false;
68 bool HasGuards =
false;
76 unsigned BBDupThreshold;
79 struct RecursionSetRemover {
81 std::pair<Value *, BasicBlock *> ThePair;
83 RecursionSetRemover(
DenseSet<std::pair<Value *, BasicBlock *>> &S,
84 std::pair<Value *, BasicBlock *>
P)
85 : TheSet(S), ThePair(P) {}
87 ~RecursionSetRemover() { TheSet.erase(ThePair); }
96 std::unique_ptr<BlockFrequencyInfo> BFI_,
97 std::unique_ptr<BranchProbabilityInfo> BPI_);
139 bool doesBlockHaveProfileData(
BasicBlock *BB);
This class is the base class for the comparison instructions.
bool ThreadEdge(BasicBlock *BB, const SmallVectorImpl< BasicBlock * > &PredBBs, BasicBlock *SuccBB)
ThreadEdge - We have decided that it is safe and profitable to factor the blocks in PredBBs to one pr...
Implements a dense probed hash-table based set.
An instruction for reading from memory.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
bool TryToUnfoldSelectInCurrBB(BasicBlock *BB)
TryToUnfoldSelectInCurrBB - Look for PHI/Select or PHI/CMP/Select in the same BB in the form bb: p = ...
A CRTP mix-in to automatically provide informational APIs needed for passes.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
A set of analyses that are preserved following a run of a transformation pass.
LLVM Basic Block Representation.
Conditional or Unconditional Branch instruction.
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
bool DuplicateCondBranchOnPHIIntoPred(BasicBlock *BB, const SmallVectorImpl< BasicBlock * > &PredBBs)
DuplicateCondBranchOnPHIIntoPred - PredBB contains an unconditional branch to BB which contains an i1...
bool runImpl(Function &F, TargetLibraryInfo *TLI_, LazyValueInfo *LVI_, AliasAnalysis *AA_, bool HasProfileData_, std::unique_ptr< BlockFrequencyInfo > BFI_, std::unique_ptr< BranchProbabilityInfo > BPI_)
JumpThreadingPass(int T=-1)
void FindLoopHeaders(Function &F)
FindLoopHeaders - We do not want jump threading to turn proper loop structures into irreducible loops...
SmallVectorImpl< std::pair< Constant *, BasicBlock * > > PredValueInfo
bool ProcessBranchOnPHI(PHINode *PN)
ProcessBranchOnPHI - We have an otherwise unthreadable conditional branch on a PHI node in the curren...
bool ComputeValueKnownInPredecessors(Value *V, BasicBlock *BB, jumpthreading::PredValueInfo &Result, jumpthreading::ConstantPreference Preference, Instruction *CxtI=nullptr)
ComputeValueKnownInPredecessors - Given a basic block BB and a value V, see if we can infer that the ...
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Provides information about what library functions are available for the current target.
This pass performs 'jump threading', which looks at blocks that have multiple predecessors and multip...
bool SimplifyPartiallyRedundantLoad(LoadInst *LI)
SimplifyPartiallyRedundantLoad - If LI is an obviously partially redundant load instruction, eliminate it by replacing it with a PHI node.
bool ProcessBranchOnXOR(BinaryOperator *BO)
ProcessBranchOnXOR - We have an otherwise unthreadable conditional branch on a xor instruction in the...
bool ProcessImpliedCondition(BasicBlock *BB)
SmallVector< std::pair< Constant *, BasicBlock * >, 8 > PredValueInfoTy
bool ProcessThreadableEdges(Value *Cond, BasicBlock *BB, jumpthreading::ConstantPreference Preference, Instruction *CxtI=nullptr)
This pass computes, caches, and vends lazy value constraint information.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
bool ThreadGuard(BasicBlock *BB, IntrinsicInst *Guard, BranchInst *BI)
Try to propagate the guard from BB which is the lower block of a diamond to one of its branches...
bool ProcessGuards(BasicBlock *BB)
Try to propagate a guard from the current BB into one of its predecessors in case if another branch o...
LLVM Value Representation.
bool ProcessBlock(BasicBlock *BB)
ProcessBlock - If there are any predecessors whose control can be threaded through to a successor...
A container for analyses that lazily runs them and caches their results.
A wrapper class for inspecting calls to intrinsic functions.
bool TryToUnfoldSelect(CmpInst *CondCmp, BasicBlock *BB)
TryToUnfoldSelect - Look for blocks of the form bb1: a = select br bb2.