[LLVMdev] [cfe-dev] [RFC] Module Flags Metadata

Devang Patel dpatel at apple.com
Tue Jan 24 15:39:25 PST 2012


>> I have only one real comment -- this violates the contract and spirit of LLVM's metadata design. You're specifically encoding semantics in metadata, but the principle of metadata is that a program with all metadata stripped has the same behavior as one with the metadata still in place.


This is a simplified understanding of semantics. As I understand, the expected metadata design behavior is that optimizer/transformations are not responsible to preserve any _relationship_ between a User and a MDNode. For example, if a MDNode is  "using" a User then optimizer can remove the User without bothering about what happens to the MDNode. Same way, If MDNode is attached to an Instruction then optimizer can mutate, delete or replace the Instruction while completely ignoring attached MDNode. 

NamedMDNode is a simple collection of metadata nodes at module level. By design NamedMDNode does not have any uses and it can not directly hold any values (use any values)  other then MDNode, so there is not any reason for optimizer to worry about it.


>> 
>> I think what you're really talking about are Module-level attributes much like we have function attributes. These have inherently significant semantics, and must be handled explicitly, not simply dropped when unknown.
>> 
>> Anyways, that's my only real comment about the proposal. I think you need something other than metadata to encode this.
> 
> I had thought of that too (and having a module-level attribute scheme), but I was surprised when I found out that named metadata wasn't "strippable" from modules. (You can't strip them via the 'opt' command.) 

-
Devang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120124/866f4087/attachment.html>


More information about the llvm-dev mailing list