<div dir="ltr">Hi Hans,<div><br></div><div>This commit (or r252595) causes the inliner to inline functions you don't want to inline (large functions) in some cases. For example, if you compile the attached test case with "opt -inline", function "callee" will always get inlined even after replicating the inline-asm instruction in the last basic block a large number of times. This happens because the loop in CallAnalyzer::analyzeCall that visits the basic blocks of "callee" breaks out when Cost exceeds Threshold, and when that happens Cost happens to be 0. In this case Cost doesn't represent the true cost of the function (Cost<=0 doesn't mean "inlining is free").</div><div><br></div><div>Could you take a look?</div><div><br></div><div><div class="gmail_extra"><div class="gmail_quote">On Fri, Feb 5, 2016 at 12:32 PM, Hans Wennborg via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: hans<br>
Date: Fri Feb 5 14:32:42 2016<br>
New Revision: 259915<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=259915&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=259915&view=rev</a><br>
Log:<br>
CallAnalyzer::analyzeCall: change the condition back to "Cost < Threshold"<br>
<br>
In r252595, I inadvertently changed the condition to "Cost <= Threshold",<br>
which caused a significant size regression in Chrome. This commit rectifies<br>
that.<br>
<br>
Modified:<br>
llvm/trunk/lib/Analysis/InlineCost.cpp<br>
<br>
Modified: llvm/trunk/lib/Analysis/InlineCost.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InlineCost.cpp?rev=259915&r1=259914&r2=259915&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InlineCost.cpp?rev=259915&r1=259914&r2=259915&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Analysis/InlineCost.cpp (original)<br>
+++ llvm/trunk/lib/Analysis/InlineCost.cpp Fri Feb 5 14:32:42 2016<br>
@@ -1392,7 +1392,7 @@ bool CallAnalyzer::analyzeCall(CallSite<br>
else if (NumVectorInstructions <= NumInstructions / 2)<br>
Threshold -= (FiftyPercentVectorBonus - TenPercentVectorBonus);<br>
<br>
- return Cost <= std::max(0, Threshold);<br>
+ return Cost < std::max(1, Threshold);<br>
}<br>
<br>
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div></div>