running optimization pass in lli tool


I’m currently trying to implement a new loop optimization pass in the LLVM.

Till now, I’m using the ‘opt’ tool to run my pass. But, I need to include my pass in the MCJIT pass sequence.

I can’t find a command option in the ‘lli’ tool to include any loop optimization pass.

For example, I can’t include the ‘-loop-rotate’ pass in JIT to be performed at runtime.

In my case, does it require a code modification? Where?

Please advice

Sara Elshobaky


If I'm interpreting your question correctly, I believe you may be misinterpreting the intended usage of MCJIT. Generally, you would run your chosen collection of function passes before passing the Module to MCJIT to compile. MCJIT does have an OptLevel, but this controls relatively low level optimizations during code generation not high level transforms like your describing.

I'd recommend taking a look at examples/Kaleidoscope/MCJIT/complete/toy.cpp for an example of how this can be structured.