[llvm] [ADT] Update hash function of uint64_t for DenseMap (PR #95734)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 20 04:17:11 PDT 2024


================
@@ -137,7 +137,10 @@ template<> struct DenseMapInfo<unsigned long> {
   static inline unsigned long getTombstoneKey() { return ~0UL - 1L; }
 
   static unsigned getHashValue(const unsigned long& Val) {
-    return (unsigned)(Val * 37UL);
+    if constexpr (sizeof(Val) == 4)
+      return DenseMapInfo<unsigned>::getHashValue(Val);
+    else
+      return detail::combineHashValue(Val >> 32, Val);
----------------
RKSimon wrote:

MSVC has a tendency to analyze additional paths such as the non-constexpr else clause - we've hit similar problems before :( 

https://github.com/llvm/llvm-project/pull/95734


More information about the llvm-commits mailing list