[LLVMdev] Alias Analysis Problem in LICM

Dan Gohman gohman at apple.com
Fri Nov 4 09:12:30 PDT 2011


On Nov 4, 2011, at 8:37 AM, Anshuman Dasgupta wrote:

> On 11/4/2011 3:29 AM, Nick Lewycky wrote:
>> I suspect that GCC is doing option 2, or something else I haven't 
>> thought of (TBAA? if so, why doesn't our TBAA do as well?). 
> 
> Nick,
> 
> The problem is that LLVM's implementation of TBAA does not distinguish 
> between these two types: i32*** @AAA and i32** %arrayidx. We believe 
> that type based alias analysis should, in general, be able to figure out 
> that those two variables cannot meaningfully alias.

Yes.  The current TBAA implementation is conservative, with the idea that it
can become more aggressive (and with TBAA, this fundamentally means
"more dangerous") with incremental steps.

It's interesting to note that clang's own source code is known to violate the TBAA
rules for pointers (it's thought to be unlikely to cause trouble in practice).  There
are reasons for caution in this area.

Dan




More information about the llvm-dev mailing list