]> granicus.if.org Git - llvm/commitdiff
[ORC] Modify DenseMap hashing for SymbolStringPtrs.
authorLang Hames <lhames@gmail.com>
Thu, 16 May 2019 00:21:10 +0000 (00:21 +0000)
committerLang Hames <lhames@gmail.com>
Thu, 16 May 2019 00:21:10 +0000 (00:21 +0000)
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).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360831 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ExecutionEngine/Orc/SymbolStringPool.h

index 39fa74bf313262f3006b28edca448059048ce7a8..d7502bdd8c99c86f1e6e988f29455e630f9406b4 100644 (file)
@@ -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,