[llvm-dev] CFLAndersAliasAnalysis print implementation

Kenneth Adam Miller via llvm-dev llvm-dev at lists.llvm.org
Tue May 22 09:50:42 PDT 2018


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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180522/2bc245ba/attachment.html>


More information about the llvm-dev mailing list