[Mlir-commits] [mlir] [mlir][Transforms][NFC] GreedyPatternRewriteDriver: Remove redundant worklist management code (PR #74796)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Dec 7 18:20:47 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-core

Author: Matthias Springer (matthias-springer)

<details>
<summary>Changes</summary>

Do not add the previous users of replaced ops to the worklist during `notifyOperationReplaced`.

The previous users are modified inplace as part of `PatternRewriter::replaceOp`, which calls `PatternRewriter::replaceAllUsesWith`. The latter function updates all users with `updateRootInPlace`, which already puts all previous users of the replaced op on the worklist. No further worklist management work is needed in the `notifyOperationReplaced` callback.

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


1 Files Affected:

- (modified) mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp (-3) 


``````````diff
diff --git a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
index 8e2bfe557c555..7decbce018a87 100644
--- a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
+++ b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
@@ -581,9 +581,6 @@ void GreedyPatternRewriteDriver::notifyOperationReplaced(
   });
   if (config.listener)
     config.listener->notifyOperationReplaced(op, replacement);
-  for (auto result : op->getResults())
-    for (auto *user : result.getUsers())
-      addToWorklist(user);
 }
 
 LogicalResult GreedyPatternRewriteDriver::notifyMatchFailure(

``````````

</details>


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


More information about the Mlir-commits mailing list