[PATCH] D70641: [LangRef] make per-element poison behavior explicit

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 24 07:52:20 PST 2019


spatel created this revision.
spatel added reviewers: aqjune, liuz, nlopes, efriedma, lebedev.ri, regehr, reames.
Herald added a subscriber: mcrosier.
Herald added a project: LLVM.

As discussed in D70246 <https://reviews.llvm.org/D70246> and PR43958:
https://bugs.llvm.org/show_bug.cgi?id=43958

The LangRef seems ambiguous about the behavior of poison with respect to vectors.

We could go further with text and/or examples - suggestions welcome.

Side note: the LangRef displayed at http://llvm.org/docs/LangRef.html is out-of-date (doesn't show 'freeze' as of right now).


https://reviews.llvm.org/D70641

Files:
  llvm/docs/LangRef.rst


Index: llvm/docs/LangRef.rst
===================================================================
--- llvm/docs/LangRef.rst
+++ llvm/docs/LangRef.rst
@@ -3334,6 +3334,9 @@
    be different if the terminator had transferred control to a different
    successor.
 -  Dependence is transitive.
+-  Vector elements may be independently poisoned. Therefore, transforms
+   on instructions such as shufflevector must be careful to propagate
+   poison across values or elements only as allowed by the original code.
 
 An instruction that *depends* on a poison value, produces a poison value
 itself. A poison value may be relaxed into an
@@ -8448,10 +8451,13 @@
 The elements of the two input vectors are numbered from left to right
 across both of the vectors. The shuffle mask operand specifies, for each
 element of the result vector, which element of the two input vectors the
-result element gets. If the shuffle mask is undef, the result vector is
-undef. If any element of the mask operand is undef, that element of the
-result is undef. If the shuffle mask selects an undef element from one
-of the input vectors, the resulting element is undef.
+result element gets. 
+
+If the shuffle mask is undef, the result vector is undef. If any element 
+of the mask operand is undef, that element of the result is undef. If the
+shuffle mask selects an undef element from one of the input vectors, the 
+resulting element is undef. An undef mask element prevents a poisoned
+vector element from propagating.
 
 For scalable vectors, the only valid mask values at present are
 ``zeroinitializer`` and ``undef``, since we cannot write all indices as


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70641.230793.patch
Type: text/x-patch
Size: 1643 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191124/ab2b6169/attachment.bin>


More information about the llvm-commits mailing list