[llvm] [ADT] Remove DenseMapBase::getHashValue (NFC) (PR #161123)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 28 21:11:51 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/161123

This patch removes:

  static unsigned getHashValue(const KeyT &Val) {
    return KeyInfoT::getHashValue(Val);
  }

This function is redundant given the templated overload:

  template <typename LookupKeyT>
  static unsigned getHashValue(const LookupKeyT &Val) {
    return KeyInfoT::getHashValue(Val);
  }

Note that the callers doFind and LookupBucketFor are themselves
templated on LookupKeyT.


>From 36134a386657c48bb2e4093f95d2391be85d7774 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 29 Aug 2025 16:01:54 -0700
Subject: [PATCH] [ADT] Remove DenseMapBase::getHashValue (NFC)

This patch removes:

  static unsigned getHashValue(const KeyT &Val) {
    return KeyInfoT::getHashValue(Val);
  }

This function is redundant given the templated overload:

  template <typename LookupKeyT>
  static unsigned getHashValue(const LookupKeyT &Val) {
    return KeyInfoT::getHashValue(Val);
  }

Note that the callers doFind and LookupBucketFor are themselves
templated on LookupKeyT.
---
 llvm/include/llvm/ADT/DenseMap.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h
index bcf3e9676a7b5..4bda50f5a5cc0 100644
--- a/llvm/include/llvm/ADT/DenseMap.h
+++ b/llvm/include/llvm/ADT/DenseMap.h
@@ -440,10 +440,6 @@ class DenseMapBase : public DebugEpochBase {
     }
   }
 
-  static unsigned getHashValue(const KeyT &Val) {
-    return KeyInfoT::getHashValue(Val);
-  }
-
   template <typename LookupKeyT>
   static unsigned getHashValue(const LookupKeyT &Val) {
     return KeyInfoT::getHashValue(Val);



More information about the llvm-commits mailing list