<div dir="ltr">Hi Bruno <div><br></div><div>I already revert the broken part in <span style="font-size:13.5px">r315032</span>. The rest of the patch is fine. I am trying to come up with a test case. </div><div>-Xin</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 6, 2017 at 9:52 AM, Bruno Cardoso Lopes <span dir="ltr"><<a href="mailto:bruno.cardoso@gmail.com" target="_blank">bruno.cardoso@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is breaking our internal stage2 bots:<br>
<br>
Assertion failed: (L.isLoopExiting(<wbr>PreferredLoopExit) && "not an<br>
exiting block of current loop"), function buildLoopChains, file<br>
/clang/src/lib/CodeGen/<wbr>MachineBlockPlacement.cpp, line 2246.<br>
<br>
It triggers when stage1 is compiling stage2's BranchFolding.cpp. I<br>
don't have a reproducer I can share at the moment, do you mind If I<br>
revert this until I can provide you a reduced testcase?<br>
<br>
Thanks,<br>
<div class="HOEnZb"><div class="h5"><br>
On Wed, Oct 4, 2017 at 2:39 PM, Xin Tong via llvm-commits<br>
<<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
> Author: trentxintong<br>
> Date: Wed Oct  4 14:39:25 2017<br>
> New Revision: 314937<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=314937&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=314937&view=rev</a><br>
> Log:<br>
> [MachineBlockPlacement] Make sure PreferredLoopExit is cleared everytime new loop is processed<br>
><br>
> Summary: Rotate on exit that actually exits the current loop.<br>
><br>
> Reviewers: davidxl, danielcdh, iteratee, chandlerc<br>
><br>
> Subscribers: llvm-commits<br>
><br>
> Differential Revision: <a href="https://reviews.llvm.org/D38563" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D38563</a><br>
><br>
> Modified:<br>
>     llvm/trunk/lib/CodeGen/<wbr>MachineBlockPlacement.cpp<br>
><br>
> Modified: llvm/trunk/lib/CodeGen/<wbr>MachineBlockPlacement.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp?rev=314937&r1=314936&r2=314937&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>CodeGen/MachineBlockPlacement.<wbr>cpp?rev=314937&r1=314936&r2=<wbr>314937&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- llvm/trunk/lib/CodeGen/<wbr>MachineBlockPlacement.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/<wbr>MachineBlockPlacement.cpp Wed Oct  4 14:39:25 2017<br>
> @@ -2233,9 +2233,19 @@ void MachineBlockPlacement::<wbr>buildLoopCha<br>
>    // If we selected just the header for the loop top, look for a potentially<br>
>    // profitable exit block in the event that rotating the loop can eliminate<br>
>    // branches by placing an exit edge at the bottom.<br>
> +  //<br>
> +  // Loops are processed innermost to uttermost, make sure we clear<br>
> +  // PreferredLoopExit before processing a new loop.<br>
> +  PreferredLoopExit = nullptr;<br>
>    if (!RotateLoopWithProfile && LoopTop == L.getHeader())<br>
>      PreferredLoopExit = findBestLoopExit(L, LoopBlockSet);<br>
><br>
> +  // Make sure PreferredLoopExit actually exits the current loop.<br>
> +  if (PreferredLoopExit) {<br>
> +    assert(L.isLoopExiting(<wbr>PreferredLoopExit) &&<br>
> +           "not an exiting block of current loop");<br>
> +  }<br>
> +<br>
>    BlockChain &LoopChain = *BlockToChain[LoopTop];<br>
><br>
>    // FIXME: This is a really lame way of walking the chains in the loop: we<br>
><br>
><br>
> ______________________________<wbr>_________________<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/<wbr>mailman/listinfo/llvm-commits</a><br>
<br>
<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Bruno Cardoso Lopes<br>
<a href="http://www.brunocardoso.cc" rel="noreferrer" target="_blank">http://www.brunocardoso.cc</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Software Engineer - Compiler Toolchain<br>Employee of Facebook Inc.</div>
</div>