[PATCH] D21052: IR: Allow metadata attachments on declarations, and fix lazy loaded metadata issue with globals.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 14 16:50:28 PDT 2016

pcc added a comment.

> !dbg attachments on declarations should be disallowed (I suggest the verifier?).

>  PGO attachments on declarations should probably also be disallowed?


> Along the same lines, I think having two !dbg (or PGO) attachments on the same function should be disallowed. I can imagine loosening this restriction in the future (with lots more work) but I think right now it would cause a bug.

Was already done for !dbg as part of r271358. I've committed a similar change for !prof in r272734.

> Lazy-loading needs to be fast.

This change along with http://reviews.llvm.org/D20147 should not represent a performance regression in regard to global variable debug metadata. Global variable debug metadata will continue to be stored in the global metadata block and will continue to be materialized upon calling `materializeMetadata`.

Comment at: lib/Bitcode/Writer/ValueEnumerator.cpp:351
@@ -350,2 +350,3 @@
     for (const auto &I : MDs)
-      EnumerateMetadata(&GV, I.second);
+      // FIXME: Pass GV to EnumerateMetadata and arrange for the bitcode writer
+      // to write metadata to the global variable's own metadata block.
aprantl wrote:
> I'm just curious: Is this being addressed in one of the follow-up reviews? If not, can you please file a PR about it?
Filed PR28134.


More information about the llvm-commits mailing list