[LLVMdev] Wrong AliasAnalysis::getModRefInfo result

Welson Sun welson.sun at gmail.com
Thu Feb 16 14:34:40 PST 2012


Actually, with -basicaa, the alias result only makes sense for instructions
in the same scope:

  %9 = getelementptr inbounds i32* %8, i32 %7
-->  %13 = getelementptr inbounds i32* %12, i32 %11
May Alias

  %9 = getelementptr inbounds i32* %8, i32 %7
-->  %18 = getelementptr inbounds i32* %17, i32 %16
May Alias

  %9 = getelementptr inbounds i32* %8, i32 %7
-->  %8 = getelementptr inbounds [10 x i32]* %a, i32 0, i32 %7
May Alias

  %9 = getelementptr inbounds i32* %8, i32 %7
-->  %13 = getelementptr inbounds [10 x i32]* %a, i32 0, i32 0
May Alias

  %9 = getelementptr inbounds i32* %8, i32 %7
-->  %14 = getelementptr inbounds [10 x i32]* %b, i32 0, i32 0
May Alias

  %13 = getelementptr inbounds i32* %12, i32 %11
-->  %18 = getelementptr inbounds i32* %17, i32 %16
May Alias

  %13 = getelementptr inbounds i32* %12, i32 %11
-->  %8 = getelementptr inbounds [10 x i32]* %a, i32 0, i32 %7
May Alias

  %13 = getelementptr inbounds i32* %12, i32 %11
-->  %13 = getelementptr inbounds [10 x i32]* %a, i32 0, i32 0
May Alias

  %13 = getelementptr inbounds i32* %12, i32 %11
-->  %14 = getelementptr inbounds [10 x i32]* %b, i32 0, i32 0
May Alias

  %18 = getelementptr inbounds i32* %17, i32 %16
-->  %8 = getelementptr inbounds [10 x i32]* %a, i32 0, i32 %7
May Alias

  %18 = getelementptr inbounds i32* %17, i32 %16
-->  %13 = getelementptr inbounds [10 x i32]* %a, i32 0, i32 0
May Alias

  %18 = getelementptr inbounds i32* %17, i32 %16
-->  %14 = getelementptr inbounds [10 x i32]* %b, i32 0, i32 0
May Alias

  %8 = getelementptr inbounds [10 x i32]* %a, i32 0, i32 %7
-->  %13 = getelementptr inbounds [10 x i32]* %a, i32 0, i32 0
Partial Alias

  %8 = getelementptr inbounds [10 x i32]* %a, i32 0, i32 %7
-->  %14 = getelementptr inbounds [10 x i32]* %b, i32 0, i32 0
No Alias

  %13 = getelementptr inbounds [10 x i32]* %a, i32 0, i32 0
-->  %14 = getelementptr inbounds [10 x i32]* %b, i32 0, i32 0
No Alias


The real information I am after is the getModRefInfo() result, however,
even with AA turned on, the modref info is still useless for a function
call.
  call void @_Z3fooPiS_(i32* %13, i32* %14)
  %a = alloca [10 x i32], align 4
3
  %b = alloca [10 x i32], align 4
3


Are there any other projects or examples that use LLVM AA infrastructure to
perform array ModRef analysis?


Thanks,
Welson



On Thu, Feb 16, 2012 at 1:27 PM, Welson Sun <welson.sun at gmail.com> wrote:

> Thanks Duncan! You are right! If I type the command "opt -basicaa -mypass
> ...", then the output makes sense.
>
> Now, how can you specify which AA to use in the code?
>
>
> Regards,
> Welson
>
>
>
> On Thu, Feb 16, 2012 at 12:05 PM, Duncan Sands <baldrick at free.fr> wrote:
>
>> Hi Welson, the default alias analysis is -no-aa.  As the name suggests it
>> just returns MayAlias for everything.  Maybe you are using that one?
>>
>> Best wishes, Duncan.
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>
>
>
> --
> Welson
>
> Phone: (408) 418-8385
> Email:  welson.sun at gmail.com
>
>
>


-- 
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/20120216/41c202fc/attachment.html>


More information about the llvm-dev mailing list