summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Function.cpp
diff options
context:
space:
mode:
authorWenlei He <aktoon@gmail.com>2019-11-01 12:57:23 -0700
committerWenlei He <aktoon@gmail.com>2019-11-06 18:36:00 -0800
commitba1dfae054b4c9a8b11aabd62fd0dcb792366206 (patch)
treeb0f13b3c633b816bb59557d33ab0a01cef9478f5 /llvm/lib/IR/Function.cpp
parente55b536d7d810393f0a03c800e8263d83926090c (diff)
downloadbcm5719-llvm-ba1dfae054b4c9a8b11aabd62fd0dcb792366206.tar.gz
bcm5719-llvm-ba1dfae054b4c9a8b11aabd62fd0dcb792366206.zip
Keep import function list for inlinee profile update
Summary: When adjusting function entry counts after inlining, Funciton::setEntryCount is called without providing an import function list. The side effect of that is the previously set import function list will be dropped. The import function list is used by ThinLTO to help import hot cross module callee for LTO inlining, so dropping that during ThinLTO pre-link may adversely affect LTO inlining. The fix is to keep the list while updating entry counts for inlining. Reviewers: wmi, davidxl, tejohnson Subscribers: mehdi_amini, hiraditya, dexonsmith, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69736
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r--llvm/lib/IR/Function.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index 3f70d2c904e..4661c086458 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -1533,6 +1533,11 @@ void Function::setEntryCount(ProfileCount Count,
auto PrevCount = getEntryCount();
assert(!PrevCount.hasValue() || PrevCount.getType() == Count.getType());
#endif
+
+ auto ImportGUIDs = getImportGUIDs();
+ if (S == nullptr && ImportGUIDs.size())
+ S = &ImportGUIDs;
+
MDBuilder MDB(getContext());
setMetadata(
LLVMContext::MD_prof,
OpenPOWER on IntegriCloud