[llvm] [RISCV] Allow undef elements in isDeinterleaveShuffle (PR #114585)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 1 17:12:50 PDT 2024


================
@@ -4475,10 +4475,9 @@ static bool isDeinterleaveShuffle(MVT VT, MVT ContainerVT, SDValue V1,
   if (Mask[0] != 0 && Mask[0] != 1)
     return false;
 
-  // The others must increase by 2 each time.
-  // TODO: Support undef elements?
+  // The others must increase by 2 each time (or be undef).
   for (unsigned i = 1; i != Mask.size(); ++i)
-    if (Mask[i] != Mask[i - 1] + 2)
+    if (Mask[i] != Mask[i - 1] + 2 && Mask[i] != -1)
----------------
preames wrote:

There's a bug here - specifically, this allows 1 in an arbitrary position following an out of bounds index.  Will refresh with a fixed version on Monday.

https://github.com/llvm/llvm-project/pull/114585


More information about the llvm-commits mailing list