[Mlir-commits] [mlir] [NFC][mlir] Simplify code (PR #108346)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Sep 12 01:29:56 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Jianjian Guan (jacquesguan)

<details>
<summary>Changes</summary>



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


1 Files Affected:

- (modified) mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp (+4-6) 


``````````diff
diff --git a/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp b/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp
index 5bc6d4ee5033f1..91702ce7cc42b9 100644
--- a/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp
+++ b/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp
@@ -934,12 +934,10 @@ transform::TransformState::applyTransform(TransformOpInterface transform) {
     assert(scopeIt != regionStack.rend() &&
            "could not find region scope for handle");
     RegionScope *scope = *scopeIt;
-    for (Operation *user : handle.getUsers()) {
-      if (user != scope->currentTransform &&
-          !happensBefore(user, scope->currentTransform))
-        return false;
-    }
-    return true;
+    return llvm::all_of(handle.getUsers(), [&](Operation *user) {
+      return user == scope->currentTransform ||
+             happensBefore(user, scope->currentTransform);
+    });
   };
   transform::ErrorCheckingTrackingListener trackingListener(*this, transform,
                                                             config);

``````````

</details>


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


More information about the Mlir-commits mailing list