From: Lang Hames Date: Thu, 16 May 2019 00:21:10 +0000 (+0000) Subject: [ORC] Modify DenseMap hashing for SymbolStringPtrs. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eedb14b431629a7db1c1983d6d6c677bc1183404;p=llvm [ORC] Modify DenseMap hashing for SymbolStringPtrs. Modifies the DenseMapInfo::getHashValue method to take its argument by const-ref rather than by value (to avoid unnecessary ref-counting operations) and to defer to DenseMapInfo 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 --- diff --git a/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h b/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h index 39fa74bf313..d7502bdd8c9 100644 --- a/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h +++ b/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h @@ -157,9 +157,8 @@ struct DenseMapInfo { return orc::SymbolStringPtr(&orc::SymbolStringPtr::Tombstone); } - static unsigned getHashValue(orc::SymbolStringPtr V) { - uintptr_t IV = reinterpret_cast(V.S); - return unsigned(IV) ^ unsigned(IV >> 9); + static unsigned getHashValue(const orc::SymbolStringPtr &V) { + return DenseMapInfo::getHashValue(V.S); } static bool isEqual(const orc::SymbolStringPtr &LHS,