diff options
author | Vitaly Buka <vitalybuka@google.com> | 2018-02-16 23:38:22 +0000 |
---|---|---|
committer | Vitaly Buka <vitalybuka@google.com> | 2018-02-16 23:38:22 +0000 |
commit | 769134dac3f1968495f7341882e6e7c719545ead (patch) | |
tree | efcbd618079ef6af5bbd465d08ad7233d81e19e7 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | c35ff824de59904ff7cc8c93620feacae7947c3b (diff) | |
download | bcm5719-llvm-769134dac3f1968495f7341882e6e7c719545ead.tar.gz bcm5719-llvm-769134dac3f1968495f7341882e6e7c719545ead.zip |
[ThinLTO] Allow indexing to request backend to ignore the module
Summary:
Gold plugin does not add pass to ThinLTO modules without useful symbols.
In this case ThinLTO can't create corresponding index file and some features, like CFI,
cannot be processes by backed correctly without index.
Given that we don't need the backed output we can request it to avoid
processing the module. This is implemented by this patch using new
"SkipModuleByDistributedBackend" flag.
Reviewers: pcc, tejohnson
Subscribers: mehdi_amini, inglorion, eraman, cfe-commits
Differential Revision: https://reviews.llvm.org/D42995
llvm-svn: 325411
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 5a473d6684c..15c06f5506a 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -3604,10 +3604,13 @@ 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()}); + // Write the index flags. + uint64_t Flags = 0; + if (Index.withGlobalValueDeadStripping()) + Flags |= 0x1; + if (Index.skipModuleByDistributedBackend()) + Flags |= 0x2; + Stream.EmitRecord(bitc::FS_FLAGS, ArrayRef<uint64_t>{Flags}); for (const auto &GVI : valueIds()) { Stream.EmitRecord(bitc::FS_VALUE_GUID, |