[PATCH] D22261: [InlineCost] Set minsize inline threshold to 0

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 28 05:14:34 PDT 2016


jmolloy added a comment.

Hi Chandler,

We discussed this on IRC and you were suspicious of my numbers. I was too, so I did more re-running. It turns out that CMake was appending -O3 to all of my builds, so the numbers I got were completely worthless.

Having done a *lot* more testing, I can confirm that purely setting the threshold to zero causes significant code size regressions. I've looked at these and 99% of them are in C++ code. It turns out that although we were giving a bonus for inlining the last call to an internal function, we weren't doing the same for linkonce_odr functions which is what C++ templates become. This is what was causing our bloat.

Ideally, we'd teach the inliner to much more accurately determine the overall expansion of a tree of thunks and tiny template expansions. However simply giving a bonus bump to linkonce_odr functions in the same way as internal functions appears to do the trick quite well.

With this change I see a geomean codesize *improvement* of 2.3% on the test-suite, and that excludes the TSVC benchmarks that improve so massively that they skew the results. Without the linkonce_odr bonus (simply setting the threshold to 0) I see a codesize *regression* of 2.9%.

I will of course split these up into two separate patches for committing but thought they'd be easier to review as one.

Cheers,

James


Repository:
  rL LLVM

https://reviews.llvm.org/D22261





More information about the llvm-commits mailing list