This patch adds an IR, assembly and bitcode representation for metadata
attachments for globals. Future patches will port existing features to use
these new attachments.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
include/llvm/IR/GlobalObject.h | ||
---|---|---|
74 ↗ | (On Diff #56597) | Yep. This was moved from Function so I didn't look too closely at it. Fixed. |
Some more minor comments, but otherwise this looks good from my end. Thanks!
docs/BitCodeFormat.rst | ||
---|---|---|
851 ↗ | (On Diff #56601) | Should this be code 19? |
docs/LangRef.rst | ||
629 ↗ | (On Diff #56601) | Should this be (!<name> !<N>)* ? |
lib/Bitcode/Reader/BitcodeReader.cpp | ||
4160 ↗ | (On Diff #56601) | I think we need to guard against corrupted input here. if (Record.size() % 2) return error("Invalid record"); |
4202 ↗ | (On Diff #56601) | Oh. Given that this is here we can do an assert above. I still wonder whether an odd number of fields shouldn't be a hard error here. |
test/Assembler/metadata.ll | ||
8 ↗ | (On Diff #56601) | Should we use variables here or renumber the metadata in the testcase here? It's odd to check for something different than the input here. |
docs/BitCodeFormat.rst | ||
---|---|---|
851 ↗ | (On Diff #56601) | Yes, fixed. |
docs/LangRef.rst | ||
629 ↗ | (On Diff #56601) | Maybe, but we do have other sigil-variable forms in these grammars, and I think the intent is clear enough. (If we did want to change this, there's another one like this for functions.) |
lib/Bitcode/Reader/BitcodeReader.cpp | ||
4160 ↗ | (On Diff #56601) | Added assert (see below) and guard to the GLOBALVAR_ATTACHMENT case above. |
4202 ↗ | (On Diff #56601) | Added assert above. I think we need to be able to accept an odd number of fields here for instruction metadata attachments (and presumably would need to keep accepting them for upgrades even if we change the representation). |
test/Assembler/metadata.ll | ||
8 ↗ | (On Diff #56601) | I started using variables for all tests in this file. |