[Mlir-commits] [mlir] [mlir][docs] Update MLIR's PatternRewriter documentation (PR #116183)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Nov 14 00:38:53 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Jefferson Le Quellec (jle-quel)

<details>
<summary>Changes</summary>

## Description

This PR adds the missing `const override` to the `rewrite` and `matchAndRewrite` declaration in the Pattern Rewriter documentation as described here:

https://github.com/llvm/llvm-project/blob/5cfa8baef33636827e5aa8dd76888c724433b53e/mlir/include/mlir/IR/PatternMatch.h#L237-L265



---
Full diff: https://github.com/llvm/llvm-project/pull/116183.diff


1 Files Affected:

- (modified) mlir/docs/PatternRewriter.md (+2-2) 


``````````diff
diff --git a/mlir/docs/PatternRewriter.md b/mlir/docs/PatternRewriter.md
index c61ceaf81681e2..2f1483db8190a7 100644
--- a/mlir/docs/PatternRewriter.md
+++ b/mlir/docs/PatternRewriter.md
@@ -73,7 +73,7 @@ public:
     // otherwise.
     // ...
   }
-  void rewrite(Operation *op, PatternRewriter &rewriter) {
+  void rewrite(Operation *op, PatternRewriter &rewriter) const override {
     // The `rewrite` method performs mutations on the IR rooted at `op` using
     // the provided rewriter. All mutations must go through the provided
     // rewriter.
@@ -81,7 +81,7 @@ public:
 
   /// In this section, the `match` and `rewrite` implementation is specified
   /// using a single hook.
-  LogicalResult matchAndRewrite(Operation *op, PatternRewriter &rewriter) {
+  LogicalResult matchAndRewrite(Operation *op, PatternRewriter &rewriter) const override {
     // The `matchAndRewrite` method performs both the matching and the mutation.
     // Note that the match must reach a successful point before IR mutation may
     // take place.

``````````

</details>


https://github.com/llvm/llvm-project/pull/116183


More information about the Mlir-commits mailing list