[Mlir-commits] [mlir] 5706e9c - [mlir][NFC] GreedyPatternRewriteDriver: Remove single-op entry point

Matthias Springer llvmlistbot at llvm.org
Mon Jan 30 00:16:28 PST 2023


Author: Matthias Springer
Date: 2023-01-30T09:11:41+01:00
New Revision: 5706e9ca493ea6ea084c0468bcf1610b9a8d5522

URL: https://github.com/llvm/llvm-project/commit/5706e9ca493ea6ea084c0468bcf1610b9a8d5522
DIFF: https://github.com/llvm/llvm-project/commit/5706e9ca493ea6ea084c0468bcf1610b9a8d5522.diff

LOG: [mlir][NFC] GreedyPatternRewriteDriver: Remove single-op entry point

This is to simplify the API. The multi-op entry point can be used directly. GreedyRewriteStrictness must now be specified explicitly.

Depends On: D141396

Differential Revision: https://reviews.llvm.org/D142613

Added: 
    

Modified: 
    mlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h
    mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
    mlir/lib/Dialect/Affine/Utils/Utils.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h b/mlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h
index 217953493c41d..d8c17c67357b0 100644
--- a/mlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h
+++ b/mlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h
@@ -139,17 +139,6 @@ applyOpPatternsAndFold(ArrayRef<Operation *> ops,
                        GreedyRewriteConfig config = GreedyRewriteConfig(),
                        bool *changed = nullptr, bool *allErased = nullptr);
 
-/// Applies the specified patterns on `op` while also trying to fold it.
-/// This function is a shortcut for the ArrayRef<Operation *> overload and
-/// behaves the same way.
-inline LogicalResult
-applyOpPatternsAndFold(Operation *op, const FrozenRewritePatternSet &patterns,
-                       GreedyRewriteConfig config = GreedyRewriteConfig(),
-                       bool *erased = nullptr) {
-  return applyOpPatternsAndFold(ArrayRef(op), patterns, config,
-                                /*changed=*/nullptr, erased);
-}
-
 } // namespace mlir
 
 #endif // MLIR_TRANSFORMS_GREEDYPATTERNREWRITEDRIVER_H_

diff  --git a/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp b/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
index 54d2bd469db66..e7550d246e392 100644
--- a/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
+++ b/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
@@ -324,7 +324,8 @@ LogicalResult mlir::affineForOpBodySkew(AffineForOp forOp,
         GreedyRewriteConfig config;
         config.strictMode = GreedyRewriteStrictness::ExistingOps;
         bool erased;
-        (void)applyOpPatternsAndFold(res, std::move(patterns), config, &erased);
+        (void)applyOpPatternsAndFold(res.getOperation(), std::move(patterns),
+                                     config, /*changed=*/nullptr, &erased);
         if (!erased && !prologue)
           prologue = res;
         if (!erased)

diff  --git a/mlir/lib/Dialect/Affine/Utils/Utils.cpp b/mlir/lib/Dialect/Affine/Utils/Utils.cpp
index 24acc60cd1832..d731241a62661 100644
--- a/mlir/lib/Dialect/Affine/Utils/Utils.cpp
+++ b/mlir/lib/Dialect/Affine/Utils/Utils.cpp
@@ -417,7 +417,8 @@ LogicalResult mlir::hoistAffineIfOp(AffineIfOp ifOp, bool *folded) {
   GreedyRewriteConfig config;
   config.strictMode = GreedyRewriteStrictness::ExistingOps;
   bool erased;
-  (void)applyOpPatternsAndFold(ifOp, frozenPatterns, config, &erased);
+  (void)applyOpPatternsAndFold(ifOp.getOperation(), frozenPatterns, config,
+                               /*changed=*/nullptr, &erased);
   if (erased) {
     if (folded)
       *folded = true;


        


More information about the Mlir-commits mailing list