[Mlir-commits] [mlir] [Dialect] Avoid repeated hash lookups (NFC) (PR #108319)

Kazu Hirata llvmlistbot at llvm.org
Wed Sep 11 19:59:00 PDT 2024


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/108319

None

>From f2503fe80439e6c410914d2ad87409a19302dc2e Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 11 Sep 2024 06:47:33 -0700
Subject: [PATCH] [Dialect] Avoid repeated hash lookups (NFC)

---
 mlir/lib/Dialect/Transform/IR/TransformOps.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
index c4238080533bef..14d97964964bb9 100644
--- a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
+++ b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
@@ -1588,10 +1588,8 @@ transform::GetParentOp::apply(transform::TransformRewriter &rewriter,
       }
     }
     if (getDeduplicate()) {
-      if (!resultSet.contains(parent)) {
+      if (resultSet.insert(parent).second)
         parents.push_back(parent);
-        resultSet.insert(parent);
-      }
     } else {
       parents.push_back(parent);
     }



More information about the Mlir-commits mailing list