[Mlir-commits] [mlir] [mlir][Linalg] Fix crash in buildBinaryFn on non-numeric types (PR #180594)

Akimasa Watanuki llvmlistbot at llvm.org
Tue Feb 10 21:02:58 PST 2026


================
@@ -506,14 +506,13 @@ class RegionBuilderHelper {
     bool allBool = allInteger && arg0.getType().getIntOrFloatBitWidth() == 1 &&
                    arg1.getType().getIntOrFloatBitWidth() == 1;
     if (!allComplex && !allFloatingPoint && !allInteger) {
-      if (emitError) {
-        emitError()
-            << "Cannot build binary Linalg operation: expects allComplex, "
-               "allFloatingPoint, or allInteger, got "
-            << arg0.getType() << " and " << arg1.getType();
-        return nullptr;
-      }
-      llvm_unreachable("unsupported non numeric type");
+
+      auto diag = emitError ? emitError() : mlir::emitError(arg0.getLoc());
+      diag << "Cannot build binary Linalg operation: expects allComplex, "
+           << "allFloatingPoint, or allInteger, got " << arg0.getType()
+           << " and " << arg1.getType();
+
----------------
Men-cotton wrote:

Drop a newline.

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


More information about the Mlir-commits mailing list