[LLVMdev] Alias Analysis accuracy
Eli Friedman
eli.friedman at gmail.com
Fri Sep 21 15:18:07 PDT 2012
On Fri, Sep 21, 2012 at 3:08 PM, Welson Sun <welson.sun at gmail.com> wrote:
> OK, with the restrict type qualifier, it is a little bit better:
>
> The IR's function signature becomes:
> define void @foo(i32* noalias %a, i32* noalias %b, i32* noalias %c) nounwind
> {
>
> Now the AA result:
> Function: foo: 13 pointers, 0 call sites
> NoAlias: i32* %a, i32* %b
> NoAlias: i32* %a, i32* %c
> NoAlias: i32* %b, i32* %c
> NoAlias: i32* %a, i32** %a_addr
> NoAlias: i32* %b, i32** %a_addr
> NoAlias: i32* %c, i32** %a_addr
> NoAlias: i32* %a, i32** %b_addr
> NoAlias: i32* %b, i32** %b_addr
> NoAlias: i32* %c, i32** %b_addr
> NoAlias: i32** %a_addr, i32** %b_addr
> NoAlias: i32* %a, i32** %c_addr
> NoAlias: i32* %b, i32** %c_addr
> NoAlias: i32* %c, i32** %c_addr
> NoAlias: i32** %a_addr, i32** %c_addr
> NoAlias: i32** %b_addr, i32** %c_addr
> NoAlias: i32* %a, i32* %i
> NoAlias: i32* %b, i32* %i
> NoAlias: i32* %c, i32* %i
> NoAlias: i32* %i, i32** %a_addr
> NoAlias: i32* %i, i32** %b_addr
> NoAlias: i32* %i, i32** %c_addr
> MayAlias: i32* %0, i32* %a
> MayAlias: i32* %0, i32* %b
> MayAlias: i32* %0, i32* %c
> NoAlias: i32* %0, i32** %a_addr
> NoAlias: i32* %0, i32** %b_addr
> NoAlias: i32* %0, i32** %c_addr
> NoAlias: i32* %0, i32* %i
> MayAlias: i32* %3, i32* %a
> MayAlias: i32* %3, i32* %b
> MayAlias: i32* %3, i32* %c
> NoAlias: i32* %3, i32** %a_addr
> NoAlias: i32* %3, i32** %b_addr
> NoAlias: i32* %3, i32** %c_addr
> NoAlias: i32* %3, i32* %i
> PartialAlias: i32* %0, i32* %3
> MayAlias: i32* %5, i32* %a
> MayAlias: i32* %5, i32* %b
> MayAlias: i32* %5, i32* %c
> NoAlias: i32* %5, i32** %a_addr
> NoAlias: i32* %5, i32** %b_addr
> NoAlias: i32* %5, i32** %c_addr
> NoAlias: i32* %5, i32* %i
> MayAlias: i32* %0, i32* %5
> MayAlias: i32* %3, i32* %5
> MayAlias: i32* %8, i32* %a
> MayAlias: i32* %8, i32* %b
> MayAlias: i32* %8, i32* %c
> NoAlias: i32* %8, i32** %a_addr
> NoAlias: i32* %8, i32** %b_addr
> NoAlias: i32* %8, i32** %c_addr
> NoAlias: i32* %8, i32* %i
> MayAlias: i32* %0, i32* %8
> MayAlias: i32* %3, i32* %8
> PartialAlias: i32* %5, i32* %8
> MayAlias: i32* %11, i32* %a
> MayAlias: i32* %11, i32* %b
> MayAlias: i32* %11, i32* %c
> NoAlias: i32* %11, i32** %a_addr
> NoAlias: i32* %11, i32** %b_addr
> NoAlias: i32* %11, i32** %c_addr
> NoAlias: i32* %11, i32* %i
> MayAlias: i32* %0, i32* %11
> MayAlias: i32* %11, i32* %3
> MayAlias: i32* %11, i32* %5
> MayAlias: i32* %11, i32* %8
> MayAlias: i32* %14, i32* %a
> MayAlias: i32* %14, i32* %b
> MayAlias: i32* %14, i32* %c
> NoAlias: i32* %14, i32** %a_addr
> NoAlias: i32* %14, i32** %b_addr
> NoAlias: i32* %14, i32** %c_addr
> NoAlias: i32* %14, i32* %i
> MayAlias: i32* %0, i32* %14
> MayAlias: i32* %14, i32* %3
> MayAlias: i32* %14, i32* %5
> MayAlias: i32* %14, i32* %8
> PartialAlias: i32* %11, i32* %14
>
> a, b and c are no longer alias, as expected. However, they all may alias to
> %0. I guess basicaa doesn't handle data flow analysis?
No. Try running mem2reg.
-Eli
More information about the llvm-dev
mailing list