summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2016-11-14 16:40:19 +0000
committerTeresa Johnson <tejohnson@google.com>2016-11-14 16:40:19 +0000
commitd5033a4576f8dabf3a4c35d0534aa83dde744098 (patch)
treef38710d8e07d516f8d2a194aa596ee436d7391b3 /llvm/lib/Transforms/IPO
parentd83eb34ee7af55baa0d76b4fc0fdde25dd7e958c (diff)
downloadbcm5719-llvm-d5033a4576f8dabf3a4c35d0534aa83dde744098.tar.gz
bcm5719-llvm-d5033a4576f8dabf3a4c35d0534aa83dde744098.zip
[ThinLTO] Make inline assembly handling more efficient in summary
Summary: The change in r285513 to prevent exporting of locals used in inline asm added all locals in the llvm.used set to the reference set of functions containing inline asm. Since these locals were marked NoRename, this automatically prevented importing of the function. Unfortunately, this caused an explosion in the summary reference lists in some cases. In my particular example, it happened for a large protocol buffer generated C++ file, where many of the generated functions contained an inline asm call. It was exacerbated when doing a ThinLTO PGO instrumentation build, where the PGO instrumentation included thousands of private __profd_* values that were added to llvm.used. We really only need to include a single llvm.used local (NoRename) value in the reference list of a function containing inline asm to block it being imported. However, it seems cleaner to add a flag to the summary that explicitly describes this situation, which is what this patch does. Reviewers: mehdi_amini Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D26402 llvm-svn: 286840
Diffstat (limited to 'llvm/lib/Transforms/IPO')
-rw-r--r--llvm/lib/Transforms/IPO/FunctionImport.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp
index 3bebc609bea..68626c02038 100644
--- a/llvm/lib/Transforms/IPO/FunctionImport.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp
@@ -153,7 +153,11 @@ static bool eligibleForImport(const ModuleSummaryIndex &Index,
// Check references (and potential calls) in the same module. If the current
// value references a global that can't be externally referenced it is not
- // eligible for import.
+ // eligible for import. First check the flag set when we have possible
+ // opaque references (e.g. inline asm calls), then check the call and
+ // reference sets.
+ if (Summary.hasInlineAsmMaybeReferencingInternal())
+ return false;
bool AllRefsCanBeExternallyReferenced =
llvm::all_of(Summary.refs(), [&](const ValueInfo &VI) {
return canBeExternallyReferenced(Index, VI.getGUID());
OpenPOWER on IntegriCloud