[Mlir-commits] [mlir] [mlir] Add option to run CSE between greedy rewriter iterations (PR #193081)

Mehdi Amini llvmlistbot at llvm.org
Tue Apr 21 03:08:52 PDT 2026


================
@@ -899,6 +901,15 @@ LogicalResult RegionPatternRewriteDriver::simplify(bool *changed) && {
           }
         },
         {&region}, iteration);
+
+    // Optionally run full CSE between iterations. If CSE changes the IR we
+    // iterate again so that patterns can fire on the deduplicated operations.
+    if (config.isCSEBetweenIterationsEnabled()) {
+      DominanceInfo domInfo(region.getParentOp());
+      bool cseChanged = false;
+      eliminateCommonSubExpressions(rewriter, domInfo, region, &cseChanged);
+      continueRewrites |= cseChanged;
+    }
----------------
joker-eph wrote:

Technically, this is not the patterns nor part of the worklist :)

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


More information about the Mlir-commits mailing list