<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 5, 2014 at 9:00 PM, Hal Finkel <span dir="ltr"><<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="">> > For instructions which trap, we need a stronger predicate than<br>
> > 'isKnownNonZero': we need a hypothetical 'isKnownNeverToBeUndef'.<br>
><br>
> Wait, why? If the program produced undefined behavior, then it can<br>
> trap in response to that. No?<br>
><br>
><br>
><br>
> Let's consider a loop which will never iterate even once but contains<br>
> a divide instruction whose operands are invariant of the loop.<br>
><br>
><br>
> The behavior of this program is well defined because the divide<br>
> cannot execute. Hoisting the divide might turn a well-formed program<br>
> into an ill-formed program if it turns out the dividend is poison.<br>
><br>
<br>
</div></div>Fair enough; I see your point.</blockquote></div><br>This is another reason to go away from poison and back to undef.</div><div class="gmail_extra"><br></div><div class="gmail_extra">With undef, speculation is clearly only allowed if you replace the undef denominator with some non-zero constant (say, one).</div><div class="gmail_extra"><br></div><div class="gmail_extra">But then again, we can also just replace X/undef first, and then it being speculated isn't relevant at all, so maybe none of that matters. =]</div></div>