[llvm-commits] PATCH: Enable avoiding eager inlining for linkonce-ODR functions

Chandler Carruth chandlerc at gmail.com
Mon Mar 12 21:44:11 PDT 2012


LLVM already has logic to try to avoid over-inlining into functions which
prevents them from inlining into their caller (and thus potentially
simplifying). This was previously only employed on static functions under
the rationale that the primary benefit of this style of inlining is to be
able to delete the function entirely.

However, given the presence of simplifications to the inlined function (the
primary goal of LLVM's inliner), often it is better to follow this strategy
unless the function *cannot* be inlined into most of its callers. If every
call site will have the definition of the function visible and available
for inlining, we shouldn't impair that.

As it happens, this hit us reasonably often due to C++ templates and inline
functions being 'linkonce-ODR' rather than local. The patch adds that
linkage type as well to the list.

I ran a range of Google-specific benchmarks, and saw a geo-mean improvement
of runtime of 0.4%. Some benchmarks improved as much as 2%, others didn't
improve. I also found an average (and total) size increase of 2% across
these benchmarks, so it's not trivially a win. This is a bit of a tradeoff.

Thoughts?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120312/fa636f75/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: inliner-linkonce-odr.diff
Type: text/x-patch
Size: 1705 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120312/fa636f75/attachment.bin>


More information about the llvm-commits mailing list