diff options
author | Teresa Johnson <tejohnson@google.com> | 2018-06-26 00:20:49 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2018-06-26 00:20:49 +0000 |
commit | 7bea1aad6a46ee9be8f443e97ce67d84d202bb79 (patch) | |
tree | 14ddf168fd87baa4510f2567ad45fe98c0c01147 /llvm/lib/Bitcode | |
parent | 57790c56853d57b675f650194dbf7a11d71bc5a5 (diff) | |
download | bcm5719-llvm-7bea1aad6a46ee9be8f443e97ce67d84d202bb79.tar.gz bcm5719-llvm-7bea1aad6a46ee9be8f443e97ce67d84d202bb79.zip |
[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
Diffstat (limited to 'llvm/lib/Bitcode')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index a3bcf6378cb..5713535ed81 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -3483,7 +3483,7 @@ void ModuleBitcodeWriterBase::writePerModuleFunctionSummaryRecord( void ModuleBitcodeWriterBase::writeModuleLevelReferences( const GlobalVariable &V, SmallVector<uint64_t, 64> &NameVals, unsigned FSModRefsAbbrev) { - auto VI = Index->getValueInfo(GlobalValue::getGUID(V.getName())); + auto VI = Index->getValueInfo(V.getGUID()); if (!VI || VI.getSummaryList().empty()) { // Only declarations should not have a summary (a declaration might however // have a summary if the def was in module level asm). @@ -3592,7 +3592,7 @@ void ModuleBitcodeWriterBase::writePerModuleGlobalValueSummary() { if (!F.hasName()) report_fatal_error("Unexpected anonymous function when writing summary"); - ValueInfo VI = Index->getValueInfo(GlobalValue::getGUID(F.getName())); + ValueInfo VI = Index->getValueInfo(F.getGUID()); if (!VI || VI.getSummaryList().empty()) { // Only declarations should not have a summary (a declaration might // however have a summary if the def was in module level asm). |