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

Philip Pfaffe via llvm-dev llvm-dev at lists.llvm.org
Tue Feb 14 04:10:01 PST 2017


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>


More information about the llvm-dev mailing list