]> granicus.if.org Git - llvm/commit
[InlineCost] Reduce inline thresholds to compensate for cost changes
authorJames Molloy <james.molloy@arm.com>
Mon, 28 Nov 2016 11:07:37 +0000 (11:07 +0000)
committerJames Molloy <james.molloy@arm.com>
Mon, 28 Nov 2016 11:07:37 +0000 (11:07 +0000)
commit325cb7089c63aef3be826dfcd291f6d50811c15f
treefe7eebf22413f1965971a1412ae4fcc41bc35a86
parent0afff634e7550fd6569537fbf0ea33a39bbf8479
[InlineCost] Reduce inline thresholds to compensate for cost changes

In r286814, the algorithm for calculating inline costs changed. This
caused more inlining to take place which is especially apparent
in optsize and minsize modes.

As the cost calculation removed a skewed behaviour (we were inconsistent
about the cost of calls) it isn't possible to update the thresholds to
get exactly the same behaviour as before. However, this threshold change
accounts for the very common case where an inline candidate has no
calls within it. In this case, r286814 would inline around 5-6 more (IR)
instructions.

The changes to -Oz have been heavily benchmarked. The "obvious" value
for the inline threshold at -Oz is zero, but due to inaccuracies in the
inline heuristics this can actually cause code size increases due to
not inlining key thunk functions (that then disappear). Experimentally,
5 was the sweet spot for code size over the test-suite.

For -Os, this change removes the outlier results shown up by green dragon
(http://104.154.54.203/db_default/v4/nts/13248).

Fixes D26848.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288024 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/InlineCost.h
test/Transforms/Inline/ephemeral.ll
test/Transforms/Inline/inline-fp.ll