[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).

llvm-svn: 360831

llvm/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h

index 39fa74b..d7502bd 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,