<div dir="ltr"><div><div>Thanks for the quick review!<br><br></div>I have now split the patch into two diff files, each rebased on r200567.<br></div><div>The "_fix" one contains the fix and the test, the "_debug" one contains the debug prints.<br>

<br></div><div>Let me know if there's any issue, otherwise feel free to commit.<br></div><div><br>Cheers,<br></div><div>    Dario Domizioli<br></div><div>    SN Systems - Sony Computer Entertainment<br></div><br><div>

<br><br><br><br><br><br><div><br><br><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 31 January 2014 19:24, Eric Christopher <span dir="ltr"><<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Agreed with what Manman says. Let's split it in two and then either of<br>
us can commit for you.<br>
<br>
Thanks!<br>
<span class="HOEnZb"><font color="#888888"><br>
-eric<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Fri, Jan 31, 2014 at 11:05 AM, Manman Ren <<a href="mailto:manman.ren@gmail.com">manman.ren@gmail.com</a>> wrote:<br>
><br>
> LGTM. Thanks for the detailed comments.<br>
><br>
> I noticed a few debugging-related changes, it may be better to separate<br>
> those.<br>
> +  DEBUG_PRINT_STAT(Cost);<br>
> +  DEBUG_PRINT_STAT(Threshold);<br>
> +  DEBUG_PRINT_STAT(VectorBonus);<br>
><br>
> Manman<br>
><br>
><br>
> On Fri, Jan 31, 2014 at 10:55 AM, Dario Domizioli<br>
> <<a href="mailto:dario.domizioli@gmail.com">dario.domizioli@gmail.com</a>> wrote:<br>
>><br>
>> Hello LLVM.<br>
>><br>
>> I have come across a subtle and rare interaction between debug<br>
>> information, vector instructions, and the cost heuristic used by the<br>
>> SimpleInliner (i.e. the InlineCost analysis).<br>
>><br>
>> It appears that debug intrinsics are counted in the number of instructions<br>
>> taken into consideration by the heuristic. They are also later discounted as<br>
>> being "simplified", so they do not directly affect the inline Cost, but they<br>
>> are taken into account when evaluating the fraction of instructions that are<br>
>> vector instructions. This fraction is used to determine whether to apply a<br>
>> hidden "VectorBonus" to the inlining Threshold, and therefore there is a<br>
>> subtle interaction which means that debug intrinsics can affect the inlining<br>
>> decision.<br>
>><br>
>> The attached patch fixes the problem by making the inline cost heuristic<br>
>> skip debug intrinsics altogether when examining instructions.<br>
>> I have also added a couple of debug prints to the already existing ones,<br>
>> which I think are generally useful to debug the inline cost heuristic.<br>
>><br>
>> I have included a test in which I have manufactured a situation where<br>
>> vector instructions would be most of the function's code but they are<br>
>> outnumbered by debug intrinsics when debug information is present. The test<br>
>> exposes the problem in the current trunk and passes with my fix.<br>
>><br>
>> Please submit for me if you accept this patch, as I do not have commit<br>
>> access.<br>
>><br>
>> Cheers,<br>
>>     Dario Domizioli<br>
>>     SN Systems - Sony Computer Entertainment<br>
>><br>
>><br>
>> _______________________________________________<br>
>> llvm-commits mailing list<br>
>> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
>><br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
><br>
</div></div></blockquote></div><br></div>