diff options
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r-- | llvm/lib/IR/Function.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index 28fb810..3e7fcbb 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -37,6 +37,7 @@ #include "llvm/IR/Metadata.h" #include "llvm/IR/Module.h" #include "llvm/IR/Operator.h" +#include "llvm/IR/ProfDataUtils.h" #include "llvm/IR/SymbolTableListTraits.h" #include "llvm/IR/Type.h" #include "llvm/IR/Use.h" @@ -1115,7 +1116,7 @@ std::optional<ProfileCount> Function::getEntryCount(bool AllowSynthetic) const { MDNode *MD = getMetadata(LLVMContext::MD_prof); if (MD && MD->getOperand(0)) if (MDString *MDS = dyn_cast<MDString>(MD->getOperand(0))) { - if (MDS->getString() == "function_entry_count") { + if (MDS->getString() == MDProfLabels::FunctionEntryCount) { ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(1)); uint64_t Count = CI->getValue().getZExtValue(); // A value of -1 is used for SamplePGO when there were no samples. @@ -1124,7 +1125,8 @@ std::optional<ProfileCount> Function::getEntryCount(bool AllowSynthetic) const { return std::nullopt; return ProfileCount(Count, PCT_Real); } else if (AllowSynthetic && - MDS->getString() == "synthetic_function_entry_count") { + MDS->getString() == + MDProfLabels::SyntheticFunctionEntryCount) { ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(1)); uint64_t Count = CI->getValue().getZExtValue(); return ProfileCount(Count, PCT_Synthetic); @@ -1137,7 +1139,7 @@ DenseSet<GlobalValue::GUID> Function::getImportGUIDs() const { DenseSet<GlobalValue::GUID> R; if (MDNode *MD = getMetadata(LLVMContext::MD_prof)) if (MDString *MDS = dyn_cast<MDString>(MD->getOperand(0))) - if (MDS->getString() == "function_entry_count") + if (MDS->getString() == MDProfLabels::FunctionEntryCount) for (unsigned i = 2; i < MD->getNumOperands(); i++) R.insert(mdconst::extract<ConstantInt>(MD->getOperand(i)) ->getValue() |