Inliner in legacy pass manager

Hi,

In following link:
https://www.youtube.com/watch?reload=9&v=6X12D46sRFw

They have specified that the inliner can’t use DomTree/LoopInfo/MemorySSA analysis.

  1. What’s the reason for this?

  2. Why can’t we do it using getAnalysisUsage() construct?

  3. Can inline use this information in the new Pass Manager?

  4. What all information can we derive from DomTree to be of help to inliner?

Regards
Sushant

In the old pass manager a coarser-grain pass cannot depend on a
fine-grain pass (or analysis). In this case, the coarser-grain is the
Inliner (CallGraphSCCPass) and the finer a FunctionPass. The reason is
that the finer-grain pass has its own "pass manager", i.e. it runs all
the passes and analysis (in that pass manager) on one function, frees
them, and continues with the next function until all functions in the
module have been process and only then gives control back to the
coarser-grain pass manger. That is, at this point, all the
FunctionPass analyses has been and is not available anymore.

There is a workaround for ModulePasses using FunctionPasses: The
ModulePassManager would run the FunctionPass on the requested function
(without the FunctionPassManager). But it will only hold the result
for one Function; if you request the analysis for a different
function, it will free the previous one.

This is not the primary reason for the introduction of the new pass
manager: The legacy pass manager could have been modified to not free
all analyses, but like the NPM keep a global map of all analyses run
so far that have not been invalidated yet.

Michael

Hi,

So, does this mean that in legacy pass manager, when I run:
PM.add( someFunctionPass() ) // PM is modulePassManager

it creates FunctionPassManager, runs the function pass,destroys the functionPassManager and returns control to modulePassManager?

Also, you have said that this wasn’t the primary reason for the introduction of the new pass manager. But then is this one of the reasons?

Regards
Sushant

So, does this mean that in legacy pass manager, when I run:
PM.add( someFunctionPass() ) // PM is modulePassManager
it creates FunctionPassManager, runs the function pass,destroys the functionPassManager and returns control to modulePassManager?

Yes.

Also, you have said that this wasn't the primary reason for the introduction of the new pass manager. But then is this one of the reasons?

See http://llvm.org/devmtg/2014-04/PDFs/Talks/Passes.pdf

Michael