[llvm-commits] [llvm] r91497 - in /llvm/trunk: include/llvm/Metadata.h lib/VMCore/Metadata.cpp

Chris Lattner clattner at apple.com
Thu Dec 17 00:06:03 PST 2009


On Dec 16, 2009, at 10:56 AM, Devang Patel wrote:

>>> 
>>> Is this new field copied by MetadataContextImpl::copyMD?
>> 
>> The semantic is that if an MDNode is created function-local, then it will continue to be function-local even if its operands are modified to no longer refer to any function-specific IR.
> 
> That'll break MDNode unique-ness.

We don't guarantee MDNode uniqueness, we just endeavor to preserve it when it isn't "too hard".

> Adding Function * in MDNode increases size of nodes and I anticipate that vast majority of nodes are not function local. A better approach is to let utility function isFunctionLocal() iterate  element and return respective Function *, if one or more elements are instructions.

I agree.  MDNode should just have a *bit* that indicates whether it is function local (stored in SubclassData) and have a (slow) method that gets the Function* it is in by (recursively) walking the operands.  This method won't be called by much more than the verifier.

-Chris 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20091217/b8804445/attachment.html>


More information about the llvm-commits mailing list