<div dir="ltr">Yes, this test case is exactly what the layout optimization is targeting.  With taildup enabled, the dynamic instruction count should remain the same, and the number of taken branches (dynamic) should strictly reduce.<div><br></div><div>David</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 10, 2017 at 7:13 PM, Kyle Butt <span dir="ltr"><<a href="mailto:iteratee@google.com" target="_blank">iteratee@google.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"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 10, 2017 at 6:29 PM, Matt Arsenault <span dir="ltr"><<a href="mailto:arsenm2@gmail.com" class="m_1740652026916085409cremed" target="_blank">arsenm2@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><br>
> On Jan 10, 2017, at 15:04, Kyle Butt via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" class="m_1740652026916085409cremed" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br>
><br>
> Author: iteratee<br>
> Date: Tue Jan 10 17:04:30 2017<br>
> New Revision: 291609<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=291609&view=rev" rel="noreferrer" class="m_1740652026916085409cremed" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=291609&view=rev</a><br>
> Log:<br>
> CodeGen: Allow small copyable blocks to "break" the CFG.<br>
><br>
> When choosing the best successor for a block, ordinarily we would have preferred<br>
> a block that preserves the CFG unless there is a strong probability the other<br>
> direction. For small blocks that can be duplicated we now skip that requirement<br>
> as well.<br>
><br>
> Differential revision: <a href="https://reviews.llvm.org/D27742" rel="noreferrer" class="m_1740652026916085409cremed" target="_blank">https://reviews.llvm.org/D2774<wbr>2</a><br>
<br>
</span>Hi,<br>
<br>
This has caused a code quality regression for me. Attached is a reduced testcase. This patch caused a net gain of 2 branches and a compare instruction. Any idea on how to fix it?<br>
<span class="m_1740652026916085409HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div><div>I looked at the code in question. There are more compare instructions, but no codepath should execute more of them. Which codepath are you concerned about?</div><div><br></div><div>For the compare, and 1 of the branches, it occurs due to tail duplication, and so for those, this is not a regression, it is WAI.</div><div><br></div><div>Are you worried about the code size, or did this actually cause a performance regression?</div><div>If it did cause a regression, can you tell me which path is the hot path? </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="m_1740652026916085409HOEnZb"><font color="#888888">
-Matt<br>
<br>
</font></span></blockquote></div><br></div><div class="gmail_extra">Thanks,</div><div class="gmail_extra">Kyle.</div></div>
</blockquote></div><br></div>