[Mlir-commits] [mlir] [mlir] Add option to run CSE between greedy rewriter iterations (PR #193081)
Hocky Yudhiono
llvmlistbot at llvm.org
Mon Apr 20 21:01:12 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:
```suggestion
if (config.isCSEBetweenIterationsEnabled()) {
Region *cseScope = config.getScope();
assert(cseScope && "expected non-null CSE scope");
DominanceInfo domInfo(cseScope->getParentOp());
bool cseChanged = false;
eliminateCommonSubExpressions(rewriter, domInfo, *cseScope, &cseChanged);
continueRewrites |= cseChanged;
}
```
This current one doesn't seem to respect the `config.setScope()`
https://github.com/llvm/llvm-project/pull/193081
More information about the Mlir-commits
mailing list