14 #ifndef LLVM_TRANSFORMS_SCALAR_JUMPTHREADING_H
15 #define LLVM_TRANSFORMS_SCALAR_JUMPTHREADING_H
33 namespace jumpthreading {
62 std::unique_ptr<BlockFrequencyInfo> BFI;
63 std::unique_ptr<BranchProbabilityInfo> BPI;
64 bool HasProfileData =
false;
72 unsigned BBDupThreshold;
75 struct RecursionSetRemover {
77 std::pair<Value *, BasicBlock *> ThePair;
79 RecursionSetRemover(
DenseSet<std::pair<Value *, BasicBlock *>> &S,
80 std::pair<Value *, BasicBlock *>
P)
81 : TheSet(S), ThePair(P) {}
83 ~RecursionSetRemover() { TheSet.erase(ThePair); }
91 bool HasProfileData_, std::unique_ptr<BlockFrequencyInfo> BFI_,
92 std::unique_ptr<BranchProbabilityInfo> BPI_);
131 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 in the same BB of the form bb: p = phi [false...
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.
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...
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.
bool runImpl(Function &F, TargetLibraryInfo *TLI_, LazyValueInfo *LVI_, bool HasProfileData_, std::unique_ptr< BlockFrequencyInfo > BFI_, std::unique_ptr< BranchProbabilityInfo > BPI_)
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)
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.
bool TryToUnfoldSelect(CmpInst *CondCmp, BasicBlock *BB)
TryToUnfoldSelect - Look for blocks of the form bb1: a = select br bb.