[LLVMdev] Inlining in LLVM

Dale Johannesen dalej at apple.com
Sun Oct 24 17:11:23 PDT 2010


A static function with a single invocation gets a very high weight in  
the inlining heuristics.  But a sufficiently large function still  
won't get inlined (not sure I've ever seen this in practice), and we  
don't know how to inline some functions, such as those that use  
varargs.  There are also more complicated cases (I'm not sure we check  
for this one; it's come up at least twice in practice, but that was  
before llvm came along, and I think the source was hacked to work  
around the problem in both cases):
   a() {  char x[10000000]; ....}
   b() {  a();  .... b();  .... }
It's probably a bad idea to inline a() even if the call shown is the  
only one; it won't take many recursive calls to b() to blow the stack.

On Oct 24, 2010, at 10:44 AM, Duncan Sands wrote:

> Hi Nelson,
>
>> What I am trying to find out is if functions that have a single  
>> invocation are
>> still found in the code during the compilation.
>
> I'm pretty sure that static functions with a single invocation are  
> always
> inlined.  If doing link-time optimization, then pretty much any  
> function
> with a single invocation will be inlined.
>
> I'm not sure what this has to do with "early inlining".
>
> Ciao,
>
> Duncan.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list