[LLVMdev] Inlining into a big function

Chris Lattner clattner at apple.com
Mon Mar 8 20:28:53 PST 2010


On Mar 8, 2010, at 7:17 PM, Jakob Stoklund Olesen wrote:

> Hi,
> 
> The InlineCostAnalyzer has contained this since it was created:
> 
> +  // Don't inline into something too big, which would make it bigger.  Here, we
> +  // count each basic block as a single unit.
> +  //
> +  InlineCost += Caller->size()/20;
> 
> It discourages inlining into very big functions. (100 basic blocks in the caller = 1 instruction in the callee.) Does anybody remember the rationale behind that heuristic?
> 
> I am currently looking at a very big function with enough basic blocks that the heuristic effectively disables inlining at -Os. Even for trivial functions that would shrink the size of the function!

No, it seems reasonable to zap it.  The only reason I can imagine for something like this is to prevent compile time explosion.

-Chris



More information about the llvm-dev mailing list