[ThinLTO] Serialize WithGlobalValueDeadStripping index flag for distributed backends
authorTeresa Johnson <tejohnson@google.com>
Wed, 7 Feb 2018 04:05:59 +0000 (04:05 +0000)
committerTeresa Johnson <tejohnson@google.com>
Wed, 7 Feb 2018 04:05:59 +0000 (04:05 +0000)
commitf3681015670c531cb42bc20dbbe78cb237b055d7
tree409b7e90c76aa0560955e60bbf4ff13bc857315c
parent37a4a8a4b128b934ed506a50474fd96030287d51
[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
13 files changed:
llvm/include/llvm/Bitcode/LLVMBitCodes.h
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/test/Bitcode/thinlto-alias.ll
llvm/test/Bitcode/thinlto-deadstrip-flag.ll [new file with mode: 0644]
llvm/test/Bitcode/thinlto-function-summary-callgraph-pgo.ll
llvm/test/Bitcode/thinlto-function-summary-callgraph-profile-summary.ll
llvm/test/Bitcode/thinlto-function-summary-callgraph-sample-profile-summary.ll
llvm/test/Bitcode/thinlto-function-summary-callgraph.ll
llvm/test/Bitcode/thinlto-function-summary-originalnames.ll
llvm/test/tools/gold/X86/thinlto.ll
llvm/test/tools/llvm-lto/thinlto.ll
llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp