[LLVMdev] "Best" alias analysis algorithm

Chris Lattner sabre at nondot.org
Mon Apr 25 08:46:04 PDT 2005

On Mon, 25 Apr 2005, Vladimir Prus wrote:
> The 'i' variable is never modified in the program, however, all analyses
> except for -globalsmodref-aa report that the
>    	%tmp.3 = call int %_Z3bari( int %p )		; <int> [#uses=1]
> instruction can modify 'i'. I'm somewhat surprised, because it looks like
> -globalsmodref-aa is the simplest algorithm. So, why the order algorithms
> report possible modification?

That is because none of those algorithms are "context sensitive", and 
globals mod/ref is.  Out of those, globalsmodref-aa is the only one that 
will get it.

> In fact, if I add
>   %j = external global int		;
> which is not used *anywhere*, most algorithms report that %j is modified by
> the call. Am I missing something, or -globalsmodref-aa is the only alias
> analysis that properly handles globals?

This is just conservatism in the analysis and can probably be fixed.

You might also try -ds-aa, which is significantly more powerful than any 
of the rest.



More information about the llvm-dev mailing list