[LLVMdev] AliasAnalysis calling failed in Pass interaction

Shen Liu shl413 at lehigh.edu
Wed Apr 29 13:27:05 PDT 2015


Dear LLVM developers,

I am Shen, a PhD student at Lehigh Univ. PA.  Now I am implementing a
Program Dependence Graph(PDG) on LLVM. I have 4 passes here:

1. ProgramDependenceGraph (a *ModulePass *on the highest level)
2. DataDependenceGraph (a Intermediate *FunctionPass*).
3. FlowDependenceAnalysis Pass (a intermediate *FunctionPass*) which uses
llvm built-in AliasAnalysis (-basicaa)
4. AliasAnalysis Pass  (LLVM built-in Pass)

When my call chain is

DatadependenceGraph <-- FlowDependenceAnalysis <-- AliasAnalysis

everything is fine and basicaa is executed successfully.

My problem is, *when I use a Module Pass to call a Function Pass, the low
level AliasAnalysis does not work anymore*, all return values for location
comparisons are "May Alias". In other words, the call chain

ProgramDependenceGraph(Module Pass) <-- DatadependenceGraph(*Function Pass*)
<-- FlowDependenceAnalysis <-- AliasAnalysis if failed.

However, if *I change ProgramDependenceGraph into a Function Pass, this
call chain works and AliasAnalysis can be executed successfully.*

So, i guess there may be an error in my interaction between Module Pass and
Function Pass. Could you give me some hints to help me solve it? Thank you
very much!


Here are some key code for Pass interaction in my implementation:

bool ProgramDependencyGraph::*runOnModule*(Module &M)
{
 ...
  for(Module::iterator F = M.begin(), E = M.end(); F != E; ++F)
    {
       DataDependencyGraph &ddgGraph = getAnalysis<DataDependencyGraph>(*F);
       ....
    }
}

...
void ProgramDependencyGraph::getAnalysisUsage(AnalysisUsage &AU) const
{
   ...
  AU.addRequired<DataDependencyGraph>();
  AU.setPreservesAll();
}


Best Regards,

Shen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150429/209bc629/attachment.html>


More information about the llvm-dev mailing list