[LLVMdev] "distinct" metadata nodes are ...?

Robinson, Paul Paul_Robinson at playstation.sony.com
Mon Apr 6 10:26:29 PDT 2015


I'm encountering a merge issue whose root cause has to do with "distinct"
metadata nodes.  I see that distinct-ness is an intentional concept, but
the explanation in the LLVM Language Reference is not very enlightening.

    distinct nodes are useful when nodes shouldn't be merged based on
    their content.

The notion of "merged" metadata is not discussed elsewhere on the page,
except for Objective-C garbage collection; I'm looking at debug location
metadata, so that's not relevant.

I understand that distinct-ness was invented as a replacement for a
self-reference hack, but that just begs the question. Why is this a
useful concept?  What is it used for?  Why shouldn't certain nodes be
merged based on their content?

My specific issue has to do with inlined-at chains.  If I have
    return inlined_func() + 1;
the inlined-at chain for inlined_func() [and whatever else is inlined
into inlined_func()] terminates in a node that is 'distinct' from the 
node for the calling statement, even though they describe the same 
source location.  This didn't used to be a problem, chasing the chain
ended up with something that compared equal to the calling statement's
source location.

Thanks,
--paulr





More information about the llvm-dev mailing list