[LLVMdev] Wondering how best to run inlining on a single function.

Devang Patel devang.patel at gmail.com
Mon Jun 1 10:19:23 PDT 2009


Hi Jeffrey,

On Tue, May 26, 2009 at 3:15 PM, Jeffrey Yasskin <jyasskin at google.com> wrote:
> In Unladen Swallow we (intend to) compile each function as we
> determine it's hot. To "compile" a function means to translate it from
> CPython bytecode to LLVM IR, optimize the IR using a
> FunctionPassManager, and JIT the IR to machine code. We'd like to
> include inlining among our optimizations. Currently the Inliner is a
> CallGraphSCCPass, which can only be run by the (Module)PassManager and
> which will try to inline calls into every function in the module,
> including functions we've already optimized. This seems like it will
> waste time.
>
> I think that, because we optimize every Python function as we generate
> it, it makes sense to write a SingleFunctionInliner (is there a better
> name?) that acts as a FunctionPass and add that to our normal
> FunctionPassManager. Can you guys see anything that will go wrong if I
> do that? Is there a better way, or an option that doesn't involve
> writing new code?

Try BasicInliner  from lib/Transforms/Utils/BasicInliner.cpp
-
Devang



More information about the llvm-dev mailing list