Syed Rafiul Hussain via llvm-dev
2016-Jan-22 05:05 UTC
[llvm-dev] LLVM - getAnalysisUsage()
Hi, I am using llvm-3.8 for my project. Following is my getAnalysisUsage() method: virtual void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); AU.addRequired<X>(); AU.addRequired<Y>(); AU.addRequired<Z>(); } Now, if I call getAnalysis<X>(*F), instead of invoking just the X pass, all the passes, i.e., X, Y and Z are being invoked. Could anyone help me in this regard? Thanks -- Syed
Does analysis X require X, Y, and Z itself? On Thu, Jan 21, 2016 at 9:05 PM, Syed Rafiul Hussain via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi, > > I am using llvm-3.8 for my project. Following is my getAnalysisUsage() > method: > > virtual void getAnalysisUsage(AnalysisUsage &AU) const override > { > AU.setPreservesAll(); > AU.addRequired<X>(); > AU.addRequired<Y>(); > AU.addRequired<Z>(); > } > > Now, if I call getAnalysis<X>(*F), instead of invoking just the X > pass, all the passes, i.e., X, Y and Z are being invoked. Could anyone > help me in this regard? > > Thanks > > -- > Syed > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160122/e33fbd55/attachment.html>
Syed Rafiul Hussain via llvm-dev
2016-Jan-22 16:46 UTC
[llvm-dev] LLVM - getAnalysisUsage()
No, X, Y and Z are independent to each other. On Fri, Jan 22, 2016 at 11:20 AM, Daniel Berlin <dberlin at dberlin.org> wrote:> Does analysis X require X, Y, and Z itself? > > > On Thu, Jan 21, 2016 at 9:05 PM, Syed Rafiul Hussain via llvm-dev > <llvm-dev at lists.llvm.org> wrote: >> >> Hi, >> >> I am using llvm-3.8 for my project. Following is my getAnalysisUsage() >> method: >> >> virtual void getAnalysisUsage(AnalysisUsage &AU) const override >> { >> AU.setPreservesAll(); >> AU.addRequired<X>(); >> AU.addRequired<Y>(); >> AU.addRequired<Z>(); >> } >> >> Now, if I call getAnalysis<X>(*F), instead of invoking just the X >> pass, all the passes, i.e., X, Y and Z are being invoked. Could anyone >> help me in this regard? >> >> Thanks >> >> -- >> Syed >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-- Rafi
> On Jan 21, 2016, at 9:05 PM, Syed Rafiul Hussain via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi, > > I am using llvm-3.8 for my project. Following is my getAnalysisUsage() method: > > virtual void getAnalysisUsage(AnalysisUsage &AU) const override > { > AU.setPreservesAll(); > AU.addRequired<X>(); > AU.addRequired<Y>(); > AU.addRequired<Z>(); > } > > Now, if I call getAnalysis<X>(*F), instead of invoking just the X > pass, all the passes, i.e., X, Y and Z are being invoked. Could anyone > help me in this regard?This is expected. With the current pass manager, the scheduling is done upfront. The “addRequired” directive tells the pass manager that before even starting to run your pass, it needs to schedule X, Y, and Z. They will run even without the call to getAnalysis<X>(*F). The new pass manager (not complete yet but almost) will change that. When running your pass with opt, you can add —debug-pass=Structure to see what the scheduling is. I hope I didn’t misunderstand your question. — Mehdi
Syed Rafiul Hussain via llvm-dev
2016-Jan-22 20:49 UTC
[llvm-dev] LLVM - getAnalysisUsage()
I have added -debug-pass=Structure, and found the following: ModulePass Manager X Analysis Unnamed pass: implement Pass::getPassName() FunctionPass Manager Module Verifier Bitcode Writer Pass Arguments: -x -y -z FunctionPass Manager X Analysis Y Construction Z Construction Even for getAnalysis<Y>(*F) and getAnalysis<Z>(&F), all the passes X, Y, Z are executed again. In total there are three places where getAnalysis() directive has been used for X, Y, Z. However, for each getAnalysis() call, all three passes are scheduled/executed. On Fri, Jan 22, 2016 at 12:24 PM, Mehdi Amini <mehdi.amini at apple.com> wrote:> >> On Jan 21, 2016, at 9:05 PM, Syed Rafiul Hussain via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> >> Hi, >> >> I am using llvm-3.8 for my project. Following is my getAnalysisUsage() method: >> >> virtual void getAnalysisUsage(AnalysisUsage &AU) const override >> { >> AU.setPreservesAll(); >> AU.addRequired<X>(); >> AU.addRequired<Y>(); >> AU.addRequired<Z>(); >> } >> >> Now, if I call getAnalysis<X>(*F), instead of invoking just the X >> pass, all the passes, i.e., X, Y and Z are being invoked. Could anyone >> help me in this regard? > > This is expected. With the current pass manager, the scheduling is done upfront. The “addRequired” directive tells the pass manager that before even starting to run your pass, it needs to schedule X, Y, and Z. > They will run even without the call to getAnalysis<X>(*F). The new pass manager (not complete yet but almost) will change that. > > When running your pass with opt, you can add —debug-pass=Structure to see what the scheduling is. > > I hope I didn’t misunderstand your question. > > — > Mehdi >-- Rafi