[Mlir-commits] [mlir] [mlir][reducer] make opt-reduction pass clone topOp after check (NFC) (PR #189356)

lonely eagle llvmlistbot at llvm.org
Fri Apr 3 23:57:49 PDT 2026


https://github.com/linuxlonelyeagle updated https://github.com/llvm/llvm-project/pull/189356

>From 8475c05e8c72cf9245441e101168f39598e4f8df Mon Sep 17 00:00:00 2001
From: linuxlonelyeagle <2020382038 at qq.com>
Date: Mon, 30 Mar 2026 10:59:23 +0000
Subject: [PATCH] make opt-reduction pass clone topOp after check.

---
 mlir/lib/Reducer/OptReductionPass.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mlir/lib/Reducer/OptReductionPass.cpp b/mlir/lib/Reducer/OptReductionPass.cpp
index 255df1ca092af..62d05c37bfab1 100644
--- a/mlir/lib/Reducer/OptReductionPass.cpp
+++ b/mlir/lib/Reducer/OptReductionPass.cpp
@@ -45,9 +45,7 @@ void OptReductionPass::runOnOperation() {
   LDBG() << "\nOptimization Reduction pass: ";
 
   Tester test(testerName, testerArgs);
-
   Operation *topOp = this->getOperation();
-  Operation *topOpVariant = topOp->clone();
 
   PassManager passManager(topOp->getName());
   if (failed(parsePassPipeline(optPass, passManager))) {
@@ -60,6 +58,7 @@ void OptReductionPass::runOnOperation() {
     topOp->emitError() << "\nthe original input is not interested";
     return signalPassFailure();
   }
+  Operation *topOpVariant = topOp->clone();
 
   LogicalResult pipelineResult = passManager.run(topOpVariant);
   if (failed(pipelineResult)) {



More information about the Mlir-commits mailing list