[LLVMdev] Question regarding the alias analysis chaining behaviour

Nick Lewycky nicholas at mxc.ca
Wed Nov 24 12:50:51 PST 2010


dirac wrote:
> Hi,
>     I am using LLVM 2.4 on a Linux RHEL5 machine. I was trying to figure
> out how the chaining of the alias analysis passes works in LLVM. Here
> are the command I used to test the chaining part.
>   1.  ./opt hello_world_1_nest_func.bc -o hello_world_1_nest_func_AA.bc
> -no-aa -anders-aa -licm
>    Result: Anderson's AA and No Alias Analysis both are called.
>    2. ./opt hello_world_1_nest_func.bc -o hello_world_1_nest_func_AA.bc
> -basicaa -anders-aa -licm
>    Result: Anderson's AA and Basic AA both are called.
>    3. ./opt hello_world_1_nest_func.bc -o hello_world_1_nest_func_AA.bc
> -basicaa -licm
>    Result: Only Basic AA is called. (When I use -no-aa instead of
> -basicaa, only the NoAA is called).
>    4. ./opt hello_world_1_nest_func.bc -o hello_world_1_nest_func_AA.bc
> -basicaa -anders-aa -licm -licm
>    Result: First licm gets a mix of both AA passes (basic and anders),
> second licm only gets basic.
>    5. ./opt hello_world_1_nest_func.bc -o hello_world_1_nest_func_AA.bc
> -basicaa -anders-aa -licm -basicaa -anders-aa -licm
>    Result: Both licm instances get a mix of Anders and Basic AA.
>
>    Am I to conclude that the Anderson's Alias Analysis is only applied
> to LICM? and other passes which require alias analysis use BasicAA or
> NoAA depending which on which one is specified on the command line? Is
> this the reason I am seeing calls to different AAs when although I
> specify an AA which neither Basic nor No AA?
>
>    I read on llvm docs that it is not possible to actually specify one
> user-created alias analysis on the command line which is applied to all
> subsequent passes on the command line. Does this mean that there is a
> constraint on the command line user-created AA... which is that it only
> applies to the top-level pass (licm above) specified immediately after
> the user-created AA?

The AA that you specify will be created when you specify it and live 
until that pass is invalidated (not explicitly preserved by a pass that 
runs). The next time a pass requires AA, the pass manager will create 
the default AA (BasicAA) and not the one you put on the command line.

You can view what the pass manager is actually doing with "opt 
-debug-pass=Structure ...".

Nick

>    I read in the same llvm doc that the "superclass" (The main Alias
> Analysis pass I assume) decides which response to use when the
> user-defined AA overrides the default methods. However, in my current
> version, I don't see code for deciding between the two AAs. Is this an
> artifact of the older version I am using?
>
>    Thanks for your response.
>
> Rajesh
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list