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

Jeffrey Yasskin jyasskin at google.com
Tue May 26 15:15:46 PDT 2009


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?

Thanks,
Jeffrey



More information about the llvm-dev mailing list