[llvm-dev] CFLAndersAliasAnalysis print implementation

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[llvm-dev] CFLAndersAliasAnalysis print implementation

Tim Northover via llvm-dev
Hello all,

I'm having trouble getting this analysis to print out it's graph of aliases. I am processing an example C file into llvm ir, like this:

int main(void) {
  int x=1, y=2, z=3;
  int *p;
  int **p1, **p2;
  if (x==z) { //0x100000f40
    p=&x;
    p1=&p;
    x*=2;
    *p1+=z;
  }
}

clang -S -emit-llvm example.c -o example.ll

Then, I am trying to run the Andersen alias analysis on it:

opt -analyze --cfl-anders-aa -aa example.ll

I wrote a new print function for the anders alias analysis, and the print function parameter Module *M and the Result calculated each indicate that there are no aliases. I'm certain I'm missing something, but I don't know what. To be absolutely clear, a Result is calculated of type:

  std::unique_ptr<CFLAndersAAResult> Result;

And CFLAndersAAResult contains member fields:

  DenseMap<const Function *, Optional<FunctionInfo>> Cache;

  std::forward_list<cflaa::FunctionHandle<CFLAndersAAResult>> Handles;

The DenseMap Cache is empty, and so is Handles. 

I can do -print-alias-sets, and that prints something, but I don't think it's the result of the Andersen analysis. Because when I do commands with --cfl-anders-aa taken out, I still get the same alias sets.

Can anybody help me get the Andersen alias results?

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] CFLAndersAliasAnalysis print implementation

Tim Northover via llvm-dev
Ok, the command necessary to get past this is:

opt ./example.ll  -disable-basicaa -cfl-anders-aa -aa-eval -disable-output -print-alias-sets

It was non-intuitive, because I thought turning on cfl-anders-aa would also enable printing the alias sets automatically. It also helps to add this flag: -mem2reg



On Tue, May 22, 2018 at 12:50 PM, Kenneth Adam Miller <[hidden email]> wrote:
Hello all,

I'm having trouble getting this analysis to print out it's graph of aliases. I am processing an example C file into llvm ir, like this:

int main(void) {
  int x=1, y=2, z=3;
  int *p;
  int **p1, **p2;
  if (x==z) { //0x100000f40
    p=&x;
    p1=&p;
    x*=2;
    *p1+=z;
  }
}

clang -S -emit-llvm example.c -o example.ll

Then, I am trying to run the Andersen alias analysis on it:

opt -analyze --cfl-anders-aa -aa example.ll

I wrote a new print function for the anders alias analysis, and the print function parameter Module *M and the Result calculated each indicate that there are no aliases. I'm certain I'm missing something, but I don't know what. To be absolutely clear, a Result is calculated of type:

  std::unique_ptr<CFLAndersAAResult> Result;

And CFLAndersAAResult contains member fields:

  DenseMap<const Function *, Optional<FunctionInfo>> Cache;

  std::forward_list<cflaa::FunctionHandle<CFLAndersAAResult>> Handles;

The DenseMap Cache is empty, and so is Handles. 

I can do -print-alias-sets, and that prints something, but I don't think it's the result of the Andersen analysis. Because when I do commands with --cfl-anders-aa taken out, I still get the same alias sets.

Can anybody help me get the Andersen alias results?


_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev