[Mlir-commits] [mlir] [mlir][arith] Fix crash in SameInputOutputTensorDims with unranked tensors (PR #235349)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sat Oct 24 13:30:06 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-arith
Author: Vinicius Silva (viniciusfdasilva)
<details>
<summary>Changes</summary>
This PR fixes #<!-- -->234633 by adding a hasRank() check first, so the verifier emits a regular error message instead of crashing.
---
Full diff: https://github.com/llvm/llvm-project/pull/235349.diff
1 Files Affected:
- (modified) mlir/include/mlir/Dialect/Arith/IR/ArithOps.td (+2-1)
``````````diff
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>{})">>;
``````````
</details>
https://github.com/llvm/llvm-project/pull/235349
More information about the Mlir-commits
mailing list