[Mlir-commits] [mlir] [mlir][Linalg] Fix crash in buildBinaryFn on non-numeric types (PR #180594)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Fri Feb 13 00:04:07 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();
+
+ return arg0;
----------------
banach-space wrote:
I agree that `arg0` is incorrect. It should be `return {}` instead.
https://github.com/llvm/llvm-project/pull/180594
More information about the Mlir-commits
mailing list