[Mlir-commits] [mlir] [MLIR] Fixes arith.sub folder crash on dynamically shaped tensors (PR #118908)
Mehdi Amini
llvmlistbot at llvm.org
Thu Dec 5 21:15:02 PST 2024
================
@@ -393,8 +393,12 @@ void arith::AddUIExtendedOp::getCanonicalizationPatterns(
OpFoldResult arith::SubIOp::fold(FoldAdaptor adaptor) {
// subi(x,x) -> 0
- if (getOperand(0) == getOperand(1))
- return Builder(getContext()).getZeroAttr(getType());
+ if (getOperand(0) == getOperand(1)) {
+ auto tensorType = dyn_cast<TensorType>(getType());
----------------
joker-eph wrote:
Good point for using ShapedType.
The scalable vectors aren't an issue I believe since you can create a constant. They act as if they are statically shaped from this point of view.
https://github.com/llvm/llvm-project/pull/118908
More information about the Mlir-commits
mailing list