diff --git a/llvm/include/llvm/ADT/DenseMapInfo.h b/llvm/include/llvm/ADT/DenseMapInfo.h index 07c37e353a40b..8eb74a7793e26 100644 --- a/llvm/include/llvm/ADT/DenseMapInfo.h +++ b/llvm/include/llvm/ADT/DenseMapInfo.h @@ -82,8 +82,11 @@ struct DenseMapInfo { } static unsigned getHashValue(const T *PtrVal) { - return (unsigned((uintptr_t)PtrVal) >> 4) ^ - (unsigned((uintptr_t)PtrVal) >> 9); + uintptr_t Val = (uintptr_t)PtrVal; + uint32_t Rot = static_cast(Val); + Rot = (Rot >> 9) | (Rot << (32 - 9)); + Val += Rot; + return densemap::detail::mix(Val); } static bool isEqual(const T *LHS, const T *RHS) { return LHS == RHS; }