<div dir="ltr">The issue blocks another optimization patch and Wei has spent huge amount of effort isolating the the bootstrap failure to this same problem. I agree with Wei that other developers may also get hit by the same issue and the cost of leaving this issue open for long can be very high to the community. <div><br></div><div>David</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 17, 2017 at 10:01 AM, Wei Mi <span dir="ltr"><<a href="mailto:wmi@google.com" target="_blank">wmi@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Sanjoy and Nuno, thanks for pointing me to the existing bug and the<br>
related discussion, and thanks for the great effort to try to solve it<br>
fundamentally in IR.<br>
<br>
I tried the patches and it compiled the small case and also<br>
MemorySSA.cpp correctly.<br>
<br>
I wish we can have the patches in ASAP but they are some big patches<br>
and I guess it still takes some time to get in. The issue when<br>
compiling MemorySSA.cpp can be easily exposed by other changes, and it<br>
is very time consuming to triage and extract the issue, so we like to<br>
have some temporary solution, like to make loop unswitching more<br>
conservative. If it sounds ok, I can work on it. My plan is to enhance<br>
isGuaranteedNotToBeUndefOrPois<wbr>on and use it as a precondition in loop<br>
unswitching.<br>
<br>
Thanks,<br>
Wei.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
On Mon, Jul 17, 2017 at 1:24 AM, Nuno Lopes <<a href="mailto:nlopes@microsoft.com">nlopes@microsoft.com</a>> wrote:<br>
> Cool, thanks for debugging this issue and letting us know.<br>
><br>
> We have a few patches to fix this issue:<br>
>  - Introduce freeze in IR: <a href="https://reviews.llvm.org/D29011" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D29011</a><br>
>  - Lowering freeze: <a href="https://reviews.llvm.org/D29014" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D29014</a><br>
>  - Fix loop unswitch: <a href="https://reviews.llvm.org/D29015" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D29015</a><br>
><br>
> Bonus patches to recover perf:<br>
>  - Be less conservative in loop unswitching: <a href="https://reviews.llvm.org/D29016" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D29016</a><br>
>  - Instcombine support for freeze: <a href="https://reviews.llvm.org/D29013" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D29013</a><br>
><br>
> It would be great if you could try out these patches to see if the bug goes away.<br>
><br>
> Thanks,<br>
> Nuno<br>
><br>
><br>
> -----Original Message-----<br>
> From: Sanjoy Das<br>
> Sent: 16 de julho de 2017 02:47<br>
> To: Wei Mi<br>
> Cc: llvm-dev; Xinliang David Li; Sanjoy Das; Nuno Lopes; John Regehr; Juneyoung Lee<br>
> Subject: Re: [llvm-dev] A bug related with undef value when bootstrap MemorySSA.cpp<br>
><br>
> Hi Wei,<br>
><br>
> [+CC the other undef folks]<br>
><br>
> This is the same bug as <a href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs.llvm.org%2Fshow_bug.cgi%3Fid%3D31652&data=02%7C01%7Cnlopes%40microsoft.com%7C971ae2063c8b420d2f1008d4cbec8f22%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636357664258073352&sdata=iCy8kUlWwJzQpXbXvOuhHpKyXBnntZPGvn%2FtxWsqun8%3D&reserved=0" rel="noreferrer" target="_blank">https://na01.safelinks.<wbr>protection.outlook.com/?url=<wbr>https%3A%2F%2Fbugs.llvm.org%<wbr>2Fshow_bug.cgi%3Fid%3D31652&<wbr>data=02%7C01%7Cnlopes%<wbr>40microsoft.com%<wbr>7C971ae2063c8b420d2f1008d4cbec<wbr>8f22%<wbr>7C72f988bf86f141af91ab2d7cd011<wbr>db47%7C1%7C0%<wbr>7C636357664258073352&sdata=<wbr>iCy8kUlWwJzQpXbXvOuhHpKyXBnntZ<wbr>PGvn%2FtxWsqun8%3D&reserved=0</a>.<br>
> The short answer here is that the loop unswitch transform and the GVN transform are justified via conflicting specifications of undef (that is, LoopUnswitch and GVN don't agree on the definition of undef).  The<br>
> long(er) answer is in the bug.<br>
><br>
> Unfortunately, there is no real way to fix this in the IR today (beyond hacking GVN / LoopUnswitch to back off on these transforms enough to not trigger this case).  We will need to specify and implement a consistent definition of undef / poison to truly fix this, one of which we've already proposed.<br>
><br>
> Thanks!<br>
> -- Sanjoy<br>
</div></div></blockquote></div><br></div>