[Mlir-commits] [mlir] [mlir][ArithToSPIRV] Fix crash on tensor arith.uitofp/sitofp lowering (PR #227102)

Igor Wodiany llvmlistbot at llvm.org
Fri Oct 2 02:49:00 PDT 2026


================
@@ -731,6 +731,13 @@ struct IntToFPPattern final : public OpConversionPattern<ArithOp> {
     // Check if the source integer type was widened during type conversion.
     unsigned originalBitwidth =
         getElementTypeOrSelf(op.getIn().getType()).getIntOrFloatBitWidth();
+
+    Type srcElemType = getElementTypeOrSelf(srcType);
+    if (!srcElemType.isIntOrFloat()) {
+      return rewriter.notifyMatchFailure(op,
+                                         "unsupported type for uitofp/sitofp");
+    }
+
     unsigned convertedBitwidth =
         getElementTypeOrSelf(srcType).getIntOrFloatBitWidth();
----------------
IgWod wrote:

```suggestion
        srcElemType .getIntOrFloatBitWidth();
```

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


More information about the Mlir-commits mailing list