diff --git a/llvm/include/llvm/ADT/APFixedPoint.h b/llvm/include/llvm/ADT/APFixedPoint.h index 0a47cd50516d4..790a5e775fb56 100644 --- a/llvm/include/llvm/ADT/APFixedPoint.h +++ b/llvm/include/llvm/ADT/APFixedPoint.h @@ -143,10 +143,6 @@ template <> struct DenseMapInfo { return FixedPointSemantics(0, 0, false, false, false); } - static inline FixedPointSemantics getTombstoneKey() { - return FixedPointSemantics(0, 1, false, false, false); - } - static unsigned getHashValue(const FixedPointSemantics &Val) { return hash_value(Val); } @@ -323,10 +319,6 @@ template <> struct DenseMapInfo { return APFixedPoint(DenseMapInfo::getEmptyKey()); } - static inline APFixedPoint getTombstoneKey() { - return APFixedPoint(DenseMapInfo::getTombstoneKey()); - } - static unsigned getHashValue(const APFixedPoint &Val) { return hash_value(Val); } diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h index e8d806cf78578..1a4788248e554 100644 --- a/llvm/include/llvm/ADT/APInt.h +++ b/llvm/include/llvm/ADT/APInt.h @@ -2533,12 +2533,6 @@ template <> struct DenseMapInfo { return V; } - static inline APInt getTombstoneKey() { - APInt V(nullptr, 0); - V.U.VAL = ~1ULL; - return V; - } - LLVM_ABI static unsigned getHashValue(const APInt &Key); static bool isEqual(const APInt &LHS, const APInt &RHS) { diff --git a/llvm/include/llvm/ADT/APSInt.h b/llvm/include/llvm/ADT/APSInt.h index aca0579b3e796..c5f8ad731bdb0 100644 --- a/llvm/include/llvm/ADT/APSInt.h +++ b/llvm/include/llvm/ADT/APSInt.h @@ -371,10 +371,6 @@ template <> struct DenseMapInfo { return APSInt(DenseMapInfo::getEmptyKey()); } - static inline APSInt getTombstoneKey() { - return APSInt(DenseMapInfo::getTombstoneKey()); - } - static unsigned getHashValue(const APSInt &Key) { return DenseMapInfo::getHashValue(Key); } diff --git a/llvm/include/llvm/ADT/ArrayRef.h b/llvm/include/llvm/ADT/ArrayRef.h index cf2c6d85dc272..badac76affdc9 100644 --- a/llvm/include/llvm/ADT/ArrayRef.h +++ b/llvm/include/llvm/ADT/ArrayRef.h @@ -569,23 +569,14 @@ template struct DenseMapInfo, void> { size_t(0)); } - static inline ArrayRef getTombstoneKey() { - return ArrayRef(reinterpret_cast(~static_cast(1)), - size_t(0)); - } - static unsigned getHashValue(ArrayRef Val) { assert(Val.data() != getEmptyKey().data() && "Cannot hash the empty key!"); - assert(Val.data() != getTombstoneKey().data() && - "Cannot hash the tombstone key!"); return (unsigned)(hash_value(Val)); } static bool isEqual(ArrayRef LHS, ArrayRef RHS) { if (RHS.data() == getEmptyKey().data()) return LHS.data() == getEmptyKey().data(); - if (RHS.data() == getTombstoneKey().data()) - return LHS.data() == getTombstoneKey().data(); return LHS == RHS; } }; diff --git a/llvm/include/llvm/ADT/BitVector.h b/llvm/include/llvm/ADT/BitVector.h index 48b75b045cfbf..72c8a84c15ecf 100644 --- a/llvm/include/llvm/ADT/BitVector.h +++ b/llvm/include/llvm/ADT/BitVector.h @@ -705,12 +705,6 @@ class BitVector { std::swap(Size, RHS.Size); } - void invalid() { - assert(!Size && Bits.empty()); - Size = (unsigned)-1; - } - bool isInvalid() const { return Size == (unsigned)-1; } - ArrayRef getData() const { return {Bits.data(), Bits.size()}; } //===--------------------------------------------------------------------===// @@ -854,18 +848,11 @@ inline BitVector::size_type capacity_in_bytes(const BitVector &X) { template <> struct DenseMapInfo { static inline BitVector getEmptyKey() { return {}; } - static inline BitVector getTombstoneKey() { - BitVector V; - V.invalid(); - return V; - } static unsigned getHashValue(const BitVector &V) { return DenseMapInfo>>:: getHashValue(std::make_pair(V.size(), V.getData())); } static bool isEqual(const BitVector &LHS, const BitVector &RHS) { - if (LHS.isInvalid() || RHS.isInvalid()) - return LHS.isInvalid() == RHS.isInvalid(); return LHS == RHS; } }; diff --git a/llvm/include/llvm/ADT/CachedHashString.h b/llvm/include/llvm/ADT/CachedHashString.h index ebd40e3207156..cc26216176198 100644 --- a/llvm/include/llvm/ADT/CachedHashString.h +++ b/llvm/include/llvm/ADT/CachedHashString.h @@ -12,8 +12,8 @@ /// their string data. /// /// Unlike std::string, CachedHashString can be used in DenseSet/DenseMap -/// (because, unlike std::string, CachedHashString lets us have empty and -/// tombstone values). +/// (because, unlike std::string, CachedHashString lets us have an empty +/// value). /// //===----------------------------------------------------------------------===// @@ -51,12 +51,8 @@ template <> struct DenseMapInfo { static CachedHashStringRef getEmptyKey() { return CachedHashStringRef(DenseMapInfo::getEmptyKey(), 0); } - static CachedHashStringRef getTombstoneKey() { - return CachedHashStringRef(DenseMapInfo::getTombstoneKey(), 1); - } static unsigned getHashValue(const CachedHashStringRef &S) { assert(!isEqual(S, getEmptyKey()) && "Cannot hash the empty key!"); - assert(!isEqual(S, getTombstoneKey()) && "Cannot hash the tombstone key!"); return S.hash(); } static bool isEqual(const CachedHashStringRef &LHS, @@ -77,19 +73,14 @@ class CachedHashString { uint32_t Hash; static char *getEmptyKeyPtr() { return DenseMapInfo::getEmptyKey(); } - static char *getTombstoneKeyPtr() { - return DenseMapInfo::getTombstoneKey(); - } - bool isEmptyOrTombstone() const { - return P == getEmptyKeyPtr() || P == getTombstoneKeyPtr(); - } + bool isEmpty() const { return P == getEmptyKeyPtr(); } - struct ConstructEmptyOrTombstoneTy {}; + struct ConstructEmptyTy {}; - CachedHashString(ConstructEmptyOrTombstoneTy, char *EmptyOrTombstonePtr) - : P(EmptyOrTombstonePtr), Size(0), Hash(0) { - assert(isEmptyOrTombstone()); + CachedHashString(ConstructEmptyTy, char *EmptyKeyPtr) + : P(EmptyKeyPtr), Size(0), Hash(0) { + assert(isEmpty()); } // TODO: Use small-string optimization to avoid allocating. @@ -110,7 +101,7 @@ class CachedHashString { // keys, and we want this to be usable there. CachedHashString(const CachedHashString &Other) : Size(Other.Size), Hash(Other.Hash) { - if (Other.isEmptyOrTombstone()) { + if (Other.isEmpty()) { P = Other.P; } else { P = new char[Size]; @@ -129,7 +120,7 @@ class CachedHashString { } ~CachedHashString() { - if (!isEmptyOrTombstone()) + if (!isEmpty()) delete[] P; } @@ -152,16 +143,11 @@ class CachedHashString { template <> struct DenseMapInfo { static CachedHashString getEmptyKey() { - return CachedHashString(CachedHashString::ConstructEmptyOrTombstoneTy(), + return CachedHashString(CachedHashString::ConstructEmptyTy(), CachedHashString::getEmptyKeyPtr()); } - static CachedHashString getTombstoneKey() { - return CachedHashString(CachedHashString::ConstructEmptyOrTombstoneTy(), - CachedHashString::getTombstoneKeyPtr()); - } static unsigned getHashValue(const CachedHashString &S) { assert(!isEqual(S, getEmptyKey()) && "Cannot hash the empty key!"); - assert(!isEqual(S, getTombstoneKey()) && "Cannot hash the tombstone key!"); return S.hash(); } static bool isEqual(const CachedHashString &LHS, @@ -170,11 +156,9 @@ template <> struct DenseMapInfo { return false; if (LHS.P == CachedHashString::getEmptyKeyPtr()) return RHS.P == CachedHashString::getEmptyKeyPtr(); - if (LHS.P == CachedHashString::getTombstoneKeyPtr()) - return RHS.P == CachedHashString::getTombstoneKeyPtr(); - // This is safe because if RHS.P is the empty or tombstone key, it will have - // length 0, so we'll never dereference its pointer. + // This is safe because if RHS.P is the empty key, it will have length 0, so + // we'll never dereference its pointer. return LHS.val() == RHS.val(); } }; diff --git a/llvm/include/llvm/ADT/DenseMapInfo.h b/llvm/include/llvm/ADT/DenseMapInfo.h index 832c12fc6482c..e8e21e4a15e66 100644 --- a/llvm/include/llvm/ADT/DenseMapInfo.h +++ b/llvm/include/llvm/ADT/DenseMapInfo.h @@ -53,7 +53,6 @@ inline unsigned combineHashValue(unsigned a, unsigned b) { template struct DenseMapInfo { // static constexpr T getEmptyKey(); - // static constexpr T getTombstoneKey(); // static unsigned getHashValue(const T &Val); // static bool isEqual(const T &LHS, const T &RHS); }; @@ -77,12 +76,6 @@ struct DenseMapInfo { return reinterpret_cast(Val); } - static constexpr T *getTombstoneKey() { - uintptr_t Val = static_cast(-2); - Val <<= Log2MaxAlign; - return reinterpret_cast(Val); - } - static unsigned getHashValue(const T *PtrVal) { return densemap::detail::mix(reinterpret_cast(PtrVal)); } @@ -93,7 +86,6 @@ struct DenseMapInfo { // Provide DenseMapInfo for chars. template<> struct DenseMapInfo { static constexpr char getEmptyKey() { return ~0; } - static constexpr char getTombstoneKey() { return ~0 - 1; } static unsigned getHashValue(const char& Val) { return Val * 37U; } static bool isEqual(const char &LHS, const char &RHS) { @@ -112,13 +104,6 @@ struct DenseMapInfo< T, std::enable_if_t && !std::is_same_v>> { static constexpr T getEmptyKey() { return std::numeric_limits::max(); } - static constexpr T getTombstoneKey() { - if constexpr (std::is_unsigned_v || std::is_same_v) - return std::numeric_limits::max() - 1; - else - return std::numeric_limits::min(); - } - static unsigned getHashValue(const T &Val) { if constexpr (std::is_unsigned_v && sizeof(T) > sizeof(unsigned)) return densemap::detail::mix(Val); @@ -141,10 +126,6 @@ struct DenseMapInfo> { return {FirstInfo::getEmptyKey(), SecondInfo::getEmptyKey()}; } - static constexpr Pair getTombstoneKey() { - return {FirstInfo::getTombstoneKey(), SecondInfo::getTombstoneKey()}; - } - static unsigned getHashValue(const Pair& PairVal) { return detail::combineHashValue(FirstInfo::getHashValue(PairVal.first), SecondInfo::getHashValue(PairVal.second)); @@ -172,10 +153,6 @@ template struct DenseMapInfo> { return Tuple(DenseMapInfo::getEmptyKey()...); } - static constexpr Tuple getTombstoneKey() { - return Tuple(DenseMapInfo::getTombstoneKey()...); - } - template static unsigned getHashValueImpl(const Tuple &values) { if constexpr (I == sizeof...(Ts)) { return 0; @@ -223,11 +200,6 @@ struct DenseMapInfo>> { return V; } - static constexpr Enum getTombstoneKey() { - constexpr Enum V = static_cast(Info::getTombstoneKey()); - return V; - } - static unsigned getHashValue(const Enum &Val) { return Info::getHashValue(static_cast(Val)); } @@ -241,10 +213,6 @@ template struct DenseMapInfo> { static constexpr Optional getEmptyKey() { return {Info::getEmptyKey()}; } - static constexpr Optional getTombstoneKey() { - return {Info::getTombstoneKey()}; - } - static unsigned getHashValue(const Optional &OptionalVal) { return detail::combineHashValue( OptionalVal.has_value(), diff --git a/llvm/include/llvm/ADT/DenseMapInfoVariant.h b/llvm/include/llvm/ADT/DenseMapInfoVariant.h index a97f9b9566c81..9729f2a300098 100644 --- a/llvm/include/llvm/ADT/DenseMapInfoVariant.h +++ b/llvm/include/llvm/ADT/DenseMapInfoVariant.h @@ -29,11 +29,6 @@ template struct DenseMapInfo> { return Variant(std::in_place_index<0>, DenseMapInfo::getEmptyKey()); } - static inline Variant getTombstoneKey() { - return Variant(std::in_place_index<0>, - DenseMapInfo::getTombstoneKey()); - } - static unsigned getHashValue(const Variant &Val) { return std::visit( [&Val](auto &&Alternative) { diff --git a/llvm/include/llvm/ADT/Hashing.h b/llvm/include/llvm/ADT/Hashing.h index 6d679d815a417..5565b09543233 100644 --- a/llvm/include/llvm/ADT/Hashing.h +++ b/llvm/include/llvm/ADT/Hashing.h @@ -392,7 +392,6 @@ template hash_code hash_value(const std::optional &arg) { template <> struct DenseMapInfo { static constexpr hash_code getEmptyKey() { return hash_code(-1); } - static constexpr hash_code getTombstoneKey() { return hash_code(-2); } static constexpr unsigned getHashValue(hash_code val) { return static_cast(size_t(val)); } diff --git a/llvm/include/llvm/ADT/ImmutableList.h b/llvm/include/llvm/ADT/ImmutableList.h index c9c289ca4dfa1..ef3f8a21db470 100644 --- a/llvm/include/llvm/ADT/ImmutableList.h +++ b/llvm/include/llvm/ADT/ImmutableList.h @@ -224,10 +224,6 @@ template struct DenseMapInfo, void> { return reinterpret_cast*>(-1); } - static inline ImmutableList getTombstoneKey() { - return reinterpret_cast*>(-2); - } - static unsigned getHashValue(ImmutableList X) { uintptr_t PtrVal = reinterpret_cast(X.getInternalPointer()); return (unsigned((uintptr_t)PtrVal) >> 4) ^ diff --git a/llvm/include/llvm/ADT/PointerEmbeddedInt.h b/llvm/include/llvm/ADT/PointerEmbeddedInt.h index 04a2b7bff78e0..76b03a40a9e27 100644 --- a/llvm/include/llvm/ADT/PointerEmbeddedInt.h +++ b/llvm/include/llvm/ADT/PointerEmbeddedInt.h @@ -102,7 +102,6 @@ struct DenseMapInfo> { using IntInfo = DenseMapInfo; static inline T getEmptyKey() { return IntInfo::getEmptyKey(); } - static inline T getTombstoneKey() { return IntInfo::getTombstoneKey(); } static unsigned getHashValue(const T &Arg) { return IntInfo::getHashValue(Arg); diff --git a/llvm/include/llvm/ADT/PointerIntPair.h b/llvm/include/llvm/ADT/PointerIntPair.h index 75e3a58e7ca61..db6714ffcfe91 100644 --- a/llvm/include/llvm/ADT/PointerIntPair.h +++ b/llvm/include/llvm/ADT/PointerIntPair.h @@ -223,12 +223,6 @@ struct DenseMapInfo, void> { return Ty::getFromOpaqueValue(reinterpret_cast(Val)); } - static Ty getTombstoneKey() { - uintptr_t Val = static_cast(-2); - Val <<= PointerLikeTypeTraits::NumLowBitsAvailable; - return Ty::getFromOpaqueValue(reinterpret_cast(Val)); - } - static unsigned getHashValue(Ty V) { uintptr_t IV = reinterpret_cast(V.getOpaqueValue()); return unsigned(IV) ^ unsigned(IV >> 9); diff --git a/llvm/include/llvm/ADT/PointerSumType.h b/llvm/include/llvm/ADT/PointerSumType.h index c8e6cffd796a6..beaaf49a32b52 100644 --- a/llvm/include/llvm/ADT/PointerSumType.h +++ b/llvm/include/llvm/ADT/PointerSumType.h @@ -259,11 +259,6 @@ struct DenseMapInfo> { return SumType::template create(SomePointerInfo::getEmptyKey()); } - static inline SumType getTombstoneKey() { - return SumType::template create( - SomePointerInfo::getTombstoneKey()); - } - static unsigned getHashValue(const SumType &Arg) { uintptr_t OpaqueValue = Arg.getOpaqueValue(); return DenseMapInfo::getHashValue(OpaqueValue); diff --git a/llvm/include/llvm/ADT/PointerUnion.h b/llvm/include/llvm/ADT/PointerUnion.h index 52cb12168f9b7..15565ee3ff51a 100644 --- a/llvm/include/llvm/ADT/PointerUnion.h +++ b/llvm/include/llvm/ADT/PointerUnion.h @@ -428,10 +428,6 @@ template struct DenseMapInfo> { static inline Union getEmptyKey() { return Union(FirstInfo::getEmptyKey()); } - static inline Union getTombstoneKey() { - return Union(FirstInfo::getTombstoneKey()); - } - static unsigned getHashValue(const Union &UnionVal) { auto Key = reinterpret_cast(UnionVal.getOpaqueValue()); return DenseMapInfo::getHashValue(Key); diff --git a/llvm/include/llvm/ADT/SmallBitVector.h b/llvm/include/llvm/ADT/SmallBitVector.h index 978dc3f073031..78049cbb44da5 100644 --- a/llvm/include/llvm/ADT/SmallBitVector.h +++ b/llvm/include/llvm/ADT/SmallBitVector.h @@ -683,12 +683,6 @@ class SmallBitVector { getPointer()->clearBitsNotInMask(Mask, MaskWords); } - void invalid() { - assert(empty()); - X = (uintptr_t)-1; - } - bool isInvalid() const { return X == (uintptr_t)-1; } - ArrayRef getData(uintptr_t &Store) const { if (!isSmall()) return getPointer()->getData(); @@ -735,11 +729,6 @@ operator^(const SmallBitVector &LHS, const SmallBitVector &RHS) { template <> struct DenseMapInfo { static inline SmallBitVector getEmptyKey() { return SmallBitVector(); } - static inline SmallBitVector getTombstoneKey() { - SmallBitVector V; - V.invalid(); - return V; - } static unsigned getHashValue(const SmallBitVector &V) { uintptr_t Store; return DenseMapInfo< @@ -747,8 +736,6 @@ template <> struct DenseMapInfo { getHashValue(std::make_pair(V.size(), V.getData(Store))); } static bool isEqual(const SmallBitVector &LHS, const SmallBitVector &RHS) { - if (LHS.isInvalid() || RHS.isInvalid()) - return LHS.isInvalid() == RHS.isInvalid(); return LHS == RHS; } }; diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h index 3d655daea471b..7e375792df4c0 100644 --- a/llvm/include/llvm/ADT/SmallVector.h +++ b/llvm/include/llvm/ADT/SmallVector.h @@ -1353,10 +1353,6 @@ template struct DenseMapInfo> { return {DenseMapInfo::getEmptyKey()}; } - static SmallVector getTombstoneKey() { - return {DenseMapInfo::getTombstoneKey()}; - } - static unsigned getHashValue(const SmallVector &V) { return static_cast(hash_combine_range(V)); } diff --git a/llvm/include/llvm/ADT/StringRef.h b/llvm/include/llvm/ADT/StringRef.h index 5421224e6a1d3..f15e120451638 100644 --- a/llvm/include/llvm/ADT/StringRef.h +++ b/llvm/include/llvm/ADT/StringRef.h @@ -956,18 +956,11 @@ template <> struct DenseMapInfo { 0); } - static inline StringRef getTombstoneKey() { - return StringRef(reinterpret_cast(~static_cast(1)), - 0); - } - LLVM_ABI static unsigned getHashValue(StringRef Val); static bool isEqual(StringRef LHS, StringRef RHS) { if (RHS.data() == getEmptyKey().data()) return LHS.data() == getEmptyKey().data(); - if (RHS.data() == getTombstoneKey().data()) - return LHS.data() == getTombstoneKey().data(); return LHS == RHS; } }; diff --git a/llvm/include/llvm/Support/FileSystem/UniqueID.h b/llvm/include/llvm/Support/FileSystem/UniqueID.h index 0d5367236e8dc..3bfd8b7405505 100644 --- a/llvm/include/llvm/Support/FileSystem/UniqueID.h +++ b/llvm/include/llvm/Support/FileSystem/UniqueID.h @@ -58,12 +58,6 @@ template <> struct DenseMapInfo { return {EmptyKey.first, EmptyKey.second}; } - static inline llvm::sys::fs::UniqueID getTombstoneKey() { - auto TombstoneKey = - DenseMapInfo>::getTombstoneKey(); - return {TombstoneKey.first, TombstoneKey.second}; - } - static hash_code getHashValue(const llvm::sys::fs::UniqueID &Tag) { return hash_value(std::make_pair(Tag.getDevice(), Tag.getFile())); } diff --git a/llvm/include/llvm/Support/TypeSize.h b/llvm/include/llvm/Support/TypeSize.h index 421d6613bfafc..c60bae2872f92 100644 --- a/llvm/include/llvm/Support/TypeSize.h +++ b/llvm/include/llvm/Support/TypeSize.h @@ -434,9 +434,6 @@ template <> struct DenseMapInfo { static inline ElementCount getEmptyKey() { return ElementCount::getScalable(~0U); } - static inline ElementCount getTombstoneKey() { - return ElementCount::getFixed(~0U - 1); - } static unsigned getHashValue(const ElementCount &EltCnt) { unsigned HashVal = EltCnt.getKnownMinValue() * 37U; if (EltCnt.isScalable()) diff --git a/llvm/include/llvm/Support/UniqueBBID.h b/llvm/include/llvm/Support/UniqueBBID.h index e508afaa43f7b..f29e6126b5f94 100644 --- a/llvm/include/llvm/Support/UniqueBBID.h +++ b/llvm/include/llvm/Support/UniqueBBID.h @@ -49,11 +49,6 @@ template <> struct DenseMapInfo { return UniqueBBID{EmptyKey, EmptyKey}; } - static inline UniqueBBID getTombstoneKey() { - unsigned TombstoneKey = DenseMapInfo::getTombstoneKey(); - return UniqueBBID{TombstoneKey, TombstoneKey}; - } - static unsigned getHashValue(const UniqueBBID &Val) { return DenseMapInfo::getHashValue(Val.BaseID) ^ DenseMapInfo::getHashValue(Val.CloneID); diff --git a/llvm/include/llvm/Support/VersionTuple.h b/llvm/include/llvm/Support/VersionTuple.h index a27241550836b..ac2e3c7af25e1 100644 --- a/llvm/include/llvm/Support/VersionTuple.h +++ b/llvm/include/llvm/Support/VersionTuple.h @@ -216,9 +216,6 @@ LLVM_ABI raw_ostream &operator<<(raw_ostream &Out, const VersionTuple &V); // Provide DenseMapInfo for version tuples. template <> struct DenseMapInfo { static inline VersionTuple getEmptyKey() { return VersionTuple(0x7FFFFFFF); } - static inline VersionTuple getTombstoneKey() { - return VersionTuple(0x7FFFFFFE); - } static unsigned getHashValue(const VersionTuple &Value) { unsigned Result = Value.getMajor(); if (auto Minor = Value.getMinor()) diff --git a/llvm/lib/Support/StringRef.cpp b/llvm/lib/Support/StringRef.cpp index 2e8fba8cbfa37..be1c63ef82114 100644 --- a/llvm/lib/Support/StringRef.cpp +++ b/llvm/lib/Support/StringRef.cpp @@ -610,9 +610,6 @@ bool StringRef::getAsDouble(double &Result, bool AllowInexact) const { hash_code llvm::hash_value(StringRef S) { return hash_combine_range(S); } unsigned DenseMapInfo::getHashValue(StringRef Val) { - assert(Val.data() != getEmptyKey().data() && - "Cannot hash the empty key!"); - assert(Val.data() != getTombstoneKey().data() && - "Cannot hash the tombstone key!"); + assert(Val.data() != getEmptyKey().data() && "Cannot hash the empty key!"); return (unsigned)(hash_value(Val)); } diff --git a/llvm/unittests/ADT/DenseMapTest.cpp b/llvm/unittests/ADT/DenseMapTest.cpp index 344478a14bb01..e191577249f74 100644 --- a/llvm/unittests/ADT/DenseMapTest.cpp +++ b/llvm/unittests/ADT/DenseMapTest.cpp @@ -86,7 +86,6 @@ std::set CtorTester::Constructed; struct CtorTesterMapInfo { static inline CtorTester getEmptyKey() { return CtorTester(-1); } - static inline CtorTester getTombstoneKey() { return CtorTester(-2); } static unsigned getHashValue(const CtorTester &Val) { return Val.getValue() * 37u; } @@ -733,7 +732,6 @@ TEST(DenseMapCustomTest, LookupOrConstness) { // In the latter case, "a" == 0, "b" == 1 and so on. struct TestDenseMapInfo { static inline unsigned getEmptyKey() { return ~0; } - static inline unsigned getTombstoneKey() { return ~0U - 1; } static unsigned getHashValue(const unsigned& Val) { return Val * 37U; } static unsigned getHashValue(const char* Val) { return (unsigned)(Val[0] - 'a') * 37U; @@ -790,7 +788,6 @@ TEST(DenseMapCustomTest, SmallDenseMapInitializerList) { struct ContiguousDenseMapInfo { static inline unsigned getEmptyKey() { return ~0; } - static inline unsigned getTombstoneKey() { return ~0U - 1; } static unsigned getHashValue(const unsigned& Val) { return Val; } static bool isEqual(const unsigned& LHS, const unsigned& RHS) { return LHS == RHS; @@ -916,7 +913,6 @@ namespace llvm { template struct DenseMapInfo>> { static inline T getEmptyKey() { return {static_cast(~0)}; } - static inline T getTombstoneKey() { return {static_cast(~0U - 1)}; } static unsigned getHashValue(const T &Val) { return Val.value; } static bool isEqual(const T &LHS, const T &RHS) { return LHS.value == RHS.value; @@ -926,7 +922,6 @@ struct DenseMapInfo>> { template <> struct DenseMapInfo { using T = AlwaysEqType; static inline T getEmptyKey() { return {}; } - static inline T getTombstoneKey() { return {}; } static unsigned getHashValue(const T &Val) { return 0; } static bool isEqual(const T &LHS, const T &RHS) { return false; diff --git a/llvm/unittests/ADT/DenseSetTest.cpp b/llvm/unittests/ADT/DenseSetTest.cpp index a98b27f20564f..5466292dc5992 100644 --- a/llvm/unittests/ADT/DenseSetTest.cpp +++ b/llvm/unittests/ADT/DenseSetTest.cpp @@ -83,7 +83,6 @@ TEST(DenseSetTest, RemoveIf) { struct TestDenseSetInfo { static inline unsigned getEmptyKey() { return ~0; } - static inline unsigned getTombstoneKey() { return ~0U - 1; } static unsigned getHashValue(const unsigned& Val) { return Val * 37U; } static unsigned getHashValue(const char* Val) { return (unsigned)(Val[0] - 'a') * 37U; @@ -231,9 +230,6 @@ namespace llvm { // Specialization required to insert a CountCopyAndMove into a DenseSet. template <> struct DenseMapInfo { static inline CountCopyAndMove getEmptyKey() { return CountCopyAndMove(-1); }; - static inline CountCopyAndMove getTombstoneKey() { - return CountCopyAndMove(-2); - }; static unsigned getHashValue(const CountCopyAndMove &Val) { return Val.Value; } diff --git a/llvm/unittests/ADT/MapVectorTest.cpp b/llvm/unittests/ADT/MapVectorTest.cpp index b11d4603b90b7..c2eabe4a0f850 100644 --- a/llvm/unittests/ADT/MapVectorTest.cpp +++ b/llvm/unittests/ADT/MapVectorTest.cpp @@ -36,7 +36,6 @@ struct A : CountCopyAndMove { namespace llvm { template <> struct DenseMapInfo { static inline A getEmptyKey() { return 0x7fffffff; } - static inline A getTombstoneKey() { return -0x7fffffff - 1; } static unsigned getHashValue(const A &Val) { return (unsigned)(Val.v * 37U); } static bool isEqual(const A &LHS, const A &RHS) { return LHS.v == RHS.v; } }; diff --git a/llvm/unittests/Support/ReverseIterationTest.cpp b/llvm/unittests/Support/ReverseIterationTest.cpp index f199e21a2362f..8d0c3365523a7 100644 --- a/llvm/unittests/Support/ReverseIterationTest.cpp +++ b/llvm/unittests/Support/ReverseIterationTest.cpp @@ -66,11 +66,6 @@ template<> struct DenseMapInfo { return &EmptyKey; } - static PtrLikeInt *getTombstoneKey() { - static PtrLikeInt TombstoneKey; - return &TombstoneKey; - } - static int getHashValue(const PtrLikeInt *P) { return P->value; }