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

David Majnemer david.majnemer at gmail.com
Sat Nov 8 23:12:00 PST 2014


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

> > If a poison value enters select, is the entire select poisoned?
> Going with the obvious:
>
>  * if the condition is poison then the select is poison.
>  * otherwise the poison'ness of the select is the poison'ness of the
> input value that was dynamically selected.
>
> > If not, that means select can _never_ be decomposed into arithmetic
> because
> > arithmetic propagates poison.
>
> It can be, if the condition is a poison-propagating function of the
> two other inputs; which are the case where I think you'd want to
> arithmetize a select anyway.  Are there cases of selects which can be
> turned into arithmetic that have a condition that isn't poison when
> one or two of the inputs to the select are?
>

If we are going by your definition of poison for select, then consider the
following IR:
%sel = select i1 %c, i1 %x, i1 0

If %c is not poison and %x is poison, %sel *was* well-defined if %c is
dynamically false.

Today, InstCombine will turn that into:
%sel = and i1 %c, %x

However, %sel will always be poison.


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


More information about the llvm-commits mailing list