[LLVMdev] Alias analysis and instruction level parallelism

Florian Brandner brandner at complang.tuwien.ac.at
Thu Apr 3 00:07:39 PDT 2008


On Wednesday 02 April 2008 11:54:26 Pertti Kellomäki wrote:
> Ah, that's right. I went back and read the discussion from
> January, and Florian Brandner explains there that the real
> culprit is the lowering of GEP in the codegen prepare pass.

codgenprepare rewrites GEP instructions into a sequence of PtrToInt casts, 
additions, multiplies and finally a IntToPtr cast. The basic alias analysis 
pass does not analyse pointers past an IntToPtr cast, and thus returns "may 
alias".

i have tried to overcome this. basically you only need to find the base object 
of the original GEP, but this is possible in some simple cases only. if 
pointer arithmetic is involved it is hard to distinguish between the GEP base 
and other calculations. you might even end up analyzing pointer calculations 
that did not originate from a GEP.

an other option would be to save the GEP instructions and provide a mapping 
between them and the lowered arithmetic. it's not very clean but it would be 
safe, and probably work well.

florian






More information about the llvm-dev mailing list