NFC: Add a note to 'applyPatternsGreedily' that it also performs folding/dce.
authorRiver Riddle <riverriddle@google.com>
Fri, 23 Aug 2019 18:28:19 +0000 (11:28 -0700)
committerA. Unique TensorFlower <gardener@tensorflow.org>
Fri, 23 Aug 2019 18:28:45 +0000 (11:28 -0700)
Fixes tensorflow/mlir#72

PiperOrigin-RevId: 265097597

mlir/include/mlir/IR/PatternMatch.h
mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp

index 5e4fe60..b531a61 100644 (file)
@@ -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);
index 3615808..3fb1998 100644 (file)
@@ -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);