[llvm] r221318 - Analysis: Make isSafeToSpeculativelyExecute fire less for divides

David Majnemer david.majnemer at gmail.com
Sat Nov 8 22:23:44 PST 2014


On Sat, Nov 8, 2014 at 9:56 PM, Sanjoy Das <sanjoy at playingwithpointers.com>
wrote:

> On Sat, Nov 8, 2014 at 9:49 PM, Chandler Carruth <chandlerc at google.com>
> wrote:
> >
> > On Sat, Nov 8, 2014 at 11:43 PM, David Majnemer <
> david.majnemer at gmail.com>
> > wrote:
> >>
> >>
> >> I'm pretty sure the LangRef has a bug here.  It cannot literally mean
> >> undefined behavior or the program hits UB once an add nsw that produces
> >> poison is used as the operand to another add.
>
> Why is this a problem?
>

It would mean that merely hoisting *add* instructions could turn into
undefined behavior.  This cannot be workable.


>
> > Yes this is the known bug in the poison spec. None have wanted to fix it
> > because it seems likely better to remove the need for poison by
> specifying
> > (and implementing if necessary) the relevant optimization opportunities
> in
> > terms of undef, which is a much simpler construct.
>
> Do you mean an "add nsw" that overflows is undef?  In that case, we
> won't be able to optimize "t < (t + 1)" to "true" (+ is add nsw and <
> is icmp slt) -- there is no i32 undef (which t+1 will be if t is
> i32_signed_max) that is > i32_signed_max.  I'm not sure this is a real
> optimization problem, though.


> -- Sanjoy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141108/3e4f262e/attachment.html>


More information about the llvm-commits mailing list