diff options
author | Xinliang David Li <davidxl@google.com> | 2019-04-24 19:51:16 +0000 |
---|---|---|
committer | Xinliang David Li <davidxl@google.com> | 2019-04-24 19:51:16 +0000 |
commit | 499c80b89015cf0fa744b228518b5f6632e8c989 (patch) | |
tree | d246a3dcdc237c1f2bb26567f1d64627a6f2fa1d /llvm/lib/IR/Function.cpp | |
parent | d129ee34a51e44c9d46a1bf646a12dbf9b438996 (diff) | |
download | llvm-499c80b89015cf0fa744b228518b5f6632e8c989.zip llvm-499c80b89015cf0fa744b228518b5f6632e8c989.tar.gz llvm-499c80b89015cf0fa744b228518b5f6632e8c989.tar.bz2 |
Add optional arg to profile count getters to filter
synthetic profile count.
Differential Revision: http://reviews.llvm.org/D61025
llvm-svn: 359131
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r-- | llvm/lib/IR/Function.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index 574ca88..70a0dbc 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -1381,7 +1381,7 @@ void Function::setEntryCount(uint64_t Count, Function::ProfileCountType Type, setEntryCount(ProfileCount(Count, Type), Imports); } -ProfileCount Function::getEntryCount() const { +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))) { @@ -1393,7 +1393,8 @@ ProfileCount Function::getEntryCount() const { if (Count == (uint64_t)-1) return ProfileCount::getInvalid(); return ProfileCount(Count, PCT_Real); - } else if (MDS->getString().equals("synthetic_function_entry_count")) { + } else if (AllowSynthetic && + MDS->getString().equals("synthetic_function_entry_count")) { ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(1)); uint64_t Count = CI->getValue().getZExtValue(); return ProfileCount(Count, PCT_Synthetic); |