Skip to content

Commit d5a05ac

Browse files
authored
[Target] Remove unused DenseMapInfo::getEmptyKey (#201993)
After #201281 DenseMapInfo<T>::getEmptyKey() is no longer used by DenseMap. Remove the unused getEmptyKey definitions and dead sentinel uses.
1 parent 4bdd4eb commit d5a05ac

6 files changed

Lines changed: 0 additions & 32 deletions

File tree

llvm/lib/Target/AArch64/AArch64StackTaggingPreRA.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ struct SlotWithTag {
231231

232232
namespace llvm {
233233
template <> struct DenseMapInfo<SlotWithTag> {
234-
static inline SlotWithTag getEmptyKey() { return {-2, -2}; }
235234
static unsigned getHashValue(const SlotWithTag &V) {
236235
return hash_combine(DenseMapInfo<int>::getHashValue(V.FI),
237236
DenseMapInfo<int>::getHashValue(V.Tag));

llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -479,26 +479,16 @@ hasHazard(StateT InitialState,
479479
}
480480
};
481481
struct StateMapKeyTraits : DenseMapInfo<StateMapKey> {
482-
static inline StateMapKey getEmptyKey() {
483-
return {static_cast<SmallVectorImpl<StateT> *>(
484-
DenseMapInfo<void *>::getEmptyKey()),
485-
DenseMapInfo<unsigned>::getEmptyKey()};
486-
}
487482
static unsigned getHashValue(const StateMapKey &Key) {
488483
return StateT::getHashValue((*Key.States)[Key.Idx]);
489484
}
490485
static unsigned getHashValue(const StateT &State) {
491486
return StateT::getHashValue(State);
492487
}
493488
static bool isEqual(const StateMapKey &LHS, const StateMapKey &RHS) {
494-
const auto EKey = getEmptyKey();
495-
if (StateMapKey::isEqual(LHS, EKey) || StateMapKey::isEqual(RHS, EKey))
496-
return StateMapKey::isEqual(LHS, RHS);
497489
return StateT::isEqual((*LHS.States)[LHS.Idx], (*RHS.States)[RHS.Idx]);
498490
}
499491
static bool isEqual(const StateT &LHS, const StateMapKey &RHS) {
500-
if (StateMapKey::isEqual(RHS, getEmptyKey()))
501-
return false;
502492
return StateT::isEqual(LHS, (*RHS.States)[RHS.Idx]);
503493
}
504494
};

llvm/lib/Target/CSKY/MCTargetDesc/CSKYTargetStreamer.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ class CSKYTargetStreamer : public MCTargetStreamer {
7575
};
7676

7777
template <> struct DenseMapInfo<CSKYTargetStreamer::SymbolIndex> {
78-
static inline CSKYTargetStreamer::SymbolIndex getEmptyKey() {
79-
return {nullptr, CSKY::S_Invalid};
80-
}
8178
static unsigned getHashValue(const CSKYTargetStreamer::SymbolIndex &V) {
8279
return hash_combine(DenseMapInfo<const MCSymbol *>::getHashValue(V.sym),
8380
DenseMapInfo<int>::getHashValue(V.kind));

llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ template <>
124124
struct DenseMapInfo<std::pair<const MCSymbol *, PPCMCExpr::Specifier>> {
125125
using TOCKey = std::pair<const MCSymbol *, PPCMCExpr::Specifier>;
126126

127-
static inline TOCKey getEmptyKey() { return {nullptr, PPC::S_None}; }
128127
static unsigned getHashValue(const TOCKey &PairVal) {
129128
return detail::combineHashValue(
130129
DenseMapInfo<const MCSymbol *>::getHashValue(PairVal.first),

llvm/lib/Target/SPIRV/SPIRVTypeInst.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ class SPIRVTypeInst {
6161

6262
template <> struct DenseMapInfo<SPIRVTypeInst> {
6363
using MIInfo = DenseMapInfo<MachineInstr *>;
64-
static SPIRVTypeInst getEmptyKey() {
65-
return {MIInfo::getEmptyKey(), SPIRVTypeInst::UncheckedConstructor()};
66-
}
6764
static unsigned getHashValue(SPIRVTypeInst Ty) {
6865
return MIInfo::getHashValue(Ty.MI);
6966
}

llvm/lib/Target/X86/X86OptimizeLEAs.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,7 @@ namespace llvm {
118118
template <> struct DenseMapInfo<MemOpKey> {
119119
using PtrInfo = DenseMapInfo<const MachineOperand *>;
120120

121-
static inline MemOpKey getEmptyKey() {
122-
return MemOpKey(PtrInfo::getEmptyKey(), PtrInfo::getEmptyKey(),
123-
PtrInfo::getEmptyKey(), PtrInfo::getEmptyKey(),
124-
PtrInfo::getEmptyKey());
125-
}
126-
127121
static unsigned getHashValue(const MemOpKey &Val) {
128-
// Checking any field of MemOpKey is enough to determine if the key is
129-
// empty.
130-
assert(Val.Disp != PtrInfo::getEmptyKey() && "Cannot hash the empty key");
131-
132122
hash_code Hash = hash_combine(*Val.Operands[0], *Val.Operands[1],
133123
*Val.Operands[2], *Val.Operands[3]);
134124

@@ -166,10 +156,6 @@ template <> struct DenseMapInfo<MemOpKey> {
166156
}
167157

168158
static bool isEqual(const MemOpKey &LHS, const MemOpKey &RHS) {
169-
// Checking any field of MemOpKey is enough to determine if the key is
170-
// empty.
171-
if (RHS.Disp == PtrInfo::getEmptyKey())
172-
return LHS.Disp == PtrInfo::getEmptyKey();
173159
return LHS == RHS;
174160
}
175161
};

0 commit comments

Comments
 (0)