[llvm-dev] How can I use llvm::LoopInfo in the runOnModule method?

Florian Hahn via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 3 09:56:37 PDT 2019

> On Apr 3, 2019, at 17:40, David Greene via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> I don't think one can reliably get a Function analysis pass from within
> a ModulePass using the legacy pass manager.  You have to manually
> construct the pass yourself.

That’s strange. AFAIK IPSCCP does exactly that for the DT analysis, see getAnalysis in 

Which is called for each function in the module:
  https://github.com/llvm/llvm-project/blob/master/llvm/lib/Transforms/Scalar/SCCP.cpp#L1960 <https://github.com/llvm/llvm-project/blob/master/llvm/lib/Transforms/Scalar/SCCP.cpp#L1960>

It does not seem like the legacy pass manager is able to preserve Function analyses from Module passes, whereas the new pass manager can, however.

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

More information about the llvm-dev mailing list