how to get LoopInfo in FunctionPass in LLVM3.7.0

I want get some loop information(the methods are included in LoopInfo class) ,but when I use “const LoopInfo *LI=&getAnalysis()”, I got a compiler error.
the version of LLVM is 3.7.0.

can anyone help me?please give me some example.thank you!

You are not giving enough information to understand what your problem is , but chances are that you didn’t add the LoopInfo pass into the required passes of your pass

Cheers,
Marcello

Hi,

LoopInfo &LI = getAnalysis().getLoopInfo(); works for me. Hope this helps.

Regards,

Xiangyang