[Mlir-commits] [mlir] [mlir][spirv] Fix crash in ArithToSPIRV trunc-i lowering on tensor types (PR #179009)

Eric Feng llvmlistbot at llvm.org
Wed Feb 4 17:46:19 PST 2026


================
@@ -919,6 +980,22 @@ struct TypeCastingOpPattern final : public OpConversionPattern<Op> {
     if (isBoolScalarOrVector(srcType) || isBoolScalarOrVector(dstType))
       return failure();
 
+    auto isIntOrFloatScalarOrVectorNotI1 = [](Type type) {
+      Type elt = getElementTypeOrSelf(type);
+      if (!elt || (!elt.isIntOrFloat()))
+        return false;
+      if (elt.isInteger(1))
+        return false;
+      return (type == elt) || isa<VectorType>(type);
+    };
+
+    if (!isIntOrFloatScalarOrVectorNotI1(srcType) ||
+        !isIntOrFloatScalarOrVectorNotI1(dstType))
+      return rewriter.notifyMatchFailure(
+          op, llvm::formatv(
+                  "expected int/float scalar or vector types, got {0} -> {1}",
----------------
efric wrote:

To clarify, I meant for an instance of `TypeCastingOpPattern` itself 

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


More information about the Mlir-commits mailing list