how to choose which alias analysis used in my pass?

Hi,

   I want to use memory dependence analysis in my pass, but I feel the default alias analysis is not precise enough. How could I choose to use another alias analysis algorithm? I have tried opt -load mypass.so -basicaa xx.bc > /dev/null. But I feel the alias analysis algorithm does not change. Do I need to add something in my codes?

   Thanks a lot!

   Best,

                                                               Linhai

Isn’t -basicaa the default alias analysis already?

Jingyue

From: "Jingyue Wu" <jingyue@google.com>
To: "songlh" <songlh@cs.wisc.edu>, llvmdev@cs.uiuc.edu
Sent: Wednesday, October 15, 2014 2:50:12 PM
Subject: Re: [LLVMdev] how to choose which alias analysis used in my pass?

Isn't -basicaa the default alias analysis already?

No, -basicaa is added (along with several others) when -O3 (or similar) is provided, but you'll only get -noaa if you run opt without specifying anything else.

-Hal

I run the following command: opt -load MyPass.so -basicaa -MyPass ./test.bc -debug-pass=Structure -disable-output

Then I got:

Pass Arguments: -targetlibinfo -datalayout -notti -basictti -x86tti -no-aa -basicaa -Redundancy -preverify -domtree -verify
Target Library Information
Data Layout
No target information
Target independent code generator's TTI
X86 Target Transform Info
No Alias Analysis (always returns 'may' alias)
Basic Alias Analysis (stateless AA impl)
   ModulePass Manager
     Redundancy Checking
       Unnamed pass: implement Pass::getPassName()
     FunctionPass Manager
       Preliminary module verification
       Dominator Tree Construction
       Module Verifier
Pass Arguments: -no-aa -domtree -postdomtree -loops -memdep
No Alias Analysis (always returns 'may' alias)
   FunctionPass Manager
     Dominator Tree Construction
     Post-Dominator Tree Construction
     Natural Loop Information
     Memory Dependence Analysis

It looks to me that when loading MyPass, basicaa is not used. Do I make some mistakes in the opt parameters?

Thanks a lot!

Best,

Linhai

Yes, next to loading the pass you'll also have to add your pass to the list of passes to run.

For the hello example it is something like:

opt -load hello.so -hello input.bc

The option name is the first argument to the RegisterPass line IIRC.

Cheers,
  Roel