[Mlir-commits] [mlir] [mlir] Enable decoupling two kinds of greedy behavior. (PR #104649)

Matthias Springer llvmlistbot at llvm.org
Fri Aug 23 15:13:21 PDT 2024


================
@@ -840,6 +840,11 @@ LogicalResult RegionPatternRewriteDriver::simplify(bool *changed) && {
     // regions to enable more aggressive CSE'ing).
     OperationFolder folder(ctx, this);
     auto insertKnownConstant = [&](Operation *op) {
+      // This hoisting is to enable more folding, so skip checking if known
+      // constant, updating dense map etc if not doing folding.
+      if (!config.fold)
----------------
matthias-springer wrote:

`insertKnownConstant` is not really doing "folding": it does not call the folder. What it does is CSE'ing constants. So I would go as far as adding a second config flag: `cseConstants` (see #89552). Alternatively, update the `GreedyRewriteConfig::fold` documentation and mention that setting it to "false" also disables the CSE'ing of constants.


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


More information about the Mlir-commits mailing list