Reputation: 21605
For LLVM Basic Blocks, represented by class BasicBlock
, how can I identify which nearest loop (if any) contains that block . And I want to identify this inside a runOnModule
pass.
Upvotes: 8
Views: 1691
Reputation: 6625
You can register an LoopInfo dependency and use getLoopFor(BasicBlock *BB):
Loop* llvm::LoopInfo::getLoopFor(const BasicBlock *BB) const
You can check the documentation in: http://llvm.org/doxygen/classllvm_1_1LoopInfo.html#a4abca289c73cd09487e05d11d9f7d877
Upvotes: 6