LoopInfo analysis in CallGraphSCCPass

Hi,

How to get the LoopInfo analysis in a CallGraphSCCPass ?

Thanks,
Vinay

This is not currently supported by the LLVM pass manager system. It is a serious deficiency that I (and others) would like to address, but it requires significant changes to the pass manager and analysis dependency system.

I have some dim hope of working on fixing this limitation, but it won’t be quick. ;]

Hi,
Is it possible to recreate the LoopInfo analysis in my pass?

Thanks ,
Vinay

Hi,
   Is it possible to recreate the LoopInfo analysis in my pass?

No. You need your pass to be a FunctionPass in order to use the LoopInfo
(and associated) analyses.

A ModulePass can also use the LoopInfo analysis (and other function passes). Use “getAnalysis(Function);” to get analysis T for a given Function.

That means you could write your pass as a ModulePass and use the CallGraph and LoopInfo directly.

You can also cheat and write two passes, one CallGraphSCCPass which depends on a ModulePass. The ModulePass depends on LoopInfo and offers a single getter that returns LoopInfo for the Function you ask it for. This is hackery that you won’t be able to land in upstream.

Nick