[Mlir-commits] [mlir] [mlir] Add missing pad reshape propagation patterns (PR #168888)

Ian Wood llvmlistbot at llvm.org
Thu Nov 20 11:24:39 PST 2025


================
@@ -1061,38 +1109,92 @@ class FoldPadWithProducerReshapeOpByExpansion
                                          "fusion blocked by control function");
     }
 
-    ArrayRef<int64_t> low = padOp.getStaticLow();
-    ArrayRef<int64_t> high = padOp.getStaticHigh();
+    RankedTensorType expandedType = reshapeOp.getSrcType();
     SmallVector<ReassociationIndices> reassociations =
         reshapeOp.getReassociationIndices();
+    FailureOr<PadDimInfo> maybeExpandedPadding = computeExpandedPadding(
+        padOp, expandedType.getShape(), reassociations, rewriter);
+    if (failed(maybeExpandedPadding))
+      return failure();
+    PadDimInfo expandedPadding = maybeExpandedPadding.value();
----------------
IanWood1 wrote:

To prevent copying the members:
```suggestion
    PadDimInfo &expandedPadding = maybeExpandedPadding.value();
```

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


More information about the Mlir-commits mailing list