<div dir="ltr"><div>-  return Cost <= std::max(0, Threshold);</div><div>+  return Cost < std::max(1, Threshold);</div><div><br></div><div>Is the change 0 -> 1 has any effect on size? Or the size regression is fixed only by changing <= to <?</div><div><br></div><div>David</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 24, 2016 at 4:40 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yes, this change only reverts 2), and that did fix the size regression.<br>
<br>
I don't have any binaries to compare, unfortunately, but since the<br>
only thing my change did was to effectively move the threshold by 1,<br>
the only explanation I can think off is that some number of functions<br>
were on the threshold and this affected the inlining decision.<br>
<br>
The significant size increase I saw was 150 KB (on a ~50 MB binary).<br>
What's the typical range of Cost and Threshold?<br>
<div class="HOEnZb"><div class="h5"><br>
On Wed, Feb 24, 2016 at 4:19 PM, Easwaran Raman via llvm-commits<br>
<<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
> I'm curious about the cause of the size regression. The effect of  r252595<br>
> is two-fold:<br>
><br>
> 1. Inline zero-cost callees even if the threshold is negative or 0.<br>
> 2. Inline positive-cost callees when they equal to the threshold (as opposed<br>
> to less than the threshold).<br>
><br>
> This change only reverts the effect  2 above. If that fixes the size<br>
> regression, is it the case that a lot of callees had cost equal to threshold<br>
> and the inlining decision got reversed? That could happen of course, but I<br>
> doubt that should cause a significant regression. I suspect there are other<br>
> subtle bugs in the code, so looking at specific instances will be useful.<br>
><br>
> - Easwaran<br>
><br>
><br>
> On Fri, Feb 5, 2016 at 12:32 PM, Hans Wennborg via llvm-commits<br>
> <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
>><br>
>> 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<br>
>> rectifies<br>
>> that.<br>
>><br>
>> Modified:<br>
>>     llvm/trunk/lib/Analysis/InlineCost.cpp<br>
>><br>
>> Modified: llvm/trunk/lib/Analysis/InlineCost.cpp<br>
>> URL:<br>
>> <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>
>> ==============================================================================<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>
><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>
><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>
</div></div></blockquote></div><br></div>