Accessing Function analyses in a Module pass with the new pass manager

Hello

With the legacy pass manager, we could invoke a Function Pass within the runOnModule() of a Module Pass by simply passing the Function reference to the getAnalysis<>() method. Can the same be achieved using the new Pass Manager? I am writing a Module Pass which requires to access analyses for the different functions, and I need the new pass manager because I need different copies of the same analysis to be valid at the same time, for different functions in the module (my understanding was that the new pass manager can do that whereas the legacy pass manager would only keep the last instance that was invoked).

Thanks

-Adel

You shouldn’t be running a non-analysis pass from another pass, and the NPM doesn’t allow for that. If you want to do some transforms, use some utility function. For example, use SplitAllCriticalEdges() instead of running BreakCriticalEdgesPass.

Does that answer your question? What exactly are you trying to do?

Sorry I forgot to reply. I figured it out shortly after sending out my email that I can use FunctionAnalysisManagerModuleProxy to get a FunctionAnalysisManager from the ModuleAnalysisManager.

-Adel