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

Jacques Pienaar llvmlistbot at llvm.org
Tue Dec 10 06:46:54 PST 2024


================
@@ -117,10 +126,18 @@ class GreedyRewriteConfig {
 ///
 /// Note: This method does not apply patterns to the region's parent operation.
 LogicalResult
+applyPatternsGreedily(Region &region, const FrozenRewritePatternSet &patterns,
+                      GreedyRewriteConfig config = GreedyRewriteConfig(),
+                      bool *changed = nullptr);
+/// Same as `applyPatternsAndGreedily` above with folding.
+inline LogicalResult
 applyPatternsAndFoldGreedily(Region &region,
                              const FrozenRewritePatternSet &patterns,
                              GreedyRewriteConfig config = GreedyRewriteConfig(),
-                             bool *changed = nullptr);
+                             bool *changed = nullptr) {
+  config.fold = true;
+  return applyPatternsGreedily(region, patterns, config, changed);
+}
 
----------------
jpienaar wrote:

Mostly as it is already widely used and so makes possible to integrate without much fanfare. I can mark it as deprecated for removal post. But it seemed good way to avoid too much effort on downstream for relatively little code.

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


More information about the Mlir-commits mailing list