This is a simple LLVM Pass which will count all loops in given bit code (file.bc)
I used this llvm-project
To do this, you need to follow these steps
* clone this repo to your local machine
* Copy the LoopCntr file into PathToLLVMProject/llvm/lib/Transforms/
add following line into PathToLLVMProject/llvm/lib/Transforms/CMakeLists.txt
add_subdirectory(LoopCntr)
rebuild your llvm-project
run the pass with following command
$ PathToLLVMProject/build/bin/opt -load \
PathToLLVMProject/build/lib/LLVMLoopCntr.so \
-CountLoops < file.bc > /dev/null