summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/SampleProfile.cpp
diff options
context:
space:
mode:
authorDehao Chen <dehao@google.com>2017-02-06 23:33:15 +0000
committerDehao Chen <dehao@google.com>2017-02-06 23:33:15 +0000
commit4a9dd70213f5359b5dc5b3772f81a0b1c40ee55b (patch)
treedcd004296d844b2604e858ec3479fdda59d097be /llvm/lib/Transforms/IPO/SampleProfile.cpp
parentbecf0a362a030e59f4a78621931342ea8aecd5e1 (diff)
downloadbcm5719-llvm-4a9dd70213f5359b5dc5b3772f81a0b1c40ee55b.tar.gz
bcm5719-llvm-4a9dd70213f5359b5dc5b3772f81a0b1c40ee55b.zip
Fix the samplepgo indirect call promotion bug: we should not promote a direct call.
Summary: Checking CS.getCalledFunction() == nullptr does not necessary indicate indirect call. We also need to check if CS.getCalledValue() is not a constant. Reviewers: davidxl Reviewed By: davidxl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29570 llvm-svn: 294260
Diffstat (limited to 'llvm/lib/Transforms/IPO/SampleProfile.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/SampleProfile.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp
index 87015272b96..d6678279355 100644
--- a/llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -634,7 +634,8 @@ bool SampleProfileLoader::inlineHotFunctions(Function &F) {
InlineFunctionInfo IFI(nullptr, ACT ? &GetAssumptionCache : nullptr);
Function *CalledFunction = CallSite(I).getCalledFunction();
Instruction *DI = I;
- if (!CalledFunction && !PromotedInsns.count(I)) {
+ if (!CalledFunction && !PromotedInsns.count(I) &&
+ CallSite(I).isIndirectCall()) {
auto CalleeFunctionName = findCalleeFunctionSamples(*I)->getName();
const char *Reason = "Callee function not available";
CalledFunction = F.getParent()->getFunction(CalleeFunctionName);
OpenPOWER on IntegriCloud