llvm::getBranchProbability

Return the edge probability from Src to successor Dst.

Synopsis

Declared in <llvm/Transforms/Utils/LoopUtils.h>

BranchProbability
getBranchProbability(
    BasicBlock* Src,
    BasicBlock* Dst);

Description

Calculates the edge probability from Src to Dst. Dst has to be a successor to Src. This uses branch_weights metadata directly. If data are missing or probability cannot be computed, then unknown probability is returned. This does not use BranchProbabilityInfo and the values computed by this will vary from BPI because BPI has its own more advanced heuristics to determine probabilities even without branch_weights metadata.

Return Value

The edge probability from Src to Dst, or unknown if unavailable.

Parameters

NameDescription
SrcSource basic block of the CFG edge.
DstSuccessor basic block of the CFG edge.