[llvm-dev] killing undef and spreading poison

Sanjoy Das via llvm-dev llvm-dev at lists.llvm.org
Fri Jun 16 19:41:30 PDT 2017


Hi Peter,

On Fri, Jun 16, 2017 at 5:32 PM, Peter Lawrence via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> Here’s the example you give for GVN
>
>         t = x + 1;
>         if (t == y) {
>           w = x + 1;
>           foo(w);
>         }
>         Therefore, GVN can pick y as the representative value and transform
> the code into:
>         t = x + 1;
>         if (t == y) {
>           foo(y);
>         }
>         However, if y is a poison value and w is not
>
> This really hinges on an incorrect choice for representative value of  w.
>
> Any value with the “poison” attribute is not a valid representative for any
> seemingly equivalent value.  If GVN is actually doing this it is a bug in
> GVN.

Fixing this "bug" is impractical, since in most cases we won't be able
to prove that a value isn't poison.  So we want a semantics that lets
us do the above transform without having to prove that y isn't poison.

-- Sanjoy


More information about the llvm-dev mailing list