From f3681015670c531cb42bc20dbbe78cb237b055d7 Mon Sep 17 00:00:00 2001 From: Teresa Johnson Date: Wed, 7 Feb 2018 04:05:59 +0000 Subject: [ThinLTO] Serialize WithGlobalValueDeadStripping index flag for distributed backends Summary: A recent fix to drop dead symbols (r323633) did not work for ThinLTO distributed backends because we lose the WithGlobalValueDeadStripping set on the index during the thin link. This patch adds a new flags record to the bitcode format for the index, and serializes this flag for the combined index (it would always be 0 for the per-module index generated by the compile step, so no need to serialize the new flags record there until/unless we add another flag that applies to the per-module indexes). Generally this flag should always be set for the distributed backends, which are necessarily performed after the thin link. However, if we were to simply set this flag on the index applied to the distributed backends (invoked via clang), we would lose the ability to disable dead stripping via -compute-dead=false for debugging purposes. Reviewers: grimar, pcc Subscribers: mehdi_amini, inglorion, eraman, llvm-commits Differential Revision: https://reviews.llvm.org/D42799 llvm-svn: 324444 --- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp') 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]; -- cgit v1.2.3