14 #ifndef LLVM_ANALYSIS_BRANCHPROBABILITYINFO_H 15 #define LLVM_ANALYSIS_BRANCHPROBABILITYINFO_H 38 class TargetLibraryInfo;
63 : Probs(
std::move(
Arg.Probs)), LastF(
Arg.LastF),
64 PostDominatedByUnreachable(
std::move(
Arg.PostDominatedByUnreachable)),
65 PostDominatedByColdCall(
std::move(
Arg.PostDominatedByColdCall)) {}
72 Probs = std::move(RHS.Probs);
73 PostDominatedByColdCall = std::move(RHS.PostDominatedByColdCall);
74 PostDominatedByUnreachable = std::move(RHS.PostDominatedByUnreachable);
89 unsigned IndexInSuccessors)
const;
131 return IsLikely ? LikelyProb : LikelyProb.
getCompl();
152 class BasicBlockCallbackVH final :
public CallbackVH {
155 void deleted()
override {
157 BPI->eraseBlock(cast<BasicBlock>(getValPtr()));
158 BPI->Handles.erase(*
this);
163 :
CallbackVH(const_cast<Value *>(V)), BPI(BPI) {}
170 using Edge = std::pair<const BasicBlock *, unsigned>;
178 static const uint32_t DEFAULT_WEIGHT = 16;
191 void updatePostDominatedByUnreachable(
const BasicBlock *BB);
192 void updatePostDominatedByColdCall(
const BasicBlock *BB);
193 bool calcUnreachableHeuristics(
const BasicBlock *BB);
194 bool calcMetadataWeights(
const BasicBlock *BB);
195 bool calcColdCallHeuristics(
const BasicBlock *BB);
196 bool calcPointerHeuristics(
const BasicBlock *BB);
200 bool calcFloatingPointHeuristics(
const BasicBlock *BB);
201 bool calcInvokeHeuristics(
const BasicBlock *BB);
253 #endif // LLVM_ANALYSIS_BRANCHPROBABILITYINFO_H BranchProbabilityInfo & operator=(BranchProbabilityInfo &&RHS)
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
BranchProbability getCompl() const
This class represents lattice values for constants.
BranchProbabilityInfo(const Function &F, const LoopInfo &LI, const TargetLibraryInfo *TLI=nullptr)
A Module instance is used to store all the information related to an LLVM module. ...
BranchProbabilityPrinterPass(raw_ostream &OS)
void calculate(const Function &F, const LoopInfo &LI, const TargetLibraryInfo *TLI=nullptr)
Implements a dense probed hash-table based set.
const BasicBlock * getHotSucc(const BasicBlock *BB) const
Retrieve the hot successor of a block if one exists.
std::vector< SccHeaderMap > SccHeaderMaps
Analysis pass which computes BranchProbabilityInfo.
BranchProbabilityInfo(BranchProbabilityInfo &&Arg)
const BranchProbabilityInfo & getBPI() const
A CRTP mix-in to automatically provide informational APIs needed for passes.
Legacy analysis pass which computes BranchProbabilityInfo.
static bool runOnFunction(Function &F, bool PostInlining)
Printer pass for the BranchProbabilityAnalysis results.
void initializeBranchProbabilityInfoWrapperPassPass(PassRegistry &)
A set of analyses that are preserved following a run of a transformation pass.
LLVM Basic Block Representation.
A CRTP mix-in that provides informational APIs needed for analysis passes.
void eraseBlock(const BasicBlock *BB)
Forget analysis results for the given basic block.
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
BranchProbabilityInfo()=default
BranchProbability getEdgeProbability(const BasicBlock *Src, unsigned IndexInSuccessors) const
Get an edge's probability, relative to other out-edges of the Src.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
BranchProbabilityInfoWrapperPass()
Provides information about what library functions are available for the current target.
void setEdgeProbability(const BasicBlock *Src, unsigned IndexInSuccessors, BranchProbability Prob)
Set the raw edge probability for the given edge.
void print(raw_ostream &OS) const
amdgpu Simplify well known AMD library false Value Value * Arg
This file provides various utilities for inspecting and working with the control flow graph in LLVM I...
Analysis providing branch probability information.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
bool isEdgeHot(const BasicBlock *Src, const BasicBlock *Dst) const
Test if an edge is hot relative to other out-edges of the Src.
raw_ostream & printEdgeProbability(raw_ostream &OS, const BasicBlock *Src, const BasicBlock *Dst) const
Print an edge's probability.
BranchProbabilityInfo & operator=(const BranchProbabilityInfo &)=delete
This class implements an extremely fast bulk output stream that can only output to a stream...
Value handle with callbacks on RAUW and destruction.
A container for analyses that lazily runs them and caches their results.
This header defines various interfaces for pass management in LLVM.
BranchProbabilityInfo & getBPI()
A special type used by analysis passes to provide an address that identifies that particular analysis...
static BranchProbability getBranchProbStackProtector(bool IsLikely)