summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/FunctionImport.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/IPO/FunctionImport.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/FunctionImport.cpp35
1 files changed, 13 insertions, 22 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp
index f915aea004f..531dbb5b6f2 100644
--- a/llvm/lib/Transforms/IPO/FunctionImport.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp
@@ -764,7 +764,7 @@ void llvm::computeDeadSymbols(
}
// Make value live and add it to the worklist if it was not live before.
- auto visit = [&](ValueInfo VI) {
+ auto visit = [&](ValueInfo VI, bool IsAliasee) {
// FIXME: If we knew which edges were created for indirect call profiles,
// we could skip them here. Any that are live should be reached via
// other edges, e.g. reference edges. Otherwise, using a profile collected
@@ -800,12 +800,15 @@ void llvm::computeDeadSymbols(
Interposable = true;
}
- if (!KeepAliveLinkage)
- return;
+ if (!IsAliasee) {
+ if (!KeepAliveLinkage)
+ return;
- if (Interposable)
- report_fatal_error(
- "Interposable and available_externally/linkonce_odr/weak_odr symbol");
+ if (Interposable)
+ report_fatal_error(
+ "Interposable and available_externally/linkonce_odr/weak_odr "
+ "symbol");
+ }
}
for (auto &S : VI.getSummaryList())
@@ -821,16 +824,16 @@ void llvm::computeDeadSymbols(
// If this is an alias, visit the aliasee VI to ensure that all copies
// are marked live and it is added to the worklist for further
// processing of its references.
- visit(AS->getAliaseeVI());
+ visit(AS->getAliaseeVI(), true);
continue;
}
Summary->setLive(true);
for (auto Ref : Summary->refs())
- visit(Ref);
+ visit(Ref, false);
if (auto *FS = dyn_cast<FunctionSummary>(Summary.get()))
for (auto Call : FS->calls())
- visit(Call.first);
+ visit(Call.first, false);
}
}
Index.setWithGlobalValueDeadStripping();
@@ -948,23 +951,11 @@ void llvm::thinLTOResolvePrevailingInModule(
auto NewLinkage = GS->second->linkage();
if (NewLinkage == GV.getLinkage())
return;
-
- // Switch the linkage to weakany if asked for, e.g. we do this for
- // linker redefined symbols (via --wrap or --defsym).
- // We record that the visibility should be changed here in `addThinLTO`
- // as we need access to the resolution vectors for each input file in
- // order to find which symbols have been redefined.
- // We may consider reorganizing this code and moving the linkage recording
- // somewhere else, e.g. in thinLTOResolvePrevailingInIndex.
- if (NewLinkage == GlobalValue::WeakAnyLinkage) {
- GV.setLinkage(NewLinkage);
- return;
- }
-
if (GlobalValue::isLocalLinkage(GV.getLinkage()) ||
// In case it was dead and already converted to declaration.
GV.isDeclaration())
return;
+
// Check for a non-prevailing def that has interposable linkage
// (e.g. non-odr weak or linkonce). In that case we can't simply
// convert to available_externally, since it would lose the
OpenPOWER on IntegriCloud