[LLVMdev] LLVM Alias Analysis

Wan Zhiyuan wanzhiyuan at gmail.com
Thu Apr 9 21:40:04 PDT 2015


Hi John,
Thank you for your reply!

1) For the DSA points-to analysis, I have tried the DSA code from project
smack (https://github.com/smackers/smack).
It is surprising that DSA is less precise than basicaa when running on
bzip2.

Which version of DSA will you recommend If I would like to use DSA on llvm
3.5? If no such version, which one will be a good start to do further
improvement?


2) For other alias analyses, sorry for not attaching the bc file.
--------------------------------------------
Source code 'SimpleGEP.c'
--------------------------------------------
typedef struct {
        int *x;
        int y[20];
} Foo;

int main() {
        Foo foo;
        int index = 10;
        foo.x = &index;
        foo.y[2] = 10;
        return 0;
}

--------------------------------------------
Compile command
--------------------------------------------
 clang -emit-llvm -c SimpleGEP.c -o SimpleGEP.bc
--------------------------------------------
The IR code 'SimpleGEP.bc'
--------------------------------------------
; ModuleID = 'SimpleGEP.bc'
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.Foo = type { i32*, [20 x i32] }

; Function Attrs: nounwind uwtable
define i32 @main() #0 {
entry:
  %retval = alloca i32, align 4
  %foo = alloca %struct.Foo, align 8
  %index = alloca i32, align 4
  store i32 0, i32* %retval
  store i32 10, i32* %index, align 4
  %x = getelementptr inbounds %struct.Foo* %foo, i32 0, i32 0
  store i32* %index, i32** %x, align 8
  %y = getelementptr inbounds %struct.Foo* %foo, i32 0, i32 1
  %arrayidx = getelementptr inbounds [20 x i32]* %y, i32 0, i64 2
  store i32 10, i32* %arrayidx, align 4
  ret i32 0
}

attributes #0 = { nounwind uwtable "less-precise-fpmad"="false"
"no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"
"no-infs-fp-math"="false" "no-nans-fp-math"="false"
"stack-protector-buffer-size"="8" "unsafe-fp-math"="false"
"use-soft-float"="false" }

!llvm.ident = !{!0}

!0 = metadata !{metadata !"clang version 3.5.0 (tags/RELEASE_350/final)"}

Thank you!

Regards,
Zhiyuan

On Thu, Apr 9, 2015 at 11:45 PM, John Criswell <jtcriswel at gmail.com> wrote:

>  On 4/9/15 11:13 PM, Wan Zhiyuan wrote:
>
> Hi Xin,
> Thank you for your reply!
>
>
> There is the DSA points-to analysis in the poolalloc project.  It works
> with an older version of LLVM and will be more difficult to use, but it's a
> unification-based analysis.  Just be forewarned that it's not as accurate
> as it was when originally written (due to reduced field sensitivity due to
> changes to LLVM over time; it's a long story explained during another
> recent thread).
>
>
>  I have tried the 3 alias analyses you have mentioned on LLVM 3.5:
> 1) $ opt -globalsmodref-aa -aa-eval < xxx.bc > /dev/null
> (May-alias response 100%)
>  2) $ opt -tbaa -aa-eval < xxx.bc > /dev/null
> (May-alias response 100%)
> 3) $ opt -cfl-aa -aa-eval < xxx.bc> /dev/null
>  (Unknown command line argument '-cfl-aa')
>
>  It seems that they are not working properly. Could you please give some
> advice?
>
>
> That doesn't look right at all, but I'm not sure what's causing the
> issue.  That said, since we don't know how xxx.bc was created (or what it
> contains), it'll be hard for anyone to pinpoint the problem.
>
> Regards,
>
> John Criswell
>
>
>  And I was wondering if these alias analyses can produce alias results as
> precise as andersen or steensgaard.
>
>  Thank you!
>  Zhiyuan
>
> On Thu, Apr 9, 2015 at 10:19 PM, Xin Tong <trent.tong at gmail.com> wrote:
>
>> Hi Zhiyuan
>>
>> LLVM has globalsmodref-aa for global variables, TBAA - type based
>> alias analysis and CFL-AA.
>>
>> Xin
>>
>> On Tue, Apr 7, 2015 at 9:32 PM, Wan Zhiyuan <wanzhiyuan at gmail.com> wrote:
>> > Dear all,
>> > I was wondering if there are some reliable alias analyses build on top
>> of
>> > LLVM other than basicaa.
>> >
>> > Thank you!
>> >
>> > Zhiyuan
>> >
>>  > _______________________________________________
>> > LLVM Developers mailing list
>> > LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>> >
>>
>
>
>
> _______________________________________________
> LLVM Developers mailing listLLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.eduhttp://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
>
> --
> John Criswell
> Assistant Professor
> Department of Computer Science, University of Rochesterhttp://www.cs.rochester.edu/u/criswell
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150410/a5201fd4/attachment.html>


More information about the llvm-dev mailing list