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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Sep 12 00:52:20 PDT 2024


Author: Kazu Hirata
Date: 2024-09-12T00:52:17-07:00
New Revision: 67e7f05aa0efb1fd61f74efb6e95b7720f94bcdd

URL: https://github.com/llvm/llvm-project/commit/67e7f05aa0efb1fd61f74efb6e95b7720f94bcdd
DIFF: https://github.com/llvm/llvm-project/commit/67e7f05aa0efb1fd61f74efb6e95b7720f94bcdd.diff

LOG: [Dialect] Avoid repeated hash lookups (NFC) (#108319)

Added: 
    

Modified: 
    mlir/lib/Dialect/Transform/IR/TransformOps.cpp

Removed: 
    


################################################################################
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