IR: Function summary representation for type tests.

Each function summary has an attached list of type identifier GUIDs. The
idea is that during the regular LTO phase we would match these GUIDs to type
identifiers defined by the regular LTO module and store the resolutions in
a top-level "type identifier summary" (which will be implemented separately).

Differential Revision: https://reviews.llvm.org/D27967

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290280 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Peter Collingbourne
2016-12-21 23:03:45 +00:00
parent 57e4fa8aaa
commit ea3f918aec
8 changed files with 102 additions and 10 deletions

View File

@@ -4847,6 +4847,7 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(
// "OriginalName" attachement.
GlobalValueSummary *LastSeenSummary = nullptr;
bool Combined = false;
std::vector<GlobalValue::GUID> PendingTypeTests;
while (true) {
BitstreamEntry Entry = Stream.advanceSkippingSubblocks();
@@ -4912,7 +4913,8 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(
ArrayRef<uint64_t>(Record).slice(CallGraphEdgeStartIndex),
IsOldProfileFormat, HasProfile);
auto FS = llvm::make_unique<FunctionSummary>(
Flags, InstCount, std::move(Refs), std::move(Calls));
Flags, InstCount, std::move(Refs), std::move(Calls),
std::move(PendingTypeTests));
auto GUID = getGUIDFromValueId(ValueID);
FS->setModulePath(TheIndex.addModulePath(ModulePath, 0)->first());
FS->setOriginalName(GUID.second);
@@ -4985,7 +4987,8 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(
IsOldProfileFormat, HasProfile);
GlobalValue::GUID GUID = getGUIDFromValueId(ValueID).first;
auto FS = llvm::make_unique<FunctionSummary>(
Flags, InstCount, std::move(Refs), std::move(Edges));
Flags, InstCount, std::move(Refs), std::move(Edges),
std::move(PendingTypeTests));
LastSeenSummary = FS.get();
FS->setModulePath(ModuleIdMap[ModuleId]);
TheIndex.addGlobalValueSummary(GUID, std::move(FS));
@@ -5041,6 +5044,13 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(
LastSeenSummary->setOriginalName(OriginalName);
// Reset the LastSeenSummary
LastSeenSummary = nullptr;
break;
}
case bitc::FS_TYPE_TESTS: {
assert(PendingTypeTests.empty());
PendingTypeTests.insert(PendingTypeTests.end(), Record.begin(),
Record.end());
break;
}
}
}