[LLVMdev] New inliner metrics

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Jan 26 15:33:30 PST 2010


I have just committed r94615 which changes how the cost of inlining a function is calculated.
Mostly I have changed constants so the metrics are closer to reality.

If you are suddenly losing performance on an important benchmark, it may be because something is not getting inlined any more.

If your -Os binaries are suddenly a lot smaller, that was probably the inliner too.

The new metrics should be more accurate, particularly for small functions. I have calculated the old and new inlining cost for almost 100000 call sites in the test suite, results plotted below:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: oldtonew.pdf
Type: application/pdf
Size: 38721 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100126/2067728e/attachment.pdf>
-------------- next part --------------

The band of red colors just above the diagonal show that the typical call site now has a cost 25 points higher, but some are 200 points higher. Very few call sites get a lower cost - the old calculations were rather optimistic.

The cost number corresponds more or less to bytes in the output, at least for x86_64


More information about the llvm-dev mailing list