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

Jianjian Guan llvmlistbot at llvm.org
Thu Sep 12 01:29:27 PDT 2024


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

None

>From c660fdfa9d3d9cb4888fa56fef0a195eaacbb710 Mon Sep 17 00:00:00 2001
From: Jianjian GUAN <jacquesguan at me.com>
Date: Wed, 11 Sep 2024 16:12:07 +0800
Subject: [PATCH] [NFC][mlir] Simplify code

---
 .../Transform/Interfaces/TransformInterfaces.cpp       | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

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);



More information about the Mlir-commits mailing list