From 7bea1aad6a46ee9be8f443e97ce67d84d202bb79 Mon Sep 17 00:00:00 2001 From: Teresa Johnson Date: Tue, 26 Jun 2018 00:20:49 +0000 Subject: [ThinLTO] Compute GUID directly from GV when building per-module index Summary: I discovered when writing the summary parsing support that the per-module index builder and writer are computing the GUID from the value name alone (ignoring the linkage type). This was ok since those GUID were not emitted in the bitcode, and there are never multiple conflicting names in a single module. However, I don't see a reason for making the GUID computation different for the per-module case. It also makes things simpler on the parsing side to have the GUID computation consistent. So this patch changes the summary analysis phase and the per-module summary writer to compute the GUID using the facility on the GlobalValue. Reviewers: pcc, dexonsmith Subscribers: llvm-commits, inglorion Differential Revision: https://reviews.llvm.org/D47844 llvm-svn: 335560 --- llvm/lib/Analysis/ModuleSummaryAnalysis.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'llvm/lib/Analysis/ModuleSummaryAnalysis.cpp') diff --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp index ca0a315..6a589b4 100644 --- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp +++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp @@ -361,7 +361,7 @@ computeFunctionSummary(ModuleSummaryIndex &Index, const Module &M, TypeCheckedLoadConstVCalls.takeVector()); if (NonRenamableLocal) CantBePromoted.insert(F.getGUID()); - Index.addGlobalValueSummary(F.getName(), std::move(FuncSummary)); + Index.addGlobalValueSummary(F, std::move(FuncSummary)); } static void @@ -377,7 +377,7 @@ computeVariableSummary(ModuleSummaryIndex &Index, const GlobalVariable &V, llvm::make_unique(Flags, RefEdges.takeVector()); if (NonRenamableLocal) CantBePromoted.insert(V.getGUID()); - Index.addGlobalValueSummary(V.getName(), std::move(GVarSummary)); + Index.addGlobalValueSummary(V, std::move(GVarSummary)); } static void @@ -393,7 +393,7 @@ computeAliasSummary(ModuleSummaryIndex &Index, const GlobalAlias &A, AS->setAliasee(AliaseeSummary); if (NonRenamableLocal) CantBePromoted.insert(A.getGUID()); - Index.addGlobalValueSummary(A.getName(), std::move(AS)); + Index.addGlobalValueSummary(A, std::move(AS)); } // Set LiveRoot flag on entries matching the given value name. @@ -455,7 +455,7 @@ ModuleSummaryIndex llvm::buildModuleSummaryIndex( /* NotEligibleToImport = */ true, /* Live = */ true, /* Local */ GV->isDSOLocal()); - CantBePromoted.insert(GlobalValue::getGUID(Name)); + CantBePromoted.insert(GV->getGUID()); // Create the appropriate summary type. if (Function *F = dyn_cast(GV)) { std::unique_ptr Summary = @@ -472,12 +472,12 @@ ModuleSummaryIndex llvm::buildModuleSummaryIndex( ArrayRef{}, ArrayRef{}, ArrayRef{}); - Index.addGlobalValueSummary(Name, std::move(Summary)); + Index.addGlobalValueSummary(*GV, std::move(Summary)); } else { std::unique_ptr Summary = llvm::make_unique(GVFlags, ArrayRef{}); - Index.addGlobalValueSummary(Name, std::move(Summary)); + Index.addGlobalValueSummary(*GV, std::move(Summary)); } }); } -- cgit v1.1