Use information generated by existing passes into new pass

Hi,
I want to ask is that can we use the information generated by existing passes into a new pass? If yes, then how ?
For example -loops gives the natural loop information, so can we use this information into new pass by calling it.

Hi Sunil,

I want to ask is that can we use the information generated by existing passes
into a new pass? If yes, then how ?
For example -loops gives the natural loop information, so can we use this
information into new pass by calling it.

in your pass's getAnalysisUsage method you use addRequired to specify that you
need a particular analysis, for example

     void MyPass::getAnalysisUsage(AnalysisUsage &AU) const {
...
       AU.addRequired<LoopInfo>();
...
     }

Then, to get hold of the analysis when your pass is being run, you can use
getAnalysis<LoopInfo>() .

Ciao, Duncan.