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

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


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

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


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

After #201281 DenseMapInfo<T>::getEmptyKey() is no longer used by
DenseMap. Remove the unused getEmptyKey definitions and dead sentinel
uses.
---
 llvm/include/llvm/BinaryFormat/Minidump.h         |  2 --
 llvm/include/llvm/BinaryFormat/WasmTraits.h       | 15 ---------------
 llvm/include/llvm/CAS/CASID.h                     |  5 -----
 llvm/include/llvm/CAS/CASReference.h              | 12 ------------
 llvm/include/llvm/CodeGenTypes/LowLevelType.h     |  5 -----
 .../DWARFLinker/Classic/DWARFLinkerDeclContext.h  |  4 ----
 .../ExecutionEngine/Orc/Shared/ExecutorAddress.h  |  4 ----
 .../llvm/ExecutionEngine/Orc/Shared/MemoryFlags.h |  4 ----
 .../llvm/ExecutionEngine/Orc/SymbolStringPool.h   |  8 --------
 llvm/include/llvm/Frontend/OpenMP/OMPContext.h    |  3 ---
 llvm/include/llvm/Linker/IRMover.h                |  1 -
 llvm/include/llvm/MC/MCRegister.h                 |  3 ---
 llvm/include/llvm/Object/ObjectFile.h             |  3 ---
 .../llvm/ProfileData/Coverage/CoverageMapping.h   |  8 --------
 llvm/include/llvm/ProfileData/FunctionId.h        |  4 ----
 llvm/include/llvm/ProfileData/SampleProf.h        |  2 --
 llvm/include/llvm/SandboxIR/Context.h             |  3 ---
 llvm/include/llvm/TextAPI/SymbolSet.h             |  4 ----
 llvm/lib/Linker/IRMover.cpp                       |  8 --------
 llvm/lib/Object/Minidump.cpp                      |  3 ---
 llvm/tools/dsymutil/BinaryHolder.h                |  4 ----
 llvm/tools/llvm-c-test/echo.cpp                   |  4 ----
 llvm/tools/llvm-reduce/deltas/Delta.h             |  5 -----
 llvm/tools/llvm-split/llvm-split.cpp              |  2 --
 .../TableGen/Basic/RuntimeLibcallsEmitter.cpp     |  5 -----
 25 files changed, 121 deletions(-)

diff --git a/llvm/include/llvm/BinaryFormat/Minidump.h b/llvm/include/llvm/BinaryFormat/Minidump.h
index 012838af2e7aa..4e96b54415e84 100644
--- a/llvm/include/llvm/BinaryFormat/Minidump.h
+++ b/llvm/include/llvm/BinaryFormat/Minidump.h
@@ -270,8 +270,6 @@ static_assert(sizeof(ExceptionStream) == 168);
 } // namespace minidump
 
 template <> struct DenseMapInfo<minidump::StreamType> {
-  static minidump::StreamType getEmptyKey() { return minidump::StreamType(-1); }
-
   static unsigned getHashValue(minidump::StreamType Val) {
     return DenseMapInfo<uint32_t>::getHashValue(static_cast<uint32_t>(Val));
   }
diff --git a/llvm/include/llvm/BinaryFormat/WasmTraits.h b/llvm/include/llvm/BinaryFormat/WasmTraits.h
index 35bd89067a880..46eae5bb4302c 100644
--- a/llvm/include/llvm/BinaryFormat/WasmTraits.h
+++ b/llvm/include/llvm/BinaryFormat/WasmTraits.h
@@ -20,11 +20,6 @@ namespace llvm {
 
 // Traits for using WasmSignature in a DenseMap.
 template <> struct DenseMapInfo<wasm::WasmSignature, void> {
-  static wasm::WasmSignature getEmptyKey() {
-    wasm::WasmSignature Sig;
-    Sig.State = wasm::WasmSignature::Empty;
-    return Sig;
-  }
   static unsigned getHashValue(const wasm::WasmSignature &Sig) {
     uintptr_t H = hash_value(Sig.State);
     for (auto Ret : Sig.Returns)
@@ -41,9 +36,6 @@ template <> struct DenseMapInfo<wasm::WasmSignature, void> {
 
 // Traits for using WasmGlobalType in a DenseMap
 template <> struct DenseMapInfo<wasm::WasmGlobalType, void> {
-  static wasm::WasmGlobalType getEmptyKey() {
-    return wasm::WasmGlobalType{1, true};
-  }
   static unsigned getHashValue(const wasm::WasmGlobalType &GlobalType) {
     return hash_combine(GlobalType.Type, GlobalType.Mutable);
   }
@@ -55,9 +47,6 @@ template <> struct DenseMapInfo<wasm::WasmGlobalType, void> {
 
 // Traits for using WasmLimits in a DenseMap
 template <> struct DenseMapInfo<wasm::WasmLimits, void> {
-  static wasm::WasmLimits getEmptyKey() {
-    return wasm::WasmLimits{0xff, 0xff, 0xff, 0xff};
-  }
   static unsigned getHashValue(const wasm::WasmLimits &Limits) {
     unsigned Hash = hash_value(Limits.Flags);
     Hash = hash_combine(Hash, Limits.Minimum);
@@ -74,10 +63,6 @@ template <> struct DenseMapInfo<wasm::WasmLimits, void> {
 
 // Traits for using WasmTableType in a DenseMap
 template <> struct DenseMapInfo<wasm::WasmTableType, void> {
-  static wasm::WasmTableType getEmptyKey() {
-    return wasm::WasmTableType{
-        wasm::ValType(0), DenseMapInfo<wasm::WasmLimits, void>::getEmptyKey()};
-  }
   static unsigned getHashValue(const wasm::WasmTableType &TableType) {
     return hash_combine(
         TableType.ElemType,
diff --git a/llvm/include/llvm/CAS/CASID.h b/llvm/include/llvm/CAS/CASID.h
index 81a7089a2ca05..dee0f7c34500e 100644
--- a/llvm/include/llvm/CAS/CASID.h
+++ b/llvm/include/llvm/CAS/CASID.h
@@ -103,9 +103,6 @@ class CASID {
     return *Context;
   }
 
-  static CASID getDenseMapEmptyKey() {
-    return CASID(nullptr, DenseMapInfo<StringRef>::getEmptyKey());
-  }
   static CASID getDenseMapTombstoneKey() {
     // A reserved StringRef value distinct from the empty key, used only as a
     // DenseMap sentinel for CASID.
@@ -132,8 +129,6 @@ class CASID {
 } // namespace cas
 
 template <> struct DenseMapInfo<cas::CASID> {
-  static cas::CASID getEmptyKey() { return cas::CASID::getDenseMapEmptyKey(); }
-
   static unsigned getHashValue(cas::CASID ID) {
     return (unsigned)hash_value(ID);
   }
diff --git a/llvm/include/llvm/CAS/CASReference.h b/llvm/include/llvm/CAS/CASReference.h
index 04242f55499bc..5fbb326dfe8ab 100644
--- a/llvm/include/llvm/CAS/CASReference.h
+++ b/llvm/include/llvm/CAS/CASReference.h
@@ -26,7 +26,6 @@ class ObjectRef;
 /// Base class for references to things in \a ObjectStore.
 class ReferenceBase {
 protected:
-  struct DenseMapEmptyTag {};
   static constexpr uint64_t getDenseMapEmptyRef() { return -1ULL; }
   static constexpr uint64_t getDenseMapTombstoneRef() { return -2ULL; }
 
@@ -75,8 +74,6 @@ class ReferenceBase {
     assert(InternalRef != getDenseMapTombstoneRef() &&
            "Reserved for DenseMapInfo");
   }
-  explicit ReferenceBase(DenseMapEmptyTag)
-      : InternalRef(getDenseMapEmptyRef()) {}
 
 private:
   uint64_t InternalRef;
@@ -113,10 +110,6 @@ class ObjectRef : public ReferenceBase {
     return !(LHS == RHS);
   }
 
-  static ObjectRef getDenseMapEmptyKey() {
-    return ObjectRef(DenseMapEmptyTag{});
-  }
-
   /// Print internal ref and/or CASID. Only suitable for debugging.
   void print(raw_ostream &OS) const { return ReferenceBase::print(OS, *this); }
 
@@ -131,7 +124,6 @@ class ObjectRef : public ReferenceBase {
     assert(InternalRef != -1ULL && "Reserved for DenseMapInfo");
     assert(InternalRef != -2ULL && "Reserved for DenseMapInfo");
   }
-  explicit ObjectRef(DenseMapEmptyTag T) : ReferenceBase(T) {}
   explicit ObjectRef(ReferenceBase) = delete;
 };
 
@@ -166,10 +158,6 @@ class ObjectHandle : public ReferenceBase {
 } // namespace cas
 
 template <> struct DenseMapInfo<cas::ObjectRef> {
-  static cas::ObjectRef getEmptyKey() {
-    return cas::ObjectRef::getDenseMapEmptyKey();
-  }
-
   static unsigned getHashValue(cas::ObjectRef Ref) {
     return Ref.getDenseMapHash();
   }
diff --git a/llvm/include/llvm/CodeGenTypes/LowLevelType.h b/llvm/include/llvm/CodeGenTypes/LowLevelType.h
index f91a9fe6c50fd..c3277ba95f86f 100644
--- a/llvm/include/llvm/CodeGenTypes/LowLevelType.h
+++ b/llvm/include/llvm/CodeGenTypes/LowLevelType.h
@@ -717,11 +717,6 @@ inline raw_ostream &operator<<(raw_ostream &OS, const LLT &Ty) {
 }
 
 template <> struct DenseMapInfo<LLT> {
-  static inline LLT getEmptyKey() {
-    LLT Invalid;
-    Invalid.Info = LLT::Kind::POINTER;
-    return Invalid;
-  }
   static inline unsigned getHashValue(const LLT &Ty) {
     uint64_t Val = Ty.getUniqueRAWLLTData();
     return DenseMapInfo<uint64_t>::getHashValue(Val);
diff --git a/llvm/include/llvm/DWARFLinker/Classic/DWARFLinkerDeclContext.h b/llvm/include/llvm/DWARFLinker/Classic/DWARFLinkerDeclContext.h
index 34977cbe4eb8d..d16387b28d332 100644
--- a/llvm/include/llvm/DWARFLinker/Classic/DWARFLinkerDeclContext.h
+++ b/llvm/include/llvm/DWARFLinker/Classic/DWARFLinkerDeclContext.h
@@ -172,15 +172,11 @@ class DeclContextTree {
 
 /// Info type for the DenseMap storing the DeclContext pointers.
 struct DeclMapInfo : private DenseMapInfo<DeclContext *> {
-  using DenseMapInfo<DeclContext *>::getEmptyKey;
-
   static unsigned getHashValue(const DeclContext *Ctxt) {
     return Ctxt->QualifiedNameHash;
   }
 
   static bool isEqual(const DeclContext *LHS, const DeclContext *RHS) {
-    if (RHS == getEmptyKey())
-      return RHS == LHS;
     return LHS->QualifiedNameHash == RHS->QualifiedNameHash &&
            LHS->Line == RHS->Line && LHS->ByteSize == RHS->ByteSize &&
            LHS->NameForUniquing.data() == RHS->NameForUniquing.data() &&
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h
index 9c72b28d1169f..688d0bc1da0f2 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h
@@ -344,10 +344,6 @@ using SPSExecutorAddrRangeSequence = SPSSequence<SPSExecutorAddrRange>;
 
 // Provide DenseMapInfo for ExecutorAddrs.
 template <> struct DenseMapInfo<orc::ExecutorAddr> {
-  static inline orc::ExecutorAddr getEmptyKey() {
-    return orc::ExecutorAddr(DenseMapInfo<uint64_t>::getEmptyKey());
-  }
-
   static unsigned getHashValue(const orc::ExecutorAddr &Addr) {
     return DenseMapInfo<uint64_t>::getHashValue(Addr.getValue());
   }
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/MemoryFlags.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/MemoryFlags.h
index 696632e9132f7..4952106610af6 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/MemoryFlags.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/MemoryFlags.h
@@ -209,7 +209,6 @@ inline raw_ostream &operator<<(raw_ostream &OS, AllocGroup AG) {
 } // end namespace orc
 
 template <> struct DenseMapInfo<orc::MemProt> {
-  static inline orc::MemProt getEmptyKey() { return orc::MemProt(~uint8_t(0)); }
   static unsigned getHashValue(const orc::MemProt &Val) {
     using UT = std::underlying_type_t<orc::MemProt>;
     return DenseMapInfo<UT>::getHashValue(static_cast<UT>(Val));
@@ -220,9 +219,6 @@ template <> struct DenseMapInfo<orc::MemProt> {
 };
 
 template <> struct DenseMapInfo<orc::AllocGroup> {
-  static inline orc::AllocGroup getEmptyKey() {
-    return orc::AllocGroup(~uint8_t(0));
-  }
   static unsigned getHashValue(const orc::AllocGroup &Val) {
     return DenseMapInfo<orc::AllocGroup::underlying_type>::getHashValue(Val.Id);
   }
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h b/llvm/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h
index 48be96d98d100..6629ae7789b81 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h
@@ -329,10 +329,6 @@ inline hash_code hash_value(const orc::SymbolStringPtrBase &S) {
 template <>
 struct DenseMapInfo<orc::SymbolStringPtr> {
 
-  static orc::SymbolStringPtr getEmptyKey() {
-    return orc::SymbolStringPtr::getEmptyVal();
-  }
-
   static unsigned getHashValue(const orc::SymbolStringPtrBase &V) {
     return DenseMapInfo<orc::SymbolStringPtr::PoolEntryPtr>::getHashValue(V.S);
   }
@@ -345,10 +341,6 @@ struct DenseMapInfo<orc::SymbolStringPtr> {
 
 template <> struct DenseMapInfo<orc::NonOwningSymbolStringPtr> {
 
-  static orc::NonOwningSymbolStringPtr getEmptyKey() {
-    return orc::NonOwningSymbolStringPtr::getEmptyVal();
-  }
-
   static unsigned getHashValue(const orc::SymbolStringPtrBase &V) {
     return DenseMapInfo<
         orc::NonOwningSymbolStringPtr::PoolEntryPtr>::getHashValue(V.S);
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPContext.h b/llvm/include/llvm/Frontend/OpenMP/OMPContext.h
index 83ad94f13dda4..7849d32665994 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPContext.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPContext.h
@@ -202,9 +202,6 @@ getBestVariantMatchForContext(const SmallVectorImpl<VariantMatchInfo> &VMIs,
 } // namespace omp
 
 template <> struct DenseMapInfo<omp::TraitProperty> {
-  static inline omp::TraitProperty getEmptyKey() {
-    return omp::TraitProperty(-1);
-  }
   static unsigned getHashValue(omp::TraitProperty val) {
     return std::hash<unsigned>{}(unsigned(val));
   }
diff --git a/llvm/include/llvm/Linker/IRMover.h b/llvm/include/llvm/Linker/IRMover.h
index ce3509330d329..0ec8a51ed570d 100644
--- a/llvm/include/llvm/Linker/IRMover.h
+++ b/llvm/include/llvm/Linker/IRMover.h
@@ -38,7 +38,6 @@ class IRMover {
       LLVM_ABI bool operator==(const KeyTy &that) const;
       LLVM_ABI bool operator!=(const KeyTy &that) const;
     };
-    LLVM_ABI static StructType *getEmptyKey();
     LLVM_ABI static unsigned getHashValue(const KeyTy &Key);
     LLVM_ABI static unsigned getHashValue(const StructType *ST);
     LLVM_ABI static bool isEqual(const KeyTy &LHS, const StructType *RHS);
diff --git a/llvm/include/llvm/MC/MCRegister.h b/llvm/include/llvm/MC/MCRegister.h
index 60bfacf82a799..c176904be35c3 100644
--- a/llvm/include/llvm/MC/MCRegister.h
+++ b/llvm/include/llvm/MC/MCRegister.h
@@ -109,9 +109,6 @@ class MCRegister {
 
 // Provide DenseMapInfo for MCRegister
 template <> struct DenseMapInfo<MCRegister> {
-  static inline MCRegister getEmptyKey() {
-    return DenseMapInfo<unsigned>::getEmptyKey();
-  }
   static unsigned getHashValue(const MCRegister &Val) {
     return DenseMapInfo<unsigned>::getHashValue(Val.id());
   }
diff --git a/llvm/include/llvm/Object/ObjectFile.h b/llvm/include/llvm/Object/ObjectFile.h
index 823b6a7e51f84..89ab7a70de55b 100644
--- a/llvm/include/llvm/Object/ObjectFile.h
+++ b/llvm/include/llvm/Object/ObjectFile.h
@@ -653,9 +653,6 @@ template <> struct DenseMapInfo<object::SectionRef> {
                       const object::SectionRef &B) {
     return A == B;
   }
-  static object::SectionRef getEmptyKey() {
-    return object::SectionRef({}, nullptr);
-  }
   static unsigned getHashValue(const object::SectionRef &Sec) {
     object::DataRefImpl Raw = Sec.getRawDataRefImpl();
     return hash_combine(Raw.p, Raw.d.a, Raw.d.b);
diff --git a/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h b/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
index ccd7ebd6fd75e..64a16fba17740 100644
--- a/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
+++ b/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
@@ -1526,14 +1526,6 @@ template <class IntPtrT> struct CovMapTraits<CovMapVersion::Version1, IntPtrT> {
 
 /// Provide DenseMapInfo for CounterExpression
 template<> struct DenseMapInfo<coverage::CounterExpression> {
-  static inline coverage::CounterExpression getEmptyKey() {
-    using namespace coverage;
-
-    return CounterExpression(CounterExpression::ExprKind::Subtract,
-                             Counter::getCounter(~0U),
-                             Counter::getCounter(~0U));
-  }
-
   static unsigned getHashValue(const coverage::CounterExpression &V) {
     return static_cast<unsigned>(
         hash_combine(V.Kind, V.LHS.getKind(), V.LHS.getCounterID(),
diff --git a/llvm/include/llvm/ProfileData/FunctionId.h b/llvm/include/llvm/ProfileData/FunctionId.h
index 5f8248111a1bb..ef43573da8b49 100644
--- a/llvm/include/llvm/ProfileData/FunctionId.h
+++ b/llvm/include/llvm/ProfileData/FunctionId.h
@@ -178,10 +178,6 @@ inline uint64_t hash_value(const FunctionId &Obj) {
 /// containers.
 template <> struct DenseMapInfo<sampleprof::FunctionId, void> {
 
-  static inline sampleprof::FunctionId getEmptyKey() {
-    return sampleprof::FunctionId(~0ULL);
-  }
-
   static unsigned getHashValue(const sampleprof::FunctionId &Val) {
     return Val.getHashCode();
   }
diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h
index 97fe3acbfec9d..534c97b295bc5 100644
--- a/llvm/include/llvm/ProfileData/SampleProf.h
+++ b/llvm/include/llvm/ProfileData/SampleProf.h
@@ -1704,8 +1704,6 @@ class ProfileSymbolList {
 using namespace sampleprof;
 // Provide DenseMapInfo for SampleContext.
 template <> struct DenseMapInfo<SampleContext> {
-  static inline SampleContext getEmptyKey() { return SampleContext(); }
-
   static unsigned getHashValue(const SampleContext &Val) {
     return Val.getHashCode();
   }
diff --git a/llvm/include/llvm/SandboxIR/Context.h b/llvm/include/llvm/SandboxIR/Context.h
index 9afc47fc29fc0..750892eb84933 100644
--- a/llvm/include/llvm/SandboxIR/Context.h
+++ b/llvm/include/llvm/SandboxIR/Context.h
@@ -318,9 +318,6 @@ template <> struct DenseMapInfo<sandboxir::Context::CallbackID> {
   using CallbackID = sandboxir::Context::CallbackID;
   using ReprInfo = DenseMapInfo<CallbackID::ValTy>;
 
-  static CallbackID getEmptyKey() {
-    return CallbackID{ReprInfo::getEmptyKey()};
-  }
   static unsigned getHashValue(const CallbackID &ID) {
     return ReprInfo::getHashValue(ID.Val);
   }
diff --git a/llvm/include/llvm/TextAPI/SymbolSet.h b/llvm/include/llvm/TextAPI/SymbolSet.h
index a5890d19d9ca9..9c7a11899e8cf 100644
--- a/llvm/include/llvm/TextAPI/SymbolSet.h
+++ b/llvm/include/llvm/TextAPI/SymbolSet.h
@@ -31,10 +31,6 @@ struct SymbolsMapKey {
       : Kind(Kind), Name(Name) {}
 };
 template <> struct DenseMapInfo<SymbolsMapKey> {
-  static inline SymbolsMapKey getEmptyKey() {
-    return SymbolsMapKey(MachO::EncodeKind::GlobalSymbol, StringRef{});
-  }
-
   static unsigned getHashValue(const SymbolsMapKey &Key) {
     return hash_combine(hash_value(Key.Kind), hash_value(Key.Name));
   }
diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp
index 57911ef50335d..239201bde1cec 100644
--- a/llvm/lib/Linker/IRMover.cpp
+++ b/llvm/lib/Linker/IRMover.cpp
@@ -1613,10 +1613,6 @@ bool IRMover::StructTypeKeyInfo::KeyTy::operator!=(const KeyTy &That) const {
   return !this->operator==(That);
 }
 
-StructType *IRMover::StructTypeKeyInfo::getEmptyKey() {
-  return DenseMapInfo<StructType *>::getEmptyKey();
-}
-
 unsigned IRMover::StructTypeKeyInfo::getHashValue(const KeyTy &Key) {
   return hash_combine(hash_combine_range(Key.ETypes), Key.IsPacked);
 }
@@ -1627,15 +1623,11 @@ unsigned IRMover::StructTypeKeyInfo::getHashValue(const StructType *ST) {
 
 bool IRMover::StructTypeKeyInfo::isEqual(const KeyTy &LHS,
                                          const StructType *RHS) {
-  if (RHS == getEmptyKey())
-    return false;
   return LHS == KeyTy(RHS);
 }
 
 bool IRMover::StructTypeKeyInfo::isEqual(const StructType *LHS,
                                          const StructType *RHS) {
-  if (RHS == getEmptyKey())
-    return LHS == RHS;
   return KeyTy(LHS) == KeyTy(RHS);
 }
 
diff --git a/llvm/lib/Object/Minidump.cpp b/llvm/lib/Object/Minidump.cpp
index caa38bff1666b..1c69687dc47f3 100644
--- a/llvm/lib/Object/Minidump.cpp
+++ b/llvm/lib/Object/Minidump.cpp
@@ -129,9 +129,6 @@ MinidumpFile::create(MemoryBufferRef Source) {
       continue;
     }
 
-    if (Type == DenseMapInfo<StreamType>::getEmptyKey())
-      return createError("Cannot handle one of the minidump streams");
-
     // Update the directory map, checking for duplicate stream types.
     if (!StreamMap.try_emplace(Type, StreamDescriptor.index()).second)
       return createError("Duplicate stream type");
diff --git a/llvm/tools/dsymutil/BinaryHolder.h b/llvm/tools/dsymutil/BinaryHolder.h
index 86f7cab95fc8b..75f0090571a9b 100644
--- a/llvm/tools/dsymutil/BinaryHolder.h
+++ b/llvm/tools/dsymutil/BinaryHolder.h
@@ -157,10 +157,6 @@ class BinaryHolder {
 
 template <> struct DenseMapInfo<dsymutil::BinaryHolder::ArchiveEntry::KeyTy> {
 
-  static inline dsymutil::BinaryHolder::ArchiveEntry::KeyTy getEmptyKey() {
-    return dsymutil::BinaryHolder::ArchiveEntry::KeyTy();
-  }
-
   static unsigned
   getHashValue(const dsymutil::BinaryHolder::ArchiveEntry::KeyTy &K) {
     return hash_combine(DenseMapInfo<StringRef>::getHashValue(K.Filename),
diff --git a/llvm/tools/llvm-c-test/echo.cpp b/llvm/tools/llvm-c-test/echo.cpp
index 58376039f91ee..1574d0ffe84cc 100644
--- a/llvm/tools/llvm-c-test/echo.cpp
+++ b/llvm/tools/llvm-c-test/echo.cpp
@@ -38,10 +38,6 @@ struct CAPIDenseMap {};
 template<typename T>
 struct CAPIDenseMap<T*> {
   struct CAPIDenseMapInfo {
-    static inline T* getEmptyKey() {
-      uintptr_t Val = static_cast<uintptr_t>(-1);
-      return reinterpret_cast<T*>(Val);
-    }
     static unsigned getHashValue(const T *PtrVal) {
       return hash_value(PtrVal);
     }
diff --git a/llvm/tools/llvm-reduce/deltas/Delta.h b/llvm/tools/llvm-reduce/deltas/Delta.h
index 533b30bcc77e2..4681debfaada5 100644
--- a/llvm/tools/llvm-reduce/deltas/Delta.h
+++ b/llvm/tools/llvm-reduce/deltas/Delta.h
@@ -57,11 +57,6 @@ struct Chunk {
 
 template<>
 struct DenseMapInfo<Chunk> {
-  static inline Chunk getEmptyKey() {
-    return {DenseMapInfo<int>::getEmptyKey(),
-            DenseMapInfo<int>::getEmptyKey()};
-  }
-
   static unsigned getHashValue(const Chunk Val) {
     std::pair<int, int> PairVal = std::make_pair(Val.Begin, Val.End);
     return DenseMapInfo<std::pair<int, int>>::getHashValue(PairVal);
diff --git a/llvm/tools/llvm-split/llvm-split.cpp b/llvm/tools/llvm-split/llvm-split.cpp
index e95a507c0f1ca..e7c9d52127274 100644
--- a/llvm/tools/llvm-split/llvm-split.cpp
+++ b/llvm/tools/llvm-split/llvm-split.cpp
@@ -189,8 +189,6 @@ class EntryPointCategorizer {
 
 private:
   struct KeyInfo {
-    static SmallString<0> getEmptyKey() { return SmallString<0>(""); }
-
     static bool isEqual(const SmallString<0> &LHS, const SmallString<0> &RHS) {
       return LHS == RHS;
     }
diff --git a/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp b/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp
index 891a8d598fbe4..9f986aa9069c9 100644
--- a/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp
+++ b/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp
@@ -47,11 +47,6 @@ inline bool operator==(PredicateWithCC LHS, PredicateWithCC RHS) {
 
 namespace llvm {
 template <> struct DenseMapInfo<PredicateWithCC, void> {
-  static inline PredicateWithCC getEmptyKey() {
-    return DenseMapInfo<
-        std::pair<const Record *, const Record *>>::getEmptyKey();
-  }
-
   static unsigned getHashValue(const PredicateWithCC Val) {
     auto Pair = std::make_pair(Val.Predicate, Val.CallingConv);
     return DenseMapInfo<



More information about the llvm-commits mailing list