<div dir="ltr"><div>I was wondering if there is a way to perform inlining of a function from one module to another using the same cost model as the SimpleInliner. </div><div><br></div>For more context, I am working on adding support for MCJIT to Terra (<a href="http://terralang.org/">http://terralang.org/</a>), a low-level language embedded in Lua and based on LLVM.  When using the old JIT,  we performed inlining by keeping everything in one module, and used a modified version of SimpleInliner that would perform inlining on a single strongly-connected component rather than the entire module. Moving to MCJIT, it is relatively easy to manage multiple modules (one for each SCC), but I don't see an easy way to perform inlining across the modules. Since functions can be defined dynamically during evaluation of Lua, it is not possible for us to keep all functions that we want to consider for inlining in a single module. Some callee functions may have already been compiled and run before a caller is defined.<div>
<br></div><div>If there isn't a way to do this at the moment, I'd be willing to working on modifying the inliner it if it is something that could be merged into LLVM and kept up to date.</div><div><br></div><div>Thanks,</div>
<div><br></div><div>Zach</div></div>