llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Chuanqi Xu (ChuanqiXu9) <details> <summary>Changes</summary> See the comment: https://github.com/llvm/llvm-project/pull/92083#issuecomment-2168121729 After the patch, https://github.com/llvm/llvm-project/pull/92083, the lower 32 bits of DeclID can be the same commonly. This may produce many collisions. It will be best to change the default hash implementation for uint64_t. But sent this one as a quick workaround. --- Full diff: https://github.com/llvm/llvm-project/pull/95730.diff 1 Files Affected: - (modified) clang/include/clang/AST/DeclID.h (+5-1) ``````````diff diff --git a/clang/include/clang/AST/DeclID.h b/clang/include/clang/AST/DeclID.h index 32d2ed41a374a..4ad7afb463b18 100644 --- a/clang/include/clang/AST/DeclID.h +++ b/clang/include/clang/AST/DeclID.h @@ -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()) ^ + DenseMapInfo<uint32_t>::getHashValue(Key.getLocalDeclIndex()); } static bool isEqual(const GlobalDeclID &L, const GlobalDeclID &R) { `````````` </details> https://github.com/llvm/llvm-project/pull/95730 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits