diff options
author | Teresa Johnson <tejohnson@google.com> | 2016-04-24 14:57:11 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2016-04-24 14:57:11 +0000 |
commit | 28e457bccd6d1dd6ba91d36253073372a1bb5d75 (patch) | |
tree | 5368e89d5262e31ef567218d31c72a894cde3f5c /llvm/lib/LTO/ThinLTOCodeGenerator.cpp | |
parent | 9f5697ef6803acededad77a51b40a3fbec905c81 (diff) | |
download | llvm-28e457bccd6d1dd6ba91d36253073372a1bb5d75.zip llvm-28e457bccd6d1dd6ba91d36253073372a1bb5d75.tar.gz llvm-28e457bccd6d1dd6ba91d36253073372a1bb5d75.tar.bz2 |
[ThinLTO] Remove GlobalValueInfo class from index
Summary:
Remove the GlobalValueInfo and change the ModuleSummaryIndex to directly
reference summary objects. The info structure was there to support lazy
parsing of the combined index summary objects, which is no longer
needed and not supported.
Reviewers: joker.eph
Subscribers: joker.eph, llvm-commits
Differential Revision: http://reviews.llvm.org/D19462
llvm-svn: 267344
Diffstat (limited to 'llvm/lib/LTO/ThinLTOCodeGenerator.cpp')
-rw-r--r-- | llvm/lib/LTO/ThinLTOCodeGenerator.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp index 9fef132..21ba1e9 100644 --- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp +++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp @@ -109,23 +109,24 @@ static void saveTempBitcode(const Module &TheModule, StringRef TempDir, WriteBitcodeToFile(&TheModule, OS, /* ShouldPreserveUseListOrder */ true); } -bool IsFirstDefinitionForLinker(const GlobalValueInfoList &GVInfo, +bool IsFirstDefinitionForLinker(const GlobalValueSummaryList &GVSummaryList, const ModuleSummaryIndex &Index, StringRef ModulePath) { // Get the first *linker visible* definition for this global in the summary // list. auto FirstDefForLinker = llvm::find_if( - GVInfo, [](const std::unique_ptr<GlobalValueInfo> &FuncInfo) { - auto Linkage = FuncInfo->summary()->linkage(); + GVSummaryList, [](const std::unique_ptr<GlobalValueSummary> &Summary) { + auto Linkage = Summary->linkage(); return !GlobalValue::isAvailableExternallyLinkage(Linkage); }); // If \p GV is not the first definition, give up... - if ((*FirstDefForLinker)->summary()->modulePath() != ModulePath) + if ((*FirstDefForLinker)->modulePath() != ModulePath) return false; // If there is any strong definition anywhere, do not bother emitting this. if (llvm::any_of( - GVInfo, [](const std::unique_ptr<GlobalValueInfo> &FuncInfo) { - auto Linkage = FuncInfo->summary()->linkage(); + GVSummaryList, + [](const std::unique_ptr<GlobalValueSummary> &Summary) { + auto Linkage = Summary->linkage(); return !GlobalValue::isAvailableExternallyLinkage(Linkage) && !GlobalValue::isWeakForLinker(Linkage); })) @@ -138,8 +139,9 @@ ResolveODR(const ModuleSummaryIndex &Index, const FunctionImporter::ExportSetTy &ExportList, StringRef ModuleIdentifier, GlobalValue::GUID GUID, const GlobalValueSummary &GV) { - auto HasMultipleCopies = - [&](const GlobalValueInfoList &GVInfo) { return GVInfo.size() > 1; }; + auto HasMultipleCopies = [&](const GlobalValueSummaryList &GVSummaryList) { + return GVSummaryList.size() > 1; + }; auto OriginalLinkage = GV.linkage(); switch (OriginalLinkage) { @@ -155,17 +157,17 @@ ResolveODR(const ModuleSummaryIndex &Index, break; case GlobalValue::LinkOnceODRLinkage: case GlobalValue::WeakODRLinkage: { - auto &GVInfo = Index.findGlobalValueInfoList(GUID)->second; + auto &GVSummaryList = Index.findGlobalValueSummaryList(GUID)->second; // We need to emit only one of these, the first module will keep // it, but turned into a weak while the others will drop it. - if (!HasMultipleCopies(GVInfo)) { + if (!HasMultipleCopies(GVSummaryList)) { // Exported LinkonceODR needs to be promoted to not be discarded if (GlobalValue::isDiscardableIfUnused(OriginalLinkage) && ExportList.count(GUID)) return GlobalValue::WeakODRLinkage; break; } - if (IsFirstDefinitionForLinker(GVInfo, Index, ModuleIdentifier)) + if (IsFirstDefinitionForLinker(GVSummaryList, Index, ModuleIdentifier)) return GlobalValue::WeakODRLinkage; else if (isa<AliasSummary>(&GV)) // Alias can't be turned into available_externally. |