Return the probability that conditional branch B takes one successor.
Declared in <llvm/Transforms/Utils/LoopUtils.h>
BranchProbability
getBranchProbability(
CondBrInst* B,
bool ForFirstTarget);
Based on branch weight metadata, return either:
An unknown probability if the implementation cannot extract the probability (e.g., B must have exactly two target labels, so it must be a conditional branch).
The probability P that control flows from B to its first target label such that 1 - P is the probability of control flowing to its second target label, or vice-versa if ForFirstTarget is false.
The selected successor probability, or unknown if unsupported.
| Name | Description |
|---|---|
| B | Conditional branch with exactly two successors. |
| ForFirstTarget | If true, return the probability of the first successor; otherwise the second. |