[LLVMdev] AliasAnalysis calling failed in Pass interaction

Shen Liu shl413 at lehigh.edu
Wed Apr 29 14:05:23 PDT 2015


Hi Daniel, thanks for your reply! Yes I didn't implement AA by myself but
called builtin -basicaa interface for temporary use. Just add the -basicaa
option in my opt command.

I hope -basicaa can be called to process to check some simple aliases. And
when I do

DataDependencyGraph &ddgGraph = getAnalysis<DataDependencyGraph>(*F);

inside a Function Pass, it works.What make me confused is when my Pass is a
Module Pass, --basicaa cannot be called anymore. It seems the -basicaa
option cannot be seen by getAnalysis() if I call it in a Module Pass.

Do you have any suggestions?

Best Regards,

Shen



On Wed, Apr 29, 2015 at 4:45 PM, Daniel Berlin <dberlin at dberlin.org> wrote:

> 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
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150429/51a20527/attachment.html>


More information about the llvm-dev mailing list