[LLVMdev] Alias Analysis accuracy

Welson Sun welson.sun at gmail.com
Fri Sep 21 15:49:48 PDT 2012


Great! That makes sense! Thank you!

On Fri, Sep 21, 2012 at 3:43 PM, Arnold Schwaighofer <
arnold.schwaighofer at gmail.com> wrote:

> You see the result for running basicaa after mem2reg.
>
> The IR after mem2reg will look like (you can look at it by doing
> -mem2reg -basicaa -aa-eval -print-all-alias-modref-info < test.ll
> -print-after-all)
>
> define void @_Z3fooPiS_S_(i32* noalias %a, i32* noalias %b, i32*
> noalias %c) nounwind {
> entry:
>   %"alloca point" = bitcast i32 0 to i32
>   br label %bb1
>
> bb:                                               ; preds = %bb1
>   %0 = sext i32 %i.0 to i64
>   %1 = getelementptr inbounds i32* %a, i64 %0
>   %2 = load i32* %1, align 1
>   %3 = sext i32 %i.0 to i64
>   %4 = getelementptr inbounds i32* %b, i64 %3
>   %5 = load i32* %4, align 1
>   %6 = add nsw i32 %2, %5
>   %7 = sext i32 %i.0 to i64
>   %8 = getelementptr inbounds i32* %c, i64 %7
>   store i32 %6, i32* %8, align 1
>   %9 = add nsw i32 %i.0, 1
>   br label %bb1
>
> bb1:                                              ; preds = %bb, %entry
>   %i.0 = phi i32 [ 0, %entry ], [ %9, %bb ]
>   %10 = icmp sle i32 %i.0, 9
>   br i1 %10, label %bb, label %bb2
>
> bb2:                                              ; preds = %bb1
>   br label %return
>
> return:                                           ; preds = %bb2
>   ret void
> }
>
>
> The results your are getting are correct.
>
> On Fri, Sep 21, 2012 at 5:22 PM, Welson Sun <welson.sun at gmail.com> wrote:
> > Here is the result of running mem2reg then basicaa, it is even worse: (%a
> > should be alias to %0, and partial alias to %3)
> >
> > opt -mem2reg -basicaa -aa-eval -print-all-alias-modref-info < foo.s >
> > /dev/null
> > Function: foo: 6 pointers, 0 call sites
> >   NoAlias:      i32* %a, i32* %b
> >   NoAlias:      i32* %a, i32* %c
> >   NoAlias:      i32* %b, i32* %c
> >   PartialAlias: i32* %1, i32* %a
> >   NoAlias:      i32* %1, i32* %b
> >   NoAlias:      i32* %1, i32* %c
> >   NoAlias:      i32* %4, i32* %a
> >   PartialAlias: i32* %4, i32* %b
> >   NoAlias:      i32* %4, i32* %c
> >   NoAlias:      i32* %1, i32* %4
> >   NoAlias:      i32* %8, i32* %a
> >   NoAlias:      i32* %8, i32* %b
> >   PartialAlias: i32* %8, i32* %c
> >   NoAlias:      i32* %1, i32* %8
> >   NoAlias:      i32* %4, i32* %8
> >
>



-- 
Welson

Phone: (408) 418-8385
Email:  welson.sun at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120921/efeeecc2/attachment.html>


More information about the llvm-dev mailing list