[ThinLTO] Only emit referenced type id records in index files
authorTeresa Johnson <tejohnson@google.com>
Thu, 19 Jul 2018 22:25:56 +0000 (22:25 +0000)
committerTeresa Johnson <tejohnson@google.com>
Thu, 19 Jul 2018 22:25:56 +0000 (22:25 +0000)
commit0c432b1a70d29e60c3428198dd6dba9ebcc91851
tree1620c6ad5124747d0ca5c3308359cd0bed510b73
parentc12c5d421fc92a8f689ce0cabc4962f69774d1be
[ThinLTO] Only emit referenced type id records in index files

Summary:
Currently all type ids are emitted into the index file when it is
written. For distributed ThinLTO, that meant that all type ids were
being duplicated into every single distributed index file, regardless of
whether they were referenced, leading to huge amounts of unnecessary
duplication and size bloat.

Keep track of the type id GUIDs actually referenced by the GV summary
records being emitted, and only emit those type IDs.

Add a new test, and fix test/Assembler/thinlto-summary.ll so that all
type ids are referenced to prevent deletion in that test.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, vitalybuka, llvm-commits

Differential Revision: https://reviews.llvm.org/D49565

llvm-svn: 337503
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/test/Assembler/thinlto-summary.ll
llvm/test/ThinLTO/X86/Inputs/cfi-distributed.ll [new file with mode: 0644]
llvm/test/ThinLTO/X86/cfi-distributed.ll [new file with mode: 0644]