This is an archive of the discontinued LLVM Phabricator instance.

Bitcode: Prepare to allow multiple modules per bitcode file.
AbandonedPublic

Authored by pcc on Sep 20 2016, 2:57 PM.

Details

Summary

As previously mentioned [1] I would like to add the ability for bitcode
files to contain multiple modules. This patch makes some structural changes
to the bitcode format and bitcode writer in preparation for that change.

  • Move BitcodeWriter's ownership of its BitstreamWriter to its client and make it responsible for emitting a single block rather than an entire bitcode file.
  • Move the block info block from the module block to the top level. This will let us use the same set of abbreviations in each module.

[1] http://lists.llvm.org/pipermail/llvm-dev/2016-May/099095.html

Diff Detail

Event Timeline

pcc updated this revision to Diff 71990.Sep 20 2016, 2:57 PM
pcc retitled this revision from to Bitcode: Prepare to allow multiple modules per bitcode file..
pcc updated this object.
pcc added reviewers: mehdi_amini, tejohnson.
pcc added subscribers: llvm-commits, krasin.
mehdi_amini edited edge metadata.Sep 20 2016, 3:01 PM

For the embedded bitcode, I believe Steven is already embedding bitcode inside LLVM IR. I don't remember the details, do you know about that?

mehdi_amini edited edge metadata.Sep 20 2016, 3:01 PM
mehdi_amini added a subscriber: steven_wu.
pcc added a comment.Sep 20 2016, 3:04 PM

I think the difference between what Steven is doing and what I am doing here is that he is embedding a bitcode module in a native object file, whereas this is adding a mechanism for multiple bitcode modules in the same bitcode file.

This is to reduce the amount of overhead due to needing full LTO? I read the email, but I'm still not quite sure I understand the motivation.

I don't think there is overlap between two features and I don't see this approach implemented in this patch can affect embedded bitcode.
What is the difference between the current summary block for thinLTO and the new bitcode block you are adding?

pcc added a comment.Sep 20 2016, 3:34 PM

Yes, this is to reduce the link time overhead of CFI and vtable opt by allowing these features to be used with ThinLTO.

pcc added a comment.Sep 20 2016, 3:36 PM

What is the difference between the current summary block for thinLTO and the new bitcode block you are adding?

I'm not sure what you mean, this patch does not introduce a new block.

In D24786#548187, @pcc wrote:

What is the difference between the current summary block for thinLTO and the new bitcode block you are adding?

I'm not sure what you mean, this patch does not introduce a new block.

I had a brief conversation with Mehdi and now I understand it better. Please ignore my previous comment.

pcc abandoned this revision.Oct 31 2016, 8:20 PM

Subsumed by D26179