[ThinLTO] Restructure AliasSummary to contain ValueInfo of Aliasee
Summary: The AliasSummary previously contained the AliaseeGUID, which was only populated when reading the summary from bitcode. This patch changes it to instead hold the ValueInfo of the aliasee, and always populates it. This enables more efficient access to the ValueInfo (specifically in the recent patch r352438 which needed to perform an index hash table lookup using the aliasee GUID). As noted in the comments in AliasSummary, we no longer technically need to keep a pointer to the corresponding aliasee summary, since it could be obtained by walking the list of summaries on the ValueInfo looking for the summary in the same module. However, I am concerned that this would be inefficient when walking through the index during the thin link for various analyses. That can be reevaluated in the future. By always populating this new field, we can remove the guard and special handling for a 0 aliasee GUID when dumping the dot graph of the summary. An additional improvement in this patch is when reading the summaries from LLVM assembly we now set the AliaseeSummary field to the aliasee summary in that same module, which makes it consistent with the behavior when reading the summary from bitcode. Reviewers: pcc, mehdi_amini Subscribers: inglorion, eraman, steven_wu, dexonsmith, arphaman, llvm-commits Differential Revision: https://reviews.llvm.org/D57470 llvm-svn: 356268
This commit is contained in:
@@ -5482,14 +5482,11 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) {
|
||||
// ownership.
|
||||
AS->setModulePath(getThisModule()->first());
|
||||
|
||||
GlobalValue::GUID AliaseeGUID =
|
||||
getValueInfoFromValueId(AliaseeID).first.getGUID();
|
||||
auto AliaseeInModule =
|
||||
TheIndex.findSummaryInModule(AliaseeGUID, ModulePath);
|
||||
auto AliaseeVI = getValueInfoFromValueId(AliaseeID).first;
|
||||
auto AliaseeInModule = TheIndex.findSummaryInModule(AliaseeVI, ModulePath);
|
||||
if (!AliaseeInModule)
|
||||
return error("Alias expects aliasee summary to be parsed");
|
||||
AS->setAliasee(AliaseeInModule);
|
||||
AS->setAliaseeGUID(AliaseeGUID);
|
||||
AS->setAliasee(AliaseeVI, AliaseeInModule);
|
||||
|
||||
auto GUID = getValueInfoFromValueId(ValueID);
|
||||
AS->setOriginalName(GUID.second);
|
||||
@@ -5592,12 +5589,9 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) {
|
||||
LastSeenSummary = AS.get();
|
||||
AS->setModulePath(ModuleIdMap[ModuleId]);
|
||||
|
||||
auto AliaseeGUID =
|
||||
getValueInfoFromValueId(AliaseeValueId).first.getGUID();
|
||||
auto AliaseeInModule =
|
||||
TheIndex.findSummaryInModule(AliaseeGUID, AS->modulePath());
|
||||
AS->setAliasee(AliaseeInModule);
|
||||
AS->setAliaseeGUID(AliaseeGUID);
|
||||
auto AliaseeVI = getValueInfoFromValueId(AliaseeValueId).first;
|
||||
auto AliaseeInModule = TheIndex.findSummaryInModule(AliaseeVI, AS->modulePath());
|
||||
AS->setAliasee(AliaseeVI, AliaseeInModule);
|
||||
|
||||
ValueInfo VI = getValueInfoFromValueId(ValueID).first;
|
||||
LastSeenGUID = VI.getGUID();
|
||||
|
||||
Reference in New Issue
Block a user