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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Sep 11 19:59:29 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



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


1 Files Affected:

- (modified) mlir/lib/Dialect/Transform/IR/TransformOps.cpp (+1-3) 


``````````diff
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);
     }

``````````

</details>


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


More information about the Mlir-commits mailing list