LLVM 24.0.0git
VPlanUtils.cpp File Reference

Go to the source code of this file.

Functions

static bool poisonGuaranteesUB (const VPValue *V)
 Returns true if V being poison is guaranteed to trigger UB because it propagates to the address of a memory recipe.
static bool preservesUniformity (unsigned Opcode)
 Returns true if Opcode preserves uniformity, i.e., if all operands are uniform, the result will also be uniform.
static BranchProbability getBranchProbabilityKeepingPartial (uint64_t Num, uint64_t Denom)
 Returns Num / Denom as a BranchProbability, clamped so a ratio that is neither zero nor one does not round to zero or one.
static SmallVector< std::pair< const VPBasicBlock *, BranchProbability >, 2 > getSuccessorProbabilities (const VPBasicBlock *VPBB)
 Returns the probability of reaching each unique successor of VPBB, taken from the branch weights recorded on its terminator, or unknown if not available.
static BlockFrequency scaleKeepingNonZero (BlockFrequency Freq, BranchProbability Prob)
 Returns Freq scaled by Prob, rounding up to 1 instead of 0 to keep a rarely executed block distinguishable from an unreachable one.

Function Documentation

◆ getBranchProbabilityKeepingPartial()

BranchProbability getBranchProbabilityKeepingPartial ( uint64_t Num,
uint64_t Denom )
static

Returns Num / Denom as a BranchProbability, clamped so a ratio that is neither zero nor one does not round to zero or one.

BlockFrequencyInfo also keeps a zero-weight edge distinguishable from an unreachable one.

Definition at line 1165 of file VPlanUtils.cpp.

References llvm::BranchProbability::getBranchProbability(), llvm::BranchProbability::getDenominator(), llvm::BranchProbability::getRaw(), P, and uint64_t.

Referenced by llvm::vputils::getExecutionProbability(), and getSuccessorProbabilities().

◆ getSuccessorProbabilities()

◆ poisonGuaranteesUB()

◆ preservesUniformity()

bool preservesUniformity ( unsigned Opcode)
static

Returns true if Opcode preserves uniformity, i.e., if all operands are uniform, the result will also be uniform.

Definition at line 407 of file VPlanUtils.cpp.

References llvm::VPInstruction::Broadcast, llvm::Instruction::isBinaryOp(), llvm::Instruction::isCast(), llvm::VPInstruction::MaskedCond, llvm::VPInstruction::Not, and llvm::VPInstruction::PtrAdd.

Referenced by llvm::vputils::isSingleScalar(), and llvm::vputils::isUniformAcrossVFsAndUFs().

◆ scaleKeepingNonZero()

BlockFrequency scaleKeepingNonZero ( BlockFrequency Freq,
BranchProbability Prob )
static

Returns Freq scaled by Prob, rounding up to 1 instead of 0 to keep a rarely executed block distinguishable from an unreachable one.

Definition at line 1218 of file VPlanUtils.cpp.

References llvm::BranchProbability::isZero(), and Scaled.

Referenced by llvm::vputils::computeExecutionFrequencies().