[Mlir-commits] [mlir] [mlir][tosa] Canonicalize avg_pool2d/max_pool2d no-ops (PR #203571)

Luke Hutton llvmlistbot at llvm.org
Thu Jun 18 05:28:23 PDT 2026


================
@@ -271,6 +271,39 @@ struct AvgPool2dAdaptiveToAvgPool2d
   }
 };
 
+struct AvgPool2dIsNoOp : public OpRewritePattern<tosa::AvgPool2dOp> {
+  using OpRewritePattern::OpRewritePattern;
+
+  LogicalResult matchAndRewrite(tosa::AvgPool2dOp op,
+                                PatternRewriter &rewriter) const override {
+    if (op.getInput().getType() != op.getOutput().getType())
----------------
lhutton1 wrote:

Note: should remove this now that it will be verified in https://github.com/llvm/llvm-project/pull/203565

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


More information about the Mlir-commits mailing list