summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/ModuleSummaryAnalysis.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
index 09d18eb3da1..a3f43071b44 100644
--- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
+++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
@@ -194,12 +194,22 @@ ModuleSummaryIndex llvm::buildModuleSummaryIndex(
ProfileSummaryInfo *PSI) {
ModuleSummaryIndex Index;
- // Identify the local values in the llvm.used set, which should not be
- // exported as they would then require renaming and promotion, but we
- // may have opaque uses e.g. in inline asm.
+ // Identify the local values in the llvm.used and llvm.compiler.used sets,
+ // which should not be exported as they would then require renaming and
+ // promotion, but we may have opaque uses e.g. in inline asm. We collect them
+ // here because we use this information to mark functions containing inline
+ // assembly calls as not importable.
+ SmallPtrSet<GlobalValue *, 8> LocalsUsed;
SmallPtrSet<GlobalValue *, 8> Used;
+ // First collect those in the llvm.used set.
collectUsedGlobalVariables(M, Used, /*CompilerUsed*/ false);
- SmallPtrSet<GlobalValue *, 8> LocalsUsed;
+ for (auto *V : Used) {
+ if (V->hasLocalLinkage())
+ LocalsUsed.insert(V);
+ }
+ Used.clear();
+ // Next collect those in the llvm.compiler.used set.
+ collectUsedGlobalVariables(M, Used, /*CompilerUsed*/ true);
for (auto *V : Used) {
if (V->hasLocalLinkage())
LocalsUsed.insert(V);
OpenPOWER on IntegriCloud