diff options
author | Dehao Chen <dehao@google.com> | 2017-10-05 20:15:29 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2017-10-05 20:15:29 +0000 |
commit | 16f01fb1db79cf0344a96efa3081f92490e638e4 (patch) | |
tree | 78ed16d6c7478267f89c50d98d4d681129842f18 /llvm/lib/Transforms/IPO/SampleProfile.cpp | |
parent | 0876cfb2f457c73b526a8d1c0158bac9e9c86ef6 (diff) | |
download | bcm5719-llvm-16f01fb1db79cf0344a96efa3081f92490e638e4.tar.gz bcm5719-llvm-16f01fb1db79cf0344a96efa3081f92490e638e4.zip |
Annotate VP prof on indirect call if it is ICPed in the profiled binary.
Summary: In SamplePGO, when an indirect call is promoted in the profiled binary, before profile annotation, it will be promoted and inlined. For the original indirect call, the current implementation will not mark VP profile on it. This is an issue when profile becomes stale. This patch annotates VP prof on indirect calls during annotation.
Reviewers: tejohnson
Reviewed By: tejohnson
Subscribers: sanjoy, llvm-commits
Differential Revision: https://reviews.llvm.org/D38477
llvm-svn: 315016
Diffstat (limited to 'llvm/lib/Transforms/IPO/SampleProfile.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/SampleProfile.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp index 7dce904ff15..fb7397c3d8e 100644 --- a/llvm/lib/Transforms/IPO/SampleProfile.cpp +++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp @@ -511,10 +511,12 @@ ErrorOr<uint64_t> SampleProfileLoader::getInstWeight(const Instruction &Inst) { if (isa<BranchInst>(Inst) || isa<IntrinsicInst>(Inst)) return std::error_code(); - // If a call/invoke instruction is inlined in profile, but not inlined here, + // If a direct call/invoke instruction is inlined in profile + // (findCalleeFunctionSamples returns non-empty result), but not inlined here, // it means that the inlined callsite has no sample, thus the call // instruction should have 0 count. if ((isa<CallInst>(Inst) || isa<InvokeInst>(Inst)) && + !ImmutableCallSite(&Inst).isIndirectCall() && findCalleeFunctionSamples(Inst)) return 0; |