[llvm-commits] [llvm] r94615 - in /llvm/trunk: include/llvm/Analysis/InlineCost.h lib/Analysis/InlineCost.cpp
Jakob Stoklund Olesen
stoklund at 2pi.dk
Tue Jan 26 15:48:23 PST 2010
On Jan 26, 2010, at 3:28 PM, Eric Christopher wrote:
>
> On Jan 26, 2010, at 3:21 PM, Jakob Stoklund Olesen wrote:
>
>> Own argument bonus: 20 -> 5
>> Outgoing argument penalty: 0 -> 5
>> Alloca bonus: 10 -> 5
>> Constant instr bonus: 7 -> 5
>> Dead successor bonus: 40 -> 5*(avg instrs/block)
>
> Aiee!
I know, I expect a lot of flak :-)
> So, what'd you test and how'd you figure it out? Platforms?
I tested on x86_64 only.
I measured the change in number of instructions generated when inlining a single call site at a time in the test suite. This produced around 100,000 data points.
Based on this data, it was fairly easy to find a first cost approximation:
cost = 5*(#instrs - 1 - #args + #outargs)
The other predictors are not very good. It was not easy to see the correlation between alloca load/stores and code size, but it is there if you squint. Same for constant instructions.
>> The new cost metrics are generaly 25 points higher than before, so we may need
>> to move thresholds.
>
> If this affects Os inlining then almost assuredly, we're barely inlining anything there - even in cases where it does save space.
Actually, -Os performance is what prompted the change. The old metrics would sometime inline functions under -Os that increased code size by 150 bytes or more. The new metrics should be more accurate and avoid doing things like that.
It would make sense to bump the -Os threshold from 50 to 75, I'll try to measure the performance impact.
More information about the llvm-commits
mailing list