[llvm-dev] addRequired() + getAnalysis() for new / non-legacy pass manager

Andreas Scherman via llvm-dev llvm-dev at lists.llvm.org
Tue Feb 14 02:51:11 PST 2017


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!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170214/b722178f/attachment.html>

More information about the llvm-dev mailing list