[libcxx-commits] [PATCH] D140779: Use hash value checks optimizations consistently

Dmitry Ilvokhin via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat May 13 10:50:15 PDT 2023


ilvokhin updated this revision to Diff 521920.
ilvokhin edited the summary of this revision.
ilvokhin added a comment.

Rebase and and comparison (before vs. after) with compare.py.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140779/new/

https://reviews.llvm.org/D140779

Files:
  libcxx/include/__hash_table


Index: libcxx/include/__hash_table
===================================================================
--- libcxx/include/__hash_table
+++ libcxx/include/__hash_table
@@ -1809,10 +1809,12 @@
         if (__ndptr != nullptr)
         {
             for (__ndptr = __ndptr->__next_; __ndptr != nullptr &&
-                                             std::__constrain_hash(__ndptr->__hash(), __bc) == __chash;
+                    (__ndptr->__hash() == __hash ||
+                     std::__constrain_hash(__ndptr->__hash(), __bc) == __chash);
                                                      __ndptr = __ndptr->__next_)
             {
-                if (key_eq()(__ndptr->__upcast()->__value_, __value))
+                if ((__ndptr->__hash() == __hash) &&
+                    key_eq()(__ndptr->__upcast()->__value_, __value))
                     return __ndptr;
             }
         }
@@ -2024,7 +2026,8 @@
                 (__nd->__hash() == __hash || std::__constrain_hash(__nd->__hash(), __bc) == __chash);
                                                            __nd = __nd->__next_)
             {
-                if (key_eq()(__nd->__upcast()->__value_, __k))
+                if ((__nd->__hash() == __hash) &&
+                    key_eq()(__nd->__upcast()->__value_, __k))
                     goto __done;
             }
         }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140779.521920.patch
Type: text/x-patch
Size: 1360 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230513/e164bc13/attachment.bin>


More information about the libcxx-commits mailing list