This is an archive of the discontinued LLVM Phabricator instance.

Use a different block id for block of metadata kind records
ClosedPublic

Authored by tejohnson on Nov 13 2015, 6:27 AM.

Details

Summary

There are currently two blocks with the METADATA_BLOCK id at module
scope. The first has the module-level metadata values (consisting of
some combination of METADATA_* record codes except for METADATA_KIND).
The second consists only of METADATA_KIND records. The latter is used
only in the METADATA_ATTACHMENT block within function blocks (for
metadata attached to instructions).

For ThinLTO we want to delay the parsing of module level metadata
until all functions have been imported from that module (there is some
bookkeeping used to suture it up when we read it during a post-pass).
However, we do need the METADATA_KIND records when parsing the function
body during importing, since those kinds are used as described above.

To simplify identification and parsing of just the block containing
the metadata kinds, use a different block id (METADATA_KIND_BLOCK_ID).
Support older bitcode without the new block id as well.

Diff Detail

Repository
rL LLVM

Event Timeline

tejohnson updated this revision to Diff 40146.Nov 13 2015, 6:27 AM
tejohnson retitled this revision from to Use a different block id for block of metadata kind records.
tejohnson updated this object.
tejohnson added reviewers: dexonsmith, mehdi_amini.
tejohnson added subscribers: llvm-commits, davidxl.
mehdi_amini added inline comments.Nov 14 2015, 4:03 PM
lib/Bitcode/Reader/BitcodeReader.cpp
409 ↗(On Diff #40146)

Usually function parameters are SmallVectorImpl

2409 ↗(On Diff #40146)

What kind of record is allowed here that we want to ignore?

tejohnson added inline comments.Nov 14 2015, 4:09 PM
lib/Bitcode/Reader/BitcodeReader.cpp
409 ↗(On Diff #40146)

Will fix.

2409 ↗(On Diff #40146)

This is consistent with all the other parsing routines that ignore unrecognized blocks and records.

tejohnson updated this revision to Diff 40219.Nov 14 2015, 4:40 PM
  • Use SmallVectorImpl for passing Record as parameter.
mehdi_amini accepted this revision.Nov 14 2015, 5:01 PM
mehdi_amini edited edge metadata.
This revision is now accepted and ready to land.Nov 14 2015, 5:01 PM
This revision was automatically updated to reflect the committed changes.