[llvm] [BOLT] Remove unused DenseMapInfo::getEmptyKey (PR #201986)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 5 19:52:07 PDT 2026


https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/201986

After #201281 DenseMapInfo<T>::getEmptyKey() is no longer used by
DenseMap. Remove the unused getEmptyKey definitions and dead sentinel
uses.


>From 44887b3bf7adb5afc6fdceb8ad613edf5e015abe Mon Sep 17 00:00:00 2001
From: Fangrui Song <i at maskray.me>
Date: Fri, 5 Jun 2026 19:08:11 -0700
Subject: [PATCH] [BOLT] Remove unused DenseMapInfo::getEmptyKey

After #201281 DenseMapInfo<T>::getEmptyKey() is no longer used by
DenseMap. Remove the unused getEmptyKey definitions and dead sentinel
uses.
---
 bolt/include/bolt/Passes/DataflowAnalysis.h | 5 -----
 bolt/include/bolt/Passes/SplitFunctions.h   | 1 -
 bolt/include/bolt/Profile/DataReader.h      | 3 ---
 3 files changed, 9 deletions(-)

diff --git a/bolt/include/bolt/Passes/DataflowAnalysis.h b/bolt/include/bolt/Passes/DataflowAnalysis.h
index 5d9442c85be19..72e4f68378617 100644
--- a/bolt/include/bolt/Passes/DataflowAnalysis.h
+++ b/bolt/include/bolt/Passes/DataflowAnalysis.h
@@ -565,11 +565,6 @@ class InstrsDataflowAnalysis
 /// DenseMapInfo allows us to use the DenseMap LLVM data structure to store
 /// ProgramPoints.
 template <> struct DenseMapInfo<bolt::ProgramPoint> {
-  static inline bolt::ProgramPoint getEmptyKey() {
-    uintptr_t Val = static_cast<uintptr_t>(-1);
-    Val <<= PointerLikeTypeTraits<MCInst *>::NumLowBitsAvailable;
-    return bolt::ProgramPoint(reinterpret_cast<MCInst *>(Val));
-  }
   static unsigned getHashValue(const bolt::ProgramPoint &PP) {
     return (unsigned((uintptr_t)PP.Data.BB) >> 4) ^
            (unsigned((uintptr_t)PP.Data.BB) >> 9);
diff --git a/bolt/include/bolt/Passes/SplitFunctions.h b/bolt/include/bolt/Passes/SplitFunctions.h
index ddbdaf0e7e5f4..0dce2943cddda 100644
--- a/bolt/include/bolt/Passes/SplitFunctions.h
+++ b/bolt/include/bolt/Passes/SplitFunctions.h
@@ -42,7 +42,6 @@ class SplitFunctions : public BinaryFunctionPass {
     TrampolineKey(const FragmentNum SourceFN, const MCSymbol *const Target)
         : SourceFN(SourceFN), Target(Target) {}
 
-    static inline TrampolineKey getEmptyKey() { return TrampolineKey(); };
     static unsigned getHashValue(const TrampolineKey &Val) {
       return llvm::hash_combine(Val.SourceFN.get(), Val.Target);
     }
diff --git a/bolt/include/bolt/Profile/DataReader.h b/bolt/include/bolt/Profile/DataReader.h
index 01bf17064432b..2661056772c0b 100644
--- a/bolt/include/bolt/Profile/DataReader.h
+++ b/bolt/include/bolt/Profile/DataReader.h
@@ -488,9 +488,6 @@ class DataReader : public ProfileReaderBase {
 /// DenseMapInfo allows us to use the DenseMap LLVM data structure to store
 /// Locations
 template <> struct DenseMapInfo<bolt::Location> {
-  static inline bolt::Location getEmptyKey() {
-    return bolt::Location(true, StringRef(), static_cast<uint64_t>(-1LL));
-  }
   static unsigned getHashValue(const bolt::Location &L) {
     return (unsigned(DenseMapInfo<StringRef>::getHashValue(L.Name)) >> 4) ^
            (unsigned(L.Offset));



More information about the llvm-commits mailing list