diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2016-07-07 18:31:51 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2016-07-07 18:31:51 +0000 |
commit | 73589f321b88ff6f0896b6beb5d73c40d84ebe41 (patch) | |
tree | a754447d7802d3b8fab00d90a8847d737cc52f22 /llvm/lib/LTO/ThinLTOCodeGenerator.cpp | |
parent | bed6779c7a839ed6dab85d0198e105021b63552f (diff) | |
download | llvm-73589f321b88ff6f0896b6beb5d73c40d84ebe41.zip llvm-73589f321b88ff6f0896b6beb5d73c40d84ebe41.tar.gz llvm-73589f321b88ff6f0896b6beb5d73c40d84ebe41.tar.bz2 |
ThinLTO: Do not take into account whether a definition has multiple copies when promoting.
We currently do not touch a symbol's linkage in the case where a definition
has a single copy. However, this code is effectively unnecessary: either
the definition is not exported, in which case the internalize phase sets
its linkage to internal, or it is exported, in which case we need to promote
linkage to weak. Those two cases are already handled by existing code.
I believe that the only real functional change here is in the case where we
have a single definition which does not prevail (e.g. because the definition
in a native object file prevails). In that case we now lower linkage to
available_externally following the existing code path for that case.
As a result we can remove the isExported function parameter from the
thinLTOResolveWeakForLinkerInIndex function.
Differential Revision: http://reviews.llvm.org/D21883
llvm-svn: 274784
Diffstat (limited to 'llvm/lib/LTO/ThinLTOCodeGenerator.cpp')
-rw-r--r-- | llvm/lib/LTO/ThinLTOCodeGenerator.cpp | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp index 5c97e4d..2aa1e3f 100644 --- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp +++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp @@ -393,8 +393,6 @@ ProcessThinLTOModule(Module &TheModule, ModuleSummaryIndex &Index, /// copies when possible). static void resolveWeakForLinkerInIndex( ModuleSummaryIndex &Index, - const StringMap<FunctionImporter::ExportSetTy> &ExportLists, - const DenseSet<GlobalValue::GUID> &GUIDPreservedSymbols, StringMap<std::map<GlobalValue::GUID, GlobalValue::LinkageTypes>> &ResolvedODR) { @@ -409,21 +407,13 @@ static void resolveWeakForLinkerInIndex( return Prevailing->second == S; }; - auto isExported = [&](StringRef ModuleIdentifier, GlobalValue::GUID GUID) { - const auto &ExportList = ExportLists.find(ModuleIdentifier); - return (ExportList != ExportLists.end() && - ExportList->second.count(GUID)) || - GUIDPreservedSymbols.count(GUID); - }; - auto recordNewLinkage = [&](StringRef ModuleIdentifier, GlobalValue::GUID GUID, GlobalValue::LinkageTypes NewLinkage) { ResolvedODR[ModuleIdentifier][GUID] = NewLinkage; }; - thinLTOResolveWeakForLinkerInIndex(Index, isPrevailing, isExported, - recordNewLinkage); + thinLTOResolveWeakForLinkerInIndex(Index, isPrevailing, recordNewLinkage); } // Initialize the TargetMachine builder for a given Triple @@ -537,14 +527,9 @@ void ThinLTOCodeGenerator::promote(Module &TheModule, ComputeCrossModuleImport(Index, ModuleToDefinedGVSummaries, ImportLists, ExportLists); - // Convert the preserved symbols set from string to GUID - auto GUIDPreservedSymbols = - computeGUIDPreservedSymbols(PreservedSymbols, TMBuilder.TheTriple); - // Resolve LinkOnce/Weak symbols. StringMap<std::map<GlobalValue::GUID, GlobalValue::LinkageTypes>> ResolvedODR; - resolveWeakForLinkerInIndex(Index, ExportLists, GUIDPreservedSymbols, - ResolvedODR); + resolveWeakForLinkerInIndex(Index, ResolvedODR); thinLTOResolveWeakForLinkerModule( TheModule, ModuleToDefinedGVSummaries[ModuleIdentifier]); @@ -750,8 +735,7 @@ void ThinLTOCodeGenerator::run() { // Resolve LinkOnce/Weak symbols, this has to be computed early because it // impacts the caching. - resolveWeakForLinkerInIndex(*Index, ExportLists, GUIDPreservedSymbols, - ResolvedODR); + resolveWeakForLinkerInIndex(*Index, ResolvedODR); auto isExported = [&](StringRef ModuleIdentifier, GlobalValue::GUID GUID) { const auto &ExportList = ExportLists.find(ModuleIdentifier); |