[llvm] r360831 - [ORC] Modify DenseMap hashing for SymbolStringPtrs.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Wed May 15 17:21:10 PDT 2019


Author: lhames
Date: Wed May 15 17:21:10 2019
New Revision: 360831

URL: http://llvm.org/viewvc/llvm-project?rev=360831&view=rev
Log:
[ORC] Modify DenseMap hashing for SymbolStringPtrs.

Modifies the DenseMapInfo<SymbolStringPtr>::getHashValue method to take its
argument by const-ref rather than by value (to avoid unnecessary ref-counting
operations) and to defer to DenseMapInfo<void*> for the hash value computation
(since SymbolStringPtrs are just pointers under the hood).

Modified:
    llvm/trunk/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h?rev=360831&r1=360830&r2=360831&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h Wed May 15 17:21:10 2019
@@ -157,9 +157,8 @@ struct DenseMapInfo<orc::SymbolStringPtr
     return orc::SymbolStringPtr(&orc::SymbolStringPtr::Tombstone);
   }
 
-  static unsigned getHashValue(orc::SymbolStringPtr V) {
-    uintptr_t IV = reinterpret_cast<uintptr_t>(V.S);
-    return unsigned(IV) ^ unsigned(IV >> 9);
+  static unsigned getHashValue(const orc::SymbolStringPtr &V) {
+    return DenseMapInfo<const void *>::getHashValue(V.S);
   }
 
   static bool isEqual(const orc::SymbolStringPtr &LHS,




More information about the llvm-commits mailing list