[PATCH] D29110: LangRef: Document the allowed metadata dropping transforms.

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 24 18:08:48 PST 2017


mehdi_amini added a comment.

(Added a few people that cares about this stuff usually).

So I'm quite worried about this. It slipped in with metadata attachments added to globals, and I'm not sure we really measured the consequence.

I believe we had until now the contract that Metadata attachments (which were on instruction only) were always safely removable: we can always transform the IR without interpreting the Metadata attachment but we have to drop the metadata in the process (if we don't know how to update them).

Adding metadata attachment to global variable is fine by itself, but at the same time it has been used in LLVM 4.0 to express *correctness* related construct: they can't any longer be ignored by the optimizer or the program may break.

I believe the implication of this hasn't been considered enough, and ultimately it means that any pass that looks at a global needs to understand the associated metadata.

It seems critical to me to put a limit on what can be expressed with the metadata (we certainly wouldn't want a metadata saying "any memory access to this variable is volatile", do we?). I'm afraid we're on a slippery slope, and https://reviews.llvm.org/D29104 is going in this direction.


https://reviews.llvm.org/D29110





More information about the llvm-commits mailing list