summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/FunctionImport.cpp
diff options
context:
space:
mode:
authorEugene Leviant <eleviant@accesssoftek.com>2017-12-12 10:12:46 +0000
committerEugene Leviant <eleviant@accesssoftek.com>2017-12-12 10:12:46 +0000
commitd53f3da772a0dec7003b25fe8fef9d02d2041767 (patch)
tree9ca18599d26898584d817e15811950bd63aa20d9 /llvm/lib/Transforms/IPO/FunctionImport.cpp
parentd63560b8179d4dca1bce0dfa62888ec1eef32e6d (diff)
downloadbcm5719-llvm-d53f3da772a0dec7003b25fe8fef9d02d2041767.tar.gz
bcm5719-llvm-d53f3da772a0dec7003b25fe8fef9d02d2041767.zip
Revert r320464 as it breaks gold plugin tests
llvm-svn: 320467
Diffstat (limited to 'llvm/lib/Transforms/IPO/FunctionImport.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/FunctionImport.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp
index 043a04696ff..3a1d6de342f 100644
--- a/llvm/lib/Transforms/IPO/FunctionImport.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp
@@ -642,9 +642,23 @@ void llvm::thinLTOResolveWeakForLinkerModule(
/// Run internalization on \p TheModule based on symmary analysis.
void llvm::thinLTOInternalizeModule(Module &TheModule,
const GVSummaryMapTy &DefinedGlobals) {
+ // Parse inline ASM and collect the list of symbols that are not defined in
+ // the current module.
+ StringSet<> AsmUndefinedRefs;
+ ModuleSymbolTable::CollectAsmSymbols(
+ TheModule,
+ [&AsmUndefinedRefs](StringRef Name, object::BasicSymbolRef::Flags Flags) {
+ if (Flags & object::BasicSymbolRef::SF_Undefined)
+ AsmUndefinedRefs.insert(Name);
+ });
+
// Declare a callback for the internalize pass that will ask for every
// candidate GlobalValue if it can be internalized or not.
auto MustPreserveGV = [&](const GlobalValue &GV) -> bool {
+ // Can't be internalized if referenced in inline asm.
+ if (AsmUndefinedRefs.count(GV.getName()))
+ return true;
+
// Lookup the linkage recorded in the summaries during global analysis.
auto GS = DefinedGlobals.find(GV.getGUID());
if (GS == DefinedGlobals.end()) {
OpenPOWER on IntegriCloud