[llvm-dev] Poison values

David Majnemer via llvm-dev llvm-dev at lists.llvm.org
Thu Dec 1 16:31:30 PST 2016


On Thu, Dec 1, 2016 at 2:27 PM, Alexandre Isoard via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hello,
>
> I was trying to wrap my head around the poison semantic in llvm-ir.
>
> Let say I have the following llvm ir:
>
> int5 f(int5 %a) {
>   %b = lshr exact int5 %a, 2
>   %c = shl nuw int5 %a, 2
>   return %a
> }
>
> Even though I do not use %b nor %c, can I assume that %a is either 0 or 4?
> That is, can I assume the creation of poison value is undefined behavior
>

The creation of poison is not UB. Poison producing instructions can be
hoisted at-will.


> , or do I need to perform branching on posion value to actually have an
> undefined behavior?
>
> Regards.
>
> --
> *Alexandre Isoard*
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161201/075ea8a4/attachment.html>


More information about the llvm-dev mailing list