[llvm-dev] killing undef and spreading poison

Peter Lawrence via llvm-dev llvm-dev at lists.llvm.org
Fri Jun 16 17:32:50 PDT 2017


Nuno,
          we still need some examples showing that the definition
“Branching on poison is immediate-UB” is the best choice,
so far we only have arguments against it (the one for loop-switching).


Excerpts from the Paper [1]

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.

So this example doesn’t really show anything about branching.


Peter Lawrence.


[1.  http://www.cs.utah.edu/~regehr/papers/undef-pldi17.pdf <http://www.cs.utah.edu/~regehr/papers/undef-pldi17.pdf> ]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170616/07993e10/attachment.html>


More information about the llvm-dev mailing list