[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
This commit is contained in:
@@ -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).
|
||||
|
||||
Reference in New Issue
Block a user