Counting the number of LLVM instructions executed dynamically using LLI
clang, llvm, llvm-clang, llvm-ir
Solution
There's no built-in way in LLVM to do this, AFAIK. However, you have a number of simple options:
- You can hack the interpreter (which `lli` can run) to count how many instructions it executed.
- You can instrument the IR before running it by incrementing a counter on entry to each basic block. Then you can run the instrumented IR through either the interpreter or JIT.
Problem
I wanted to count the number of LLVM instruction executed dynamically in any program, using lli 3.4. I checked this link, but it's not giving any information related to instruction count.