[LLVMdev] [RFC] Module Flags Metadata

Dan Gohman gohman at apple.com
Mon Jan 30 15:50:43 PST 2012


On Jan 30, 2012, at 11:59 AM, Devang Patel wrote:
> 
> On Jan 30, 2012, at 11:34 AM, Dan Gohman wrote:
> 
>> Even if we single out TBAA, recall that TBAA was one of the main
>> motivations for the design of MDNodes -- it's in the second sentance,
>> and most of the last paragraph, of
>> http://blog.llvm.org/2010/04/extensible-metadata-in-llvm-ir.html
> 
> ... and in last paragraph the author says ...  
>  "This use of metadata is also safe, because it is an optimization: if the type tag gets dropped, it is always safe to assume that the access aliases everything for TBAA purposes."
[…]
> What I fail to understand is why can't you use Constant, GlobalVariable, OptDataNode (or TBAANode or something like that)  ? Why insist on MDNode ?
[…]
> In fact, are you suggesting that it is not possible to implement TBAA without using MDNode ?


The the rest of the paragraph you quoted above describes how to
implement TBAA in LLVM. The current implementation of TBAA in
LLVM follows this, in every detail.

The sentence you quote claims that this approach is safe. The
current implementation is indeed safe in the sense discussed in
the blog entry: if metadata gets dropped, or if only some of it
gets dropped, the TBAA pass does behave conservatively.

However, while this is necessary for saftey, it is not sufficient.
The blog post does not discuss saftey in the case where metadata
has *not* been dropped when it needed to be.

The only way to make it safe is to make all optimization passes
aware of it, at least in some way. I know that the blog entry
says this wouldn't be needed, but it's wrong.

Dan





More information about the llvm-dev mailing list