[Mlir-commits] [mlir] [mlir] Add option to run CSE between greedy rewriter iterations (PR #193081)
Hocky Yudhiono
llvmlistbot at llvm.org
Tue Apr 21 02:30:23 PDT 2026
================
@@ -899,6 +901,15 @@ LogicalResult RegionPatternRewriteDriver::simplify(bool *changed) && {
}
},
{®ion}, 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;
+ }
----------------
hockyy wrote:
```cpp
config.setScope(scope_a);
config.isCSEBetweenIterations = true;
applyPatternsGreedily(module, config);
```
I'm not sure about this behavior, should this CSE the `module` or just the `scope_a`
https://github.com/llvm/llvm-project/pull/193081
More information about the Mlir-commits
mailing list