[llvm] [WebAssembly] [Backend] Wasm optimize illegal bitmask (PR #145627)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 30 02:18:35 PDT 2025


================
@@ -3236,6 +3244,48 @@ static SDValue performBitcastCombine(SDNode *N,
         DL, VT);
   }
 
+  // bitcast <N x i1>(setcc ...) to concat iN, where N = 32 and 64 (illegal)
+  if (NumElts == 32 || NumElts == 64) {
+    // Strategy: We will setcc them seperately in v16i8 -> v16i1
+    // Bitcast them to i16, extend them to either i32 or i64.
+    // Add them together, shifting left 1 by 1.
+    SDValue Concat, SetCCVector;
+    ISD::CondCode SetCond;
+
+    if (!sd_match(N, m_BitCast(m_c_SetCC(m_Value(Concat),
+                                         m_VectorVT(m_Value(SetCCVector)),
----------------
lukel97 wrote:

Is this m_VectorVT needed? I think if you're checking that Concat is a vector then anything SetCC'd with it will also have to be a vector

```suggestion
                                         m_Value(SetCCVector),
```

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


More information about the llvm-commits mailing list