Add a version field in the bitcode for the summary

Differential Revision: http://reviews.llvm.org/D19456

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 267318
This commit is contained in:
Mehdi Amini
2016-04-24 03:18:11 +00:00
parent 059464fe36
commit 8fe6936e18
11 changed files with 46 additions and 1 deletions

View File

@@ -5995,8 +5995,21 @@ std::error_code ModuleSummaryIndexBitcodeReader::parseModule() {
std::error_code ModuleSummaryIndexBitcodeReader::parseEntireSummary() {
if (Stream.EnterSubBlock(bitc::GLOBALVAL_SUMMARY_BLOCK_ID))
return error("Invalid record");
SmallVector<uint64_t, 64> Record;
// Parse version
{
BitstreamEntry Entry = Stream.advanceSkippingSubblocks();
if (Entry.Kind != BitstreamEntry::Record)
return error("Invalid Summary Block: record for version expected");
if (Stream.readRecord(Entry.ID, Record) != bitc::FS_VERSION)
return error("Invalid Summary Block: version expected");
}
const uint64_t Version = Record[0];
if (Version != 1)
return error("Invalid summary version " + Twine(Version) + ", 1 expected");
Record.clear();
// Keep around the last seen summary to be used when we see an optional
// "OriginalName" attachement.
GlobalValueSummary *LastSeenSummary = nullptr;