<div dir="ltr">The scenario you describe would result in analyzeCall to return true even after r<span style="font-size:12.8px">259915 since Cost == 0 and Threshold  == 0 implies Cost < max(1, Threshold). Since this change has addressed the size regression, there must have been other inline decisions which had returned true before </span>r<span style="font-size:12.8px">259915 and returned false with this and those are the ones I was curious about.</span><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 24, 2016 at 4:55 PM, Xinliang David Li <span dir="ltr"><<a href="mailto:xinliangli@gmail.com" target="_blank">xinliangli@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">As Akira's case shows, the following can happen:<div><br></div><div>1) under certain conditions (unreachable path etc), the threshold was adjusted to 0</div><div>2) in analyzeCall, in the worklist loop, the threshold can further be adjusted to negative number (single BB bonus)</div><div>3) in AnalyzeBlock, it bails out early when cost == 0 -- even the real cost of the function is much higher</div><div>4) outside the worklist loop, with Hans's change, the 'zero' cost is compared with the max(0, threshold), and the result will be true.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>David</div></font></span></div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Wed, Feb 24, 2016 at 4:19 PM, Easwaran Raman 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></span><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'm curious about the cause of the size regression. The effect of  r252595 is two-fold:<div><br></div><div>1. Inline zero-cost callees even if the threshold is negative or 0.</div><div>2. Inline positive-cost callees when they equal to the threshold (as opposed to less than the threshold).</div><div><br></div><div>This change only reverts the effect  2 above. If that fixes the size regression, is it the case that a lot of callees had cost equal to threshold and the inlining decision got reversed? That could happen of course, but I doubt that should cause a significant regression. I suspect there are other subtle bugs in the code, so looking at specific instances will be useful.</div><div><br></div><div>- Easwaran<br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><span>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></span><div><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc 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" target="_blank">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></div></div><br></div>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">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>
<br></blockquote></div></div></div><br></div>
</blockquote></div><br></div>