[LLVMdev] AliasAnalysis calling failed in Pass interaction

Daniel Berlin dberlin at dberlin.org
Wed Apr 29 13:45:01 PDT 2015


On Wed, Apr 29, 2015 at 1:27 PM, Shen Liu <shl413 at lehigh.edu> wrote:
> 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)

Does this implement AliasAnalysis?

> 4. AliasAnalysis Pass  (LLVM built-in Pass)
>
> When my call chain is
>
> DatadependenceGraph <-- FlowDependenceAnalysis <-- AliasAnalysis
>
> everything is fine and basicaa is executed successfully.

BasicAA is not AliasAnalysis. BasicAA is *an* AliasAnalysis.

If you have not added BasicAliasAnalysis to the pass list, it will not
be called when you call AliasAnalysis API.

>
> 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();
> }
>

This does not require alias analysis or it's analysis group, which is
wrong if you want those to work?

>
> Best Regards,
>
> Shen
>
>
>
> _______________________________________________
> 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