[Mlir-commits] [mlir] [mlir][Arith] Fix crash when folding operations with dynamic-shaped tensors (PR #178428)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Jan 28 06:26:15 PST 2026


mugiwaraluffy56 wrote:

@kuhar Thank you for the review! I've addressed your feedback:

1. Moved the check to the outer `if` block - now checking `cond.getType().hasStaticShape()` instead of `lhs.getType().hasStaticShape()`.

2. Added a LIT test for `arith.select` with dynamic-shaped tensors (`@select_dynamic_shape_const_condition`). Note that the DenseElementsAttr fold path itself cannot be triggered with dynamic shapes since DenseElementsAttr requires static shapes by construction, but the check serves as a defensive guard and the test verifies the scalar condition path works correctly with dynamic tensor operands.

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


More information about the Mlir-commits mailing list