Andreas Scherman via llvm-dev
2017-Feb-14 10:51 UTC
[llvm-dev] addRequired() + getAnalysis() for new / non-legacy pass manager
Hi! I am trying to extend the native AliasAnalysis of LLVM to use an external analysis pass. Doing this with the legacy pass manager works fine through calling addRequired() in the getAnalysisUsage and getAnalysis() in function runOnFunction(). In the new pass manager, I haven't found a similar way of doing this. When running opt with -O3, I encounter the following error:>Assertion `ResultPass && "getAnalysis*() called on an analysis that wasnot " "'required' by pass!"' failed. Changing to getAnalysisIfAvailable() makes the pass not crash, but then I assume I am not using the external analysis pass to its full extent. So, the question is as such: in order to use the external analysis pass, do I need to use some form of the same mechanism (addRequired() + getAnalysis()) for the new pass manager, or should it be enough to use it in the legacy using the wrapper pass? Appreciate any help! Andreas -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170214/b722178f/attachment.html>
Philip Pfaffe via llvm-dev
2017-Feb-14 12:10 UTC
[llvm-dev] addRequired() + getAnalysis() for new / non-legacy pass manager
Hi Andreas, in the new PM there is no equivalent for addRequired(). Because it implemented as a caching strategy, Analyses are just ran on demand if they're not available or have been invalidated. To get your AA pass into the battle, just add it to the AAManager that goes into your new-PM instance. The new PM is currently not the default in opt or clang. `opt -O3` will thus use the legacy PM. Additionally, as of yet there is no support for plugin passes in the new PM, as there was before (my patch hasn't made it through review yet). Best, Philip 2017-02-14 11:51 GMT+01:00 Andreas Scherman via llvm-dev < llvm-dev at lists.llvm.org>:> Hi! > > I am trying to extend the native AliasAnalysis of LLVM to use an external > analysis pass. Doing this with the legacy pass manager works fine through > calling addRequired() in the getAnalysisUsage and getAnalysis() in function > runOnFunction(). In the new pass manager, I haven't found a similar way of > doing this. When running opt with -O3, I encounter the following error: > > >Assertion `ResultPass && "getAnalysis*() called on an analysis that was > not " "'required' by pass!"' failed. > > Changing to getAnalysisIfAvailable() makes the pass not crash, but then I > assume I am not using the external analysis pass to its full extent. > > So, the question is as such: in order to use the external analysis pass, > do I need to use some form of the same mechanism (addRequired() + > getAnalysis()) for the new pass manager, or should it be enough to use it > in the legacy using the wrapper pass? > > Appreciate any help! > > Andreas > > _______________________________________________ > 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/20170214/9241c9a7/attachment.html>
Chandler Carruth via llvm-dev
2017-Feb-15 18:15 UTC
[llvm-dev] addRequired() + getAnalysis() for new / non-legacy pass manager
On Tue, Feb 14, 2017 at 4:10 AM Philip Pfaffe via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi Andreas, > > in the new PM there is no equivalent for addRequired(). >And perhaps most significantly, you don't call "getAnalysis" at all in the new PM... To get your AA pass into the battle, just add it to the AAManager that goes> into your new-PM instance. >Yep!> The new PM is currently not the default in opt or clang. `opt -O3` will > thus use the legacy PM. Additionally, as of yet there is no support for > plugin passes in the new PM, as there was before (my patch hasn't made it > through review yet). >I'm so sorry, I have totally lost track of this. Can you ping? We should get this moving.> > Best, > Philip > > 2017-02-14 11:51 GMT+01:00 Andreas Scherman via llvm-dev < > llvm-dev at lists.llvm.org>: > > Hi! > > I am trying to extend the native AliasAnalysis of LLVM to use an external > analysis pass. Doing this with the legacy pass manager works fine through > calling addRequired() in the getAnalysisUsage and getAnalysis() in function > runOnFunction(). In the new pass manager, I haven't found a similar way of > doing this. When running opt with -O3, I encounter the following error: > > >Assertion `ResultPass && "getAnalysis*() called on an analysis that was > not " "'required' by pass!"' failed. > > Changing to getAnalysisIfAvailable() makes the pass not crash, but then I > assume I am not using the external analysis pass to its full extent. > > So, the question is as such: in order to use the external analysis pass, > do I need to use some form of the same mechanism (addRequired() + > getAnalysis()) for the new pass manager, or should it be enough to use it > in the legacy using the wrapper pass? > > Appreciate any help! > > Andreas > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > > _______________________________________________ > 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/20170215/c337aa32/attachment.html>
Possibly Parallel Threads
- [LLVMdev] Error when using getAnalysis
- [LLVMdev] Error when using getAnalysis
- [LLVMdev] Assertion `ResultPass && "getAnalysis*() called on an analysis that was not " "'required' by pass!"' failed.
- [LLVMdev] getAnalysisIfAvailable<>(...)
- [LLVMdev] getAnalysis<LoopInfo> from ModulePass