[LLVMdev] Inlining functions across modules when using MCJIT

Zach Devito zdevito at stanford.edu
Thu Mar 20 14:10:52 PDT 2014


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.

For more context, I am working on adding support for MCJIT to Terra (
http://terralang.org/), 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.

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.

Thanks,

Zach
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140320/50819c80/attachment.html>


More information about the llvm-dev mailing list