[cfe-dev] [LLVMdev] [RFC] Module Flags Metadata
gohman at apple.com
Thu Jan 26 11:15:20 PST 2012
On Jan 24, 2012, at 3:39 PM, Devang Patel wrote:
>>> 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.
However, this isn't necessarily true. For example, it would seem to be
within the spirit of LLVM's metadata design to describe the range of values
that a given instruction might have. However, if the optimizer mutates the
instruction (and preserves program correctness by mutating its operand
instructions to compensate), then that metadata could easily become
incorrect. Right now, there aren't any rules about what metadata can do,
or what optimizers must do to preserve it. It's sort of the
"head in the sand" level of conceptual maturity.
More information about the cfe-dev