[LLVMdev] alias information on machine instructions
Chris Lattner
sabre at nondot.org
Thu Jun 21 12:20:46 PDT 2007
On Fri, 15 Jun 2007, Florian Brandner wrote:
> i have extended the DAG instruction selector and scheduler to preserve
> Value*'s. the values are attached to machine instructions as a separate
> operand list (at least for now). for now this looks very good.
>
> but i found that the alias analysis is not as good as expected. the
> problem seems to be the codegenprepare pass. GEP instructions are
> lowered to integer calculations (e.g. ptrtoint, add, inttoptr). this
> causes the (basic) alias analysis to answer MayAlias for most queries.
cool!
> this is also a problem for the DAG combiner, when the
> -combiner-global-alias-analysis switch is given to llc.
>
> any ideas how to handle this?
Probably the best way is to enhance the LSR pass to insert GEP
instructions instead of pointer arithmetic. For example, turn this:
for (int i = 0...; ++i)
A[i] = 0;
into the equivalent of this:
for (int i = 0, *p = &A[0]; ...; ++i, ++p)
*p = 0;
Inside the loop, this turns into a:
next = getelementptr int* prev, 1
instead of a "cast, add 4, cast" sequence.
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list