Skip to content

Commit cae7b6b

Browse files
River707tensorflower-gardener
authored andcommitted
NFC: Add a note to 'applyPatternsGreedily' that it also performs folding/dce.
Fixes #72 PiperOrigin-RevId: 265097597
1 parent 9e36fea commit cae7b6b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

third_party/mlir/include/mlir/IR/PatternMatch.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,8 @@ class RewritePatternMatcher {
456456
/// work-list driven manner. Return true if no more patterns can be matched in
457457
/// the result operation regions.
458458
/// Note: This does not apply patterns to the top-level operation itself.
459+
/// Note: This method also performs folding and simply dead-code elimination
460+
/// before attempting to match any of the provided patterns.
459461
///
460462
bool applyPatternsGreedily(Operation *op,
461463
const OwningRewritePatternList &patterns);

third_party/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,8 @@ bool GreedyPatternRewriteDriver::simplify(Operation *op, int maxIterations) {
204204
// Make sure that any new operations are inserted at this point.
205205
setInsertionPoint(op);
206206

207-
// Try to match one of the canonicalization patterns. The rewriter is
208-
// automatically notified of any necessary changes, so there is nothing
209-
// else to do here.
207+
// Try to match one of the patterns. The rewriter is automatically
208+
// notified of any necessary changes, so there is nothing else to do here.
210209
changed |= matcher.matchAndRewrite(op, *this);
211210
}
212211
} while (changed && ++i < maxIterations);

0 commit comments

Comments
 (0)