LLVM 22.0.0git
ProfDataUtils.cpp File Reference

Go to the source code of this file.

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.

Functions

LLVM_ABI bool llvm::hasProfMD (const Instruction &I)
 Checks if an Instruction has MD_prof Metadata.
LLVM_ABI bool llvm::isBranchWeightMD (const MDNode *ProfileData)
 Checks if an MDNode contains Branch Weight Metadata.
LLVM_ABI bool llvm::isValueProfileMD (const MDNode *ProfileData)
 Checks if an MDNode contains value profiling Metadata.
LLVM_ABI bool llvm::hasBranchWeightMD (const Instruction &I)
 Checks if an instructions has Branch Weight Metadata.
static bool llvm::hasCountTypeMD (const Instruction &I)
LLVM_ABI bool llvm::hasValidBranchWeightMD (const Instruction &I)
 Checks if an instructions has valid Branch Weight Metadata.
LLVM_ABI bool llvm::hasBranchWeightOrigin (const Instruction &I)
 Check if Branch Weight Metadata has an "expected" field from an llvm.expect* intrinsic.
LLVM_ABI bool llvm::hasBranchWeightOrigin (const MDNode *ProfileData)
 Check if Branch Weight Metadata has an "expected" field from an llvm.expect* intrinsic.
LLVM_ABI unsigned llvm::getBranchWeightOffset (const MDNode *ProfileData)
 Return the offset to the first branch weight data.
LLVM_ABI unsigned llvm::getNumBranchWeights (const MDNode &ProfileData)
LLVM_ABI MDNodellvm::getBranchWeightMDNode (const Instruction &I)
 Get the branch weights metadata node.
LLVM_ABI MDNodellvm::getValidBranchWeightMDNode (const Instruction &I)
 Get the valid branch weights metadata node.
LLVM_ABI void llvm::extractFromBranchWeightMD32 (const MDNode *ProfileData, SmallVectorImpl< uint32_t > &Weights)
 Faster version of extractBranchWeights() that skips checks and must only be called with "branch_weights" metadata nodes.
LLVM_ABI void llvm::extractFromBranchWeightMD64 (const MDNode *ProfileData, SmallVectorImpl< uint64_t > &Weights)
 Faster version of extractBranchWeights() that skips checks and must only be called with "branch_weights" metadata nodes.
LLVM_ABI bool llvm::extractBranchWeights (const MDNode *ProfileData, SmallVectorImpl< uint32_t > &Weights)
 Extract branch weights from MD_prof metadata.
LLVM_ABI bool llvm::extractBranchWeights (const Instruction &I, SmallVectorImpl< uint32_t > &Weights)
 Extract branch weights attatched to an Instruction.
LLVM_ABI bool llvm::extractBranchWeights (const Instruction &I, uint64_t &TrueVal, uint64_t &FalseVal)
 Extract branch weights from a conditional branch or select Instruction.
LLVM_ABI bool llvm::extractProfTotalWeight (const MDNode *ProfileData, uint64_t &TotalWeights)
 Retrieve the total of all weights from MD_prof data.
LLVM_ABI bool llvm::extractProfTotalWeight (const Instruction &I, uint64_t &TotalWeights)
 Retrieve the total of all weights from an instruction.
LLVM_ABI void llvm::setExplicitlyUnknownBranchWeights (Instruction &I, StringRef PassName)
 Specify that the branch weights for this terminator cannot be known at compile time.
LLVM_ABI void llvm::setExplicitlyUnknownBranchWeightsIfProfiled (Instruction &I, Function &F, StringRef PassName)
 Like setExplicitlyUnknownBranchWeights(...), but only sets unknown branch weights in the new instruction if the parent function of the original instruction has an entry count.
LLVM_ABI void llvm::setExplicitlyUnknownFunctionEntryCount (Function &F, StringRef PassName)
 Analogous to setExplicitlyUnknownBranchWeights, but for functions and their entry counts.
LLVM_ABI bool llvm::isExplicitlyUnknownProfileMetadata (const MDNode &MD)
LLVM_ABI bool llvm::hasExplicitlyUnknownBranchWeights (const Instruction &I)
LLVM_ABI void llvm::setBranchWeights (Instruction &I, ArrayRef< uint32_t > Weights, bool IsExpected, bool ElideAllZero=false)
 Create a new branch_weights metadata node and add or overwrite a prof metadata reference to instruction I.
LLVM_ABI void llvm::setFittedBranchWeights (Instruction &I, ArrayRef< uint64_t > Weights, bool IsExpected, bool ElideAllZero=false)
 Variant of setBranchWeights where the Weights will be fit first to uint32_t by shifting right.
LLVM_ABI SmallVector< uint32_tllvm::downscaleWeights (ArrayRef< uint64_t > Weights, std::optional< uint64_t > KnownMaxCount=std::nullopt)
 downscale the given weights preserving the ratio.
LLVM_ABI void llvm::scaleProfData (Instruction &I, uint64_t S, uint64_t T)
 Scaling the profile data attached to 'I' using the ratio of S/T.

Variables

cl::opt< boolllvm::ElideAllZeroBranchWeights ("elide-all-zero-branch-weights", cl::init(true))