LLVM  10.0.0svn
Functions
llvm::misexpect Namespace Reference

Functions

void verifyMisExpect (llvm::Instruction *I, const llvm::SmallVector< uint32_t, 4 > &Weights, llvm::LLVMContext &Ctx)
 verifyMisExpect - compares PGO counters to the thresholds used for llvm.expect and warns if the PGO counters are outside of the expected range. More...
 
void checkFrontendInstrumentation (Instruction &I)
 checkClangInstrumentation - verify if llvm.expect matches PGO profile This function checks the frontend instrumentation in the backend when lowering llvm.expect intrinsics. More...
 

Function Documentation

◆ checkFrontendInstrumentation()

void llvm::misexpect::checkFrontendInstrumentation ( Instruction I)

checkClangInstrumentation - verify if llvm.expect matches PGO profile This function checks the frontend instrumentation in the backend when lowering llvm.expect intrinsics.

It checks for existing metadata, and then validates the use of llvm.expect against the assigned branch weights.

Parameters
Ithe Instruction being checked

Definition at line 147 of file MisExpect.cpp.

References llvm::Value::getContext(), llvm::Instruction::getMetadata(), llvm::ConstantInt::getZExtValue(), and verifyMisExpect().

Referenced by handleSwitchExpect().

◆ verifyMisExpect()

void llvm::misexpect::verifyMisExpect ( llvm::Instruction I,
const llvm::SmallVector< uint32_t, 4 > &  Weights,
llvm::LLVMContext Ctx 
)

verifyMisExpect - compares PGO counters to the thresholds used for llvm.expect and warns if the PGO counters are outside of the expected range.

Parameters
IThe Instruction being checked
WeightsA vector of profile weights for each target block
CtxThe current LLVM context

Definition at line 95 of file MisExpect.cpp.

References llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::dbgs(), llvm::dyn_cast(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::Instruction::getFunction(), llvm::Instruction::getMetadata(), llvm::Value::getName(), LikelyBranchWeight, LLVM_DEBUG, Size, llvm::SmallVectorBase::size(), and UnlikelyBranchWeight.

Referenced by checkFrontendInstrumentation(), GetSortedValueDataFromCallTargets(), and llvm::setProfMetadata().