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.<div>
<br></div><div>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.</div>
<div><br></div><div>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.</div><div><br>
</div><div>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.</div>
<div><br></div><div>Thoughts?</div>