[Mlir-commits] [mlir] Add operands to worklist when only used by deleted op (PR #86990)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Mar 28 12:02:42 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 056b4043543cbc9e4ecad183db185bd26324b5b1 27500e1e09bcebed3413d0114b829d2acff45643 -- mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
index 2f2a15a0a2..e7a94fab82 100644
--- a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
+++ b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
@@ -377,7 +377,7 @@ private:
   /// be re-added to the worklist. This function should be called when an
   /// operation is modified or removed, as it may trigger further
   /// simplifications.
-  void addOperandsToWorklist(Operation* op);
+  void addOperandsToWorklist(Operation *op);
 
   /// Notify the driver that the given block was inserted.
   void notifyBlockInserted(Block *block, Region *previous,
@@ -688,7 +688,7 @@ void GreedyPatternRewriteDriver::notifyOperationModified(Operation *op) {
   addToWorklist(op);
 }
 
-void GreedyPatternRewriteDriver::addOperandsToWorklist(Operation* op) {
+void GreedyPatternRewriteDriver::addOperandsToWorklist(Operation *op) {
   for (Value operand : op->getOperands()) {
     // If this operand was only used by the op under consideration, we re-add
     // the operation that defined it to the worklist. Indeed, if the op is about
@@ -697,8 +697,10 @@ void GreedyPatternRewriteDriver::addOperandsToWorklist(Operation* op) {
     // TODO: if the operand has a single use besides the op under consideration,
     // there may be further canonicalization opportunities, so it should be
     // added to the worklist.
-    if (!operand) continue;
-    if (!llvm::all_of(operand.getUsers(), [&op](auto u) { return u == op; })) continue;
+    if (!operand)
+      continue;
+    if (!llvm::all_of(operand.getUsers(), [&op](auto u) { return u == op; }))
+      continue;
     if (auto *defOp = operand.getDefiningOp())
       addToWorklist(defOp);
   }

``````````

</details>


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


More information about the Mlir-commits mailing list