<html><body><p><font size="2" face="Courier New">Hello,</font><br><br><font size="2" face="Courier New">I'd like to propose turning on the partial inliner (-enable-partial-inlining) by default.</font><br><br><font size="2" face="Courier New">We've seen small gains on SPEC2006/2017 runtimes as well as lnt compile-times with a 2nd stage bootstrap of LLVM. We also saw positive gains on our internal workloads.</font><br><br><font size="2" face="Courier New">-------------------------------------</font><br><font size="2" face="Courier New">Brief description of Partial Inlining</font><br><font size="2" face="Courier New">-------------------------------------</font><br><font size="2" face="Courier New">A pass in opt that runs after the normal inlining pass. Looks for branches to a return block in the entry and immediate successor blocks of a function. If found, it outlines the rest of the function using the CodeExtractor. It then attempts to inline the leftover entry block (and possibly one or more of its successors) to all its callers. This effectively peels the early return block(s) into the caller, which could be executed without incurring the call overhead of the function just to return immediately. Inlining and call overhead cost, as well as branch probabilities of the return block(s) are taken into account before inlining is done. If inlining is not successful, then the changes are discarded.</font><br><br><font size="2" face="Courier New">eg.</font><br><br><font size="2" face="Courier New">void foo() {</font><br><font size="2" face="Courier New"> bar();</font><br><font size="2" face="Courier New"> // rest of the code in foo</font><br><font size="2" face="Courier New">}</font><br><br><font size="2" face="Courier New">void bar() {</font><br><font size="2" face="Courier New"> if (X)</font><br><font size="2" face="Courier New"> return;</font><br><font size="2" face="Courier New"> // rest of code (to be outlined)</font><br><font size="2" face="Courier New">}</font><br><br><font size="2" face="Courier New">After Partial Inlining:</font><br><br><font size="2" face="Courier New">void foo() {</font><br><font size="2" face="Courier New"> if (!X)</font><br><font size="2" face="Courier New"> bar.outlined();</font><br><font size="2" face="Courier New"> // rest of the code in foo</font><br><font size="2" face="Courier New">}</font><br><br><font size="2" face="Courier New">void bar.outlined() {</font><br><font size="2" face="Courier New"> // rest of the code in bar</font><br><font size="2" face="Courier New">}</font><br><br><br><font size="2" face="Courier New">Here are the numbers on a Power8 PPCLE running Ubuntu 15.04 in ST-mode</font><br><br><font size="2" face="Courier New">----------------------------------------------</font><br><font size="2" face="Courier New">Runtime performance (speed)</font><br><font size="2" face="Courier New">----------------------------------------------</font><br><font size="2" face="Courier New">Workload Improvement</font><br><font size="2" face="Courier New">-------- -----------</font><br><font size="2" face="Courier New">SPEC2006(C/C++) 0.06% (geomean)</font><br><font size="2" face="Courier New">SPEC2017(C/C++) 0.10% (geomean) </font><br><font size="2" face="Courier New">----------------------------------------------</font><br><font size="2" face="Courier New">Compile time performance for Bootstrapped LLVM</font><br><font size="2" face="Courier New">----------------------------------------------</font><br><font size="2" face="Courier New">Workload Improvement</font><br><font size="2" face="Courier New">-------- -----------</font><br><font size="2" face="Courier New">SPEC2006(C/C++) 0.41% (cumulative)</font><br><font size="2" face="Courier New">SPEC2017(C/C++) -0.16% (cumulative)</font><br><font size="2" face="Courier New">lnt 0.61% (geomean)</font><br><font size="2" face="Courier New">----------------------------------------------</font><br><font size="2" face="Courier New">Compile time performance</font><br><font size="2" face="Courier New">----------------------------------------------</font><br><font size="2" face="Courier New">Workload Increase</font><br><font size="2" face="Courier New">-------- --------</font><br><font size="2" face="Courier New">SPEC2006(C/C++) 1.31% (cumulative)</font><br><font size="2" face="Courier New">SPEC2017(C/C++) 0.25% (cumulative)</font><br><font size="2" face="Courier New">----------------------------------------------</font><br><font size="2" face="Courier New">Code size</font><br><font size="2" face="Courier New">----------------------------------------------</font><br><font size="2" face="Courier New">Workload Increase</font><br><font size="2" face="Courier New">-------- --------</font><br><font size="2" face="Courier New">SPEC2006(C/C++) 3.90% (geomean)</font><br><font size="2" face="Courier New">SPEC2017(C/C++) 1.05% (geomean)</font><br><br><font size="2" face="Courier New">NOTE1: Code size increase in SPEC2006 was mainly attributed to benchmark "astar", which increased by 86%. Removing this outlier, we get a more reasonable increase of 0.58%.</font><br><br><font size="2" face="Courier New">NOTE2: There is a patch up for review on Phabricator to enhance the partial inliner with the presence of profiling information (</font><a href="https://reviews.llvm.org/D38190"><font size="2" face="Courier New">https://reviews.llvm.org/D38190</font></a><font size="2" face="Courier New">).</font><br><br><br><font size="2">Graham Yiu<br>LLVM Compiler Development<br>IBM Toronto Software Lab<br>Office: (905) 413-4077 C2-707/8200/Markham<br>Email: gyiu@ca.ibm.com</font><BR>
</body></html>