diff --git a/mlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h b/mlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h --- a/mlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h +++ b/mlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h @@ -124,21 +124,6 @@ bool *allErased = nullptr, Region *scope = nullptr); -/// Applies the specified patterns on `op` alone while also trying to fold it, -/// by selecting the highest benefits patterns in a greedy manner. Returns -/// success if no more patterns can be matched. `erased` is set to true if `op` -/// was folded away or erased as a result of becoming dead. -/// -/// Returns success if the iterative process converged and no more patterns can -/// be matched. -inline LogicalResult -applyOpPatternsAndFold(Operation *op, const FrozenRewritePatternSet &patterns, - bool *erased = nullptr) { - return applyOpPatternsAndFold(ArrayRef(op), patterns, - GreedyRewriteStrictness::ExistingOps, - /*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 --- a/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp +++ b/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp @@ -322,7 +322,9 @@ RewritePatternSet patterns(res.getContext()); AffineForOp::getCanonicalizationPatterns(patterns, res.getContext()); bool erased; - (void)applyOpPatternsAndFold(res, std::move(patterns), &erased); + (void)applyOpPatternsAndFold(res.getOperation(), std::move(patterns), + GreedyRewriteStrictness::ExistingOps, + /*changed=*/nullptr, &erased); if (!erased && !prologue) prologue = res; diff --git a/mlir/lib/Dialect/Affine/Utils/Utils.cpp b/mlir/lib/Dialect/Affine/Utils/Utils.cpp --- a/mlir/lib/Dialect/Affine/Utils/Utils.cpp +++ b/mlir/lib/Dialect/Affine/Utils/Utils.cpp @@ -415,7 +415,9 @@ AffineIfOp::getCanonicalizationPatterns(patterns, ifOp.getContext()); bool erased; FrozenRewritePatternSet frozenPatterns(std::move(patterns)); - (void)applyOpPatternsAndFold(ifOp, frozenPatterns, &erased); + (void)applyOpPatternsAndFold(ifOp.getOperation(), frozenPatterns, + GreedyRewriteStrictness::ExistingOps, + /*changed=*/nullptr, &erased); if (erased) { if (folded) *folded = true; diff --git a/mlir/lib/Reducer/ReductionTreePass.cpp b/mlir/lib/Reducer/ReductionTreePass.cpp --- a/mlir/lib/Reducer/ReductionTreePass.cpp +++ b/mlir/lib/Reducer/ReductionTreePass.cpp @@ -63,7 +63,8 @@ for (Operation *op : opsInRange) // `applyOpPatternsAndFold` returns whether the op is convered. Omit it // because we don't have expectation this reduction will be success or not. - (void)applyOpPatternsAndFold(op, patterns); + (void)applyOpPatternsAndFold(op, patterns, + GreedyRewriteStrictness::ExistingOps); if (eraseOpNotInRange) for (Operation *op : opsNotInRange) {