[llvm] [DenseMap] Share rehash and grow for relocatable bucket types. NFC (PR #225018)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 01:18:46 PDT 2026
================
@@ -56,6 +56,9 @@ template <typename T, typename Enable = void> struct DenseMapInfo {
// Provide DenseMapInfo for all pointers. Avoid requiring T to be complete so
// clients can instantiate DenseMap<T*, ...> with forward declared key types.
template <typename T> struct DenseMapInfo<T *> {
+ // Select InlinePtrHash in DenseMap.cpp.
+ using PointerValueHash = DenseMapInfo;
----------------
MaskRay wrote:
`using PointerValueHash = DenseMapInfo;` (type alias) is intentional.
```cpp
// X * cannot take the `hashesPointerValue` code path.
template <> struct DenseMapInfo<X *> : DenseMapInfo<Y *> {
static unsigned getHashValue(const X *P) { return P->V * 37; }
static bool isEqual(const X *L, const X *R) { return L == R; }
};
```
== alias hashesPointerValue<X *, DenseMapInfo<X *>> = 0 found 200 of 200 after grow
== bool hashesPointerValue<X *, DenseMapInfo<X *>> = 1 found 0 of 200 after grow
```
https://github.com/llvm/llvm-project/pull/225018
More information about the llvm-commits
mailing list