diff options
| author | Dehao Chen <dehao@google.com> | 2017-09-19 21:18:14 +0000 |
|---|---|---|
| committer | Dehao Chen <dehao@google.com> | 2017-09-19 21:18:14 +0000 |
| commit | 62b9c33e1e243b6bf45e5958610b2f03c499b601 (patch) | |
| tree | b06e1006529ce83594738ea3bcf6af8330b4876d /llvm/lib/Transforms | |
| parent | c9c9748d99e663cb98663f7fbc6ac0b30bd8fa16 (diff) | |
| download | bcm5719-llvm-62b9c33e1e243b6bf45e5958610b2f03c499b601.tar.gz bcm5719-llvm-62b9c33e1e243b6bf45e5958610b2f03c499b601.zip | |
Import all inlined indirect call targets for SamplePGO.
Summary: In the ThinLTO compilation, if a function is inlined in the profiling binary, we need to inline it before annotation. If the callee is not available in the primary module, a first step is needed to import that callee function. For the current implementation, if the call is an indirect call, which has been promoted to >1 targets and inlined, SamplePGO will only import one target with the largest sample count. This patch fixed the bug to import all targets instead.
Reviewers: tejohnson, davidxl
Reviewed By: tejohnson
Subscribers: sanjoy, llvm-commits, mehdi_amini
Differential Revision: https://reviews.llvm.org/D36637
llvm-svn: 313678
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/IPO/SampleProfile.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp index 039fed0360f..5258746dbb9 100644 --- a/llvm/lib/Transforms/IPO/SampleProfile.cpp +++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp @@ -756,9 +756,11 @@ bool SampleProfileLoader::inlineHotFunctions( continue; } if (!CalledFunction || !CalledFunction->getSubprogram()) { - findCalleeFunctionSamples(*I)->findImportedFunctions( - ImportGUIDs, F.getParent(), - Samples->getTotalSamples() * SampleProfileHotThreshold / 100); + // Handles functions that are imported from other modules. + for (const FunctionSamples *FS : findIndirectCallFunctionSamples(*I)) + FS->findImportedFunctions( + ImportGUIDs, F.getParent(), + Samples->getTotalSamples() * SampleProfileHotThreshold / 100); continue; } assert(isa<CallInst>(DI) || isa<InvokeInst>(DI)); |

