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 std::optional< SmallVector< BranchProbability > > getSuccessorProbabilities (const VPBasicBlock *VPBB)
 Returns the probability of each successor edge of VPBB, computed via BranchProbabilityInfo::getEdgeProbabilitiesFromWeights from the branch weights recorded on its terminator, or std::nullopt if not available.

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 1205 of file VPlanUtils.cpp.

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

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

◆ 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 424 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().