diff options
Diffstat (limited to 'llvm/lib/Bitcode')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 10 | ||||
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 9cf1302b030..6da39a76310 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -5133,6 +5133,16 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) { switch (BitCode) { default: // Default behavior: ignore. break; + case bitc::FS_FLAGS: { // [flags] + uint64_t Flags = Record[0]; + // Scan flags (set only on the combined index). + assert(Flags <= 1 && "Unexpected bits in flag"); + + // 1 bit: WithGlobalValueDeadStripping flag. + if (Flags & 0x1) + TheIndex.setWithGlobalValueDeadStripping(); + break; + } case bitc::FS_VALUE_GUID: { // [valueid, refguid] uint64_t ValueID = Record[0]; GlobalValue::GUID RefGUID = Record[1]; diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 76add4f7da3..fd9cde17847 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -3552,6 +3552,11 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() { Stream.EnterSubblock(bitc::GLOBALVAL_SUMMARY_BLOCK_ID, 3); Stream.EmitRecord(bitc::FS_VERSION, ArrayRef<uint64_t>{INDEX_VERSION}); + // Write the index flags. Currently we only write a single flag, the value of + // withGlobalValueDeadStripping, which only applies to the combined index. + Stream.EmitRecord(bitc::FS_FLAGS, + ArrayRef<uint64_t>{Index.withGlobalValueDeadStripping()}); + for (const auto &GVI : valueIds()) { Stream.EmitRecord(bitc::FS_VALUE_GUID, ArrayRef<uint64_t>{GVI.second, GVI.first}); |