<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Nov 8, 2014 at 9:56 PM, Sanjoy Das <span dir="ltr"><<a href="mailto:sanjoy@playingwithpointers.com" target="_blank">sanjoy@playingwithpointers.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">On Sat, Nov 8, 2014 at 9:49 PM, Chandler Carruth <<a href="mailto:chandlerc@google.com">chandlerc@google.com</a>> wrote:<br>
><br>
</span><span class="">> On Sat, Nov 8, 2014 at 11:43 PM, David Majnemer <<a href="mailto:david.majnemer@gmail.com">david.majnemer@gmail.com</a>><br>
> wrote:<br>
>><br>
>><br>
>> I'm pretty sure the LangRef has a bug here.  It cannot literally mean<br>
>> undefined behavior or the program hits UB once an add nsw that produces<br>
>> poison is used as the operand to another add.<br>
<br>
</span>Why is this a problem?<br></blockquote><div><br></div><div>It would mean that merely hoisting *add* instructions could turn into undefined behavior.  This cannot be workable.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<span class=""><br>
> Yes this is the known bug in the poison spec. None have wanted to fix it<br>
> because it seems likely better to remove the need for poison by specifying<br>
> (and implementing if necessary) the relevant optimization opportunities in<br>
> terms of undef, which is a much simpler construct.<br>
<br>
</span>Do you mean an "add nsw" that overflows is undef?  In that case, we<br>
won't be able to optimize "t < (t + 1)" to "true" (+ is add nsw and <<br>
is icmp slt) -- there is no i32 undef (which t+1 will be if t is<br>
i32_signed_max) that is > i32_signed_max.  I'm not sure this is a real<br>
optimization problem, though. </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<span class=""><font color="#888888"><br>
-- Sanjoy<br>
</font></span></blockquote></div><br></div></div>