LLVM 22.0.0git
ProfDataUtils.cpp File Reference

Go to the source code of this file.

Functions

static bool isTargetMD (const MDNode *ProfData, const char *Name, unsigned MinOps)
template<typename T, typename = typename std::enable_if<std::is_arithmetic_v<T>>>
static void extractFromBranchWeightMD (const MDNode *ProfileData, SmallVectorImpl< T > &Weights)
static SmallVector< uint32_tfitWeights (ArrayRef< uint64_t > Weights)
 Push the weights right to fit in uint32_t.
static bool hasCountTypeMD (const Instruction &I)

Variables

static constexpr unsigned MinBWOps = 3
static constexpr unsigned MinVPOps = 5
static cl::opt< boolElideAllZeroBranchWeights ("elide-all-zero-branch-weights", cl::init(true))

Function Documentation

◆ extractFromBranchWeightMD()

◆ fitWeights()

SmallVector< uint32_t > fitWeights ( ArrayRef< uint64_t > Weights)
static

Push the weights right to fit in uint32_t.

Definition at line 89 of file ProfDataUtils.cpp.

References llvm::append_range(), llvm::countl_zero(), llvm::max_element(), llvm::Offset, and llvm::ArrayRef< T >::size().

Referenced by llvm::setFittedBranchWeights().

◆ hasCountTypeMD()

bool hasCountTypeMD ( const Instruction & I)
static

Definition at line 136 of file ProfDataUtils.cpp.

References I, llvm::isa(), llvm::isBranchWeightMD(), and llvm::isValueProfileMD().

Referenced by llvm::scaleProfData().

◆ isTargetMD()

bool isTargetMD ( const MDNode * ProfData,
const char * Name,
unsigned MinOps )
static

Variable Documentation

◆ ElideAllZeroBranchWeights

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

Referenced by llvm::setBranchWeights().

◆ MinBWOps

unsigned MinBWOps = 3
staticconstexpr

Definition at line 42 of file ProfDataUtils.cpp.

Referenced by llvm::isBranchWeightMD().

◆ MinVPOps

unsigned MinVPOps = 5
staticconstexpr

Definition at line 45 of file ProfDataUtils.cpp.

Referenced by llvm::isValueProfileMD().