[llvm] af82e63 - [ADT] DenseMapInfo<unsigned long>::getHashValue - avoid MSVC out of bounds shift warning (#96173)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 20 05:25:43 PDT 2024
Author: Simon Pilgrim
Date: 2024-06-20T13:25:40+01:00
New Revision: af82e63c28f67bf61a9b2b0e64bc55be4acf520e
URL: https://github.com/llvm/llvm-project/commit/af82e63c28f67bf61a9b2b0e64bc55be4acf520e
DIFF: https://github.com/llvm/llvm-project/commit/af82e63c28f67bf61a9b2b0e64bc55be4acf520e.diff
LOG: [ADT] DenseMapInfo<unsigned long>::getHashValue - avoid MSVC out of bounds shift warning (#96173)
Fixes MSVC warning after #95734 - despite it taking the `sizeof(Val) == 4` path, it still warns that the 32-bit unsigned long shift by 32 is out of bounds.
Added:
Modified:
llvm/include/llvm/ADT/DenseMapInfo.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/DenseMapInfo.h b/llvm/include/llvm/ADT/DenseMapInfo.h
index 4f0aaa1ad48bb..07c37e353a40b 100644
--- a/llvm/include/llvm/ADT/DenseMapInfo.h
+++ b/llvm/include/llvm/ADT/DenseMapInfo.h
@@ -142,7 +142,7 @@ template<> struct DenseMapInfo<unsigned long> {
if constexpr (sizeof(Val) == 4)
return DenseMapInfo<unsigned>::getHashValue(Val);
else
- return detail::combineHashValue(Val >> 32, Val);
+ return densemap::detail::mix(Val);
}
static bool isEqual(const unsigned long& LHS, const unsigned long& RHS) {
@@ -156,7 +156,7 @@ template<> struct DenseMapInfo<unsigned long long> {
static inline unsigned long long getTombstoneKey() { return ~0ULL - 1ULL; }
static unsigned getHashValue(const unsigned long long& Val) {
- return detail::combineHashValue(Val >> 32, Val);
+ return densemap::detail::mix(Val);
}
static bool isEqual(const unsigned long long& LHS,
More information about the llvm-commits
mailing list