[clang] [Serialization] Use specialized decl hash function for GlobalDeclID (PR #95730)
Anton Korobeynikov via cfe-commits
cfe-commits at lists.llvm.org
Sun Jun 16 23:06:18 PDT 2024
================
@@ -230,7 +230,11 @@ template <> struct DenseMapInfo<clang::GlobalDeclID> {
}
static unsigned getHashValue(const GlobalDeclID &Key) {
- return DenseMapInfo<DeclID>::getHashValue(Key.get());
+ // Our default hash algorithm for 64 bits integer may not be very good.
+ // In GlobalDeclID's case, it is pretty common that the lower 32 bits can
+ // be same.
+ return DenseMapInfo<uint32_t>::getHashValue(Key.getModuleFileIndex()) ^
----------------
asl wrote:
Can you use `hash_combine` from `llvm/ADT/Hash.h`?
https://github.com/llvm/llvm-project/pull/95730
More information about the cfe-commits
mailing list