If you do not want to use the skip manager, you may need to call the analysis method in the llvm :: LoopInfoBase class for each IR function (provided that you use LLVM-3.4). However, the Analyze method accepts the DominatorTree of each function as an input signal that you must first generate. The following codes are the ones I tested with LLVM-3.4 (assuming you read the IR file and convert it to module *, named as a module):
for(llvm::Module::iterator func = module->begin(), y=module->end(); func!=y; func++){
Basically, generated by KLoop, you get all kinds of LOOP information at the IR level. See the API in the LoopInfoBase class for more details. By the way, you can add the following headers: "llvm / Analysis / LoopInfo.h" "llvm / Analysis / Dominators.h" .
source share