[Mlir-commits] [mlir] [mlir][arith] Fix crash in SameInputOutputTensorDims with unranked te… (PR #235349)
Vinicius Silva
llvmlistbot at llvm.org
Sat Oct 24 13:29:34 PDT 2026
https://github.com/viniciusfdasilva created https://github.com/llvm/llvm-project/pull/235349
This PR fixes #234633 by adding a hasRank() check first, so the verifier emits a regular error message instead of crashing.
>From c1a70eb565fae8e29d973f1fa0afdc9f2f85360b Mon Sep 17 00:00:00 2001
From: Vinicius Silva <viniciusilva at ieee.org>
Date: Sat, 24 Oct 2026 17:26:36 -0300
Subject: [PATCH] [mlir][arith] Fix crash in SameInputOutputTensorDims with
unranked tensors
---
mlir/include/mlir/Dialect/Arith/IR/ArithOps.td | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mlir/include/mlir/Dialect/Arith/IR/ArithOps.td b/mlir/include/mlir/Dialect/Arith/IR/ArithOps.td
index 4e7b85c534209c..8db9ff85703d11 100644
--- a/mlir/include/mlir/Dialect/Arith/IR/ArithOps.td
+++ b/mlir/include/mlir/Dialect/Arith/IR/ArithOps.td
@@ -135,7 +135,8 @@ class Arith_FloatBinaryOpWithRoundingMode<string mnemonic,
def SameInputOutputTensorDims : PredOpTrait<
"input and output have the same tensor dimensions",
AllMatchSameOperatorPred<["in", "out"],
- "(::llvm::isa<::mlir::TensorType>($_self.getType()) ?"
+ "(::llvm::isa<::mlir::TensorType>($_self.getType()) &&"
+ " ::llvm::cast<::mlir::TensorType>($_self.getType()).hasRank() ?"
" ::llvm::cast<::mlir::TensorType>($_self.getType()).getShape() :"
" ::llvm::ArrayRef<int64_t>{})">>;
More information about the Mlir-commits
mailing list