From 32052c841713ff22a3b44c42b83b3b88bc44d21b Mon Sep 17 00:00:00 2001 From: River Riddle Date: Fri, 23 Aug 2019 11:28:19 -0700 Subject: [PATCH] NFC: Add a note to 'applyPatternsGreedily' that it also performs folding/dce. Fixes tensorflow/mlir#72 PiperOrigin-RevId: 265097597 --- mlir/include/mlir/IR/PatternMatch.h | 2 ++ mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mlir/include/mlir/IR/PatternMatch.h b/mlir/include/mlir/IR/PatternMatch.h index 5e4fe60..b531a61 100644 --- a/mlir/include/mlir/IR/PatternMatch.h +++ b/mlir/include/mlir/IR/PatternMatch.h @@ -456,6 +456,8 @@ private: /// work-list driven manner. Return true if no more patterns can be matched in /// the result operation regions. /// Note: This does not apply patterns to the top-level operation itself. +/// Note: This method also performs folding and simply dead-code elimination +/// before attempting to match any of the provided patterns. /// bool applyPatternsGreedily(Operation *op, const OwningRewritePatternList &patterns); diff --git a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp index 3615808..3fb1998 100644 --- a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp +++ b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp @@ -204,9 +204,8 @@ bool GreedyPatternRewriteDriver::simplify(Operation *op, int maxIterations) { // Make sure that any new operations are inserted at this point. setInsertionPoint(op); - // Try to match one of the canonicalization patterns. The rewriter is - // automatically notified of any necessary changes, so there is nothing - // else to do here. + // Try to match one of the patterns. The rewriter is automatically + // notified of any necessary changes, so there is nothing else to do here. changed |= matcher.matchAndRewrite(op, *this); } } while (changed && ++i < maxIterations); -- 2.7.4