[IR][Analysis] Remove unused DenseMapInfo::getEmptyKey#201997
Conversation
After llvm#201281 DenseMapInfo<T>::getEmptyKey() is no longer used by DenseMap. Remove the unused getEmptyKey definitions and dead sentinel uses.
|
@llvm/pr-subscribers-debuginfo @llvm/pr-subscribers-llvm-analysis Author: Fangrui Song (MaskRay) ChangesAfter #201281 DenseMapInfo<T>::getEmptyKey() is no longer used by Patch is 21.01 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/201997.diff 20 Files Affected:
diff --git a/llvm/include/llvm/Analysis/AliasAnalysis.h b/llvm/include/llvm/Analysis/AliasAnalysis.h
index 26b6dca986685..4fbe8ea7b8de6 100644
--- a/llvm/include/llvm/Analysis/AliasAnalysis.h
+++ b/llvm/include/llvm/Analysis/AliasAnalysis.h
@@ -217,10 +217,6 @@ struct AACacheLoc {
};
template <> struct DenseMapInfo<AACacheLoc> {
- static inline AACacheLoc getEmptyKey() {
- return {DenseMapInfo<AACacheLoc::PtrTy>::getEmptyKey(),
- DenseMapInfo<LocationSize>::getEmptyKey()};
- }
static unsigned getHashValue(const AACacheLoc &Val) {
return DenseMapInfo<AACacheLoc::PtrTy>::getHashValue(Val.Ptr) ^
DenseMapInfo<LocationSize>::getHashValue(Val.Size);
diff --git a/llvm/include/llvm/Analysis/AssumeBundleQueries.h b/llvm/include/llvm/Analysis/AssumeBundleQueries.h
index 56a49b5db8d6f..5b61f45a4375e 100644
--- a/llvm/include/llvm/Analysis/AssumeBundleQueries.h
+++ b/llvm/include/llvm/Analysis/AssumeBundleQueries.h
@@ -50,9 +50,6 @@ inline bool hasAttributeInAssume(AssumeInst &Assume, Value *IsOn,
}
template<> struct DenseMapInfo<Attribute::AttrKind> {
- static Attribute::AttrKind getEmptyKey() {
- return Attribute::EmptyKey;
- }
static unsigned getHashValue(Attribute::AttrKind AK) {
return hash_combine(AK);
}
diff --git a/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h b/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
index c26e7529f9a91..c9eb5a40f0477 100644
--- a/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
+++ b/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
@@ -314,8 +314,6 @@ struct IRInstructionDataList
LLVM_ABI bool isClose(const IRInstructionData &A, const IRInstructionData &B);
struct IRInstructionDataTraits : DenseMapInfo<IRInstructionData *> {
- static inline IRInstructionData *getEmptyKey() { return nullptr; }
-
static unsigned getHashValue(const IRInstructionData *E) {
using llvm::hash_value;
assert(E && "IRInstructionData is a nullptr?");
@@ -324,10 +322,7 @@ struct IRInstructionDataTraits : DenseMapInfo<IRInstructionData *> {
static bool isEqual(const IRInstructionData *LHS,
const IRInstructionData *RHS) {
- if (RHS == getEmptyKey() || LHS == getEmptyKey())
- return LHS == RHS;
-
- assert(LHS && RHS && "nullptr should have been caught by getEmptyKey?");
+ assert(LHS && RHS && "nullptr is not expected as a key");
return isClose(*LHS, *RHS);
}
};
@@ -503,11 +498,6 @@ struct IRInstructionMapper {
IRInstructionMapper(SpecificBumpPtrAllocator<IRInstructionData> *IDA,
SpecificBumpPtrAllocator<IRInstructionDataList> *IDLA)
: InstDataAllocator(IDA), IDLAllocator(IDLA) {
- // Make sure that the implementation of DenseMapInfo<unsigned> hasn't
- // changed.
- static_assert(DenseMapInfo<unsigned>::getEmptyKey() ==
- static_cast<unsigned>(-1));
-
IDL = new (IDLAllocator->Allocate())
IRInstructionDataList();
}
diff --git a/llvm/include/llvm/Analysis/MemoryLocation.h b/llvm/include/llvm/Analysis/MemoryLocation.h
index cba55eb8198f6..f9ad8f9c40d98 100644
--- a/llvm/include/llvm/Analysis/MemoryLocation.h
+++ b/llvm/include/llvm/Analysis/MemoryLocation.h
@@ -329,7 +329,6 @@ class MemoryLocation {
// Specialize DenseMapInfo.
template <> struct DenseMapInfo<LocationSize> {
- static inline LocationSize getEmptyKey() { return LocationSize::mapEmpty(); }
static unsigned getHashValue(const LocationSize &Val) {
return DenseMapInfo<uint64_t>::getHashValue(Val.toRaw());
}
@@ -339,10 +338,6 @@ template <> struct DenseMapInfo<LocationSize> {
};
template <> struct DenseMapInfo<MemoryLocation> {
- static inline MemoryLocation getEmptyKey() {
- return MemoryLocation(DenseMapInfo<const Value *>::getEmptyKey(),
- DenseMapInfo<LocationSize>::getEmptyKey());
- }
static unsigned getHashValue(const MemoryLocation &Val) {
return DenseMapInfo<const Value *>::getHashValue(Val.Ptr) ^
DenseMapInfo<LocationSize>::getHashValue(Val.Size) ^
diff --git a/llvm/include/llvm/Analysis/MemorySSA.h b/llvm/include/llvm/Analysis/MemorySSA.h
index 9b0038567fa69..b95a8d0a80e9f 100644
--- a/llvm/include/llvm/Analysis/MemorySSA.h
+++ b/llvm/include/llvm/Analysis/MemorySSA.h
@@ -1203,11 +1203,6 @@ struct UpwardDefsElem {
};
template <> struct DenseMapInfo<UpwardDefsElem> {
- static inline UpwardDefsElem getEmptyKey() {
- return {DenseMapInfo<MemoryAccess *>::getEmptyKey(),
- DenseMapInfo<MemoryLocation>::getEmptyKey(), false};
- }
-
static unsigned getHashValue(const UpwardDefsElem &Val) {
return hash_combine(DenseMapInfo<MemoryAccess *>::getHashValue(Val.MA),
DenseMapInfo<MemoryLocation>::getHashValue(Val.Loc),
diff --git a/llvm/include/llvm/Analysis/ScalarEvolution.h b/llvm/include/llvm/Analysis/ScalarEvolution.h
index 2a536e81e691c..15b891b5b4da9 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolution.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolution.h
@@ -201,11 +201,6 @@ template <> struct PointerLikeTypeTraits<SCEVUse> {
};
template <> struct DenseMapInfo<SCEVUse> {
- static inline SCEVUse getEmptyKey() {
- uintptr_t Val = static_cast<uintptr_t>(-1);
- return PointerLikeTypeTraits<SCEVUse>::getFromVoidPointer((void *)Val);
- }
-
static unsigned getHashValue(SCEVUse U) {
return hash_value(U.getOpaqueValue());
}
@@ -2729,11 +2724,6 @@ class PredicatedScalarEvolution {
};
template <> struct DenseMapInfo<ScalarEvolution::FoldID> {
- static inline ScalarEvolution::FoldID getEmptyKey() {
- ScalarEvolution::FoldID ID(0);
- return ID;
- }
-
static unsigned getHashValue(const ScalarEvolution::FoldID &Val) {
return Val.computeHash();
}
diff --git a/llvm/include/llvm/Analysis/VectorUtils.h b/llvm/include/llvm/Analysis/VectorUtils.h
index 04c2041513aff..b863a307b143e 100644
--- a/llvm/include/llvm/Analysis/VectorUtils.h
+++ b/llvm/include/llvm/Analysis/VectorUtils.h
@@ -544,10 +544,6 @@ template <typename InstTy> class InterleaveGroup {
return false;
int32_t Key = *MaybeKey;
- // Skip if the key is used for the empty special value.
- if (DenseMapInfo<int32_t>::getEmptyKey() == Key)
- return false;
-
// Skip if there is already a member with the same index.
if (Members.contains(Key))
return false;
diff --git a/llvm/include/llvm/IR/Attributes.h b/llvm/include/llvm/IR/Attributes.h
index 2424d1c0b512d..5dc09ef66370a 100644
--- a/llvm/include/llvm/IR/Attributes.h
+++ b/llvm/include/llvm/IR/Attributes.h
@@ -526,12 +526,6 @@ class AttributeSet {
/// \class
/// Provide DenseMapInfo for AttributeSet.
template <> struct DenseMapInfo<AttributeSet, void> {
- static AttributeSet getEmptyKey() {
- auto Val = static_cast<uintptr_t>(-1);
- Val <<= PointerLikeTypeTraits<void *>::NumLowBitsAvailable;
- return AttributeSet(reinterpret_cast<AttributeSetNode *>(Val));
- }
-
static unsigned getHashValue(AttributeSet AS) {
return (unsigned((uintptr_t)AS.SetNode) >> 4) ^
(unsigned((uintptr_t)AS.SetNode) >> 9);
@@ -1095,12 +1089,6 @@ class AttributeList {
/// \class
/// Provide DenseMapInfo for AttributeList.
template <> struct DenseMapInfo<AttributeList, void> {
- static AttributeList getEmptyKey() {
- auto Val = static_cast<uintptr_t>(-1);
- Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;
- return AttributeList(reinterpret_cast<AttributeListImpl *>(Val));
- }
-
static unsigned getHashValue(AttributeList AS) {
return (unsigned((uintptr_t)AS.pImpl) >> 4) ^
(unsigned((uintptr_t)AS.pImpl) >> 9);
diff --git a/llvm/include/llvm/IR/BasicBlock.h b/llvm/include/llvm/IR/BasicBlock.h
index abf5b72f3df10..6b91902571b24 100644
--- a/llvm/include/llvm/IR/BasicBlock.h
+++ b/llvm/include/llvm/IR/BasicBlock.h
@@ -767,10 +767,6 @@ inline void BasicBlock::validateInstrOrdering() const {}
// maps and sets. The iterator is made up of its node pointer, and the
// debug-info "head" bit.
template <> struct DenseMapInfo<BasicBlock::iterator> {
- static inline BasicBlock::iterator getEmptyKey() {
- return BasicBlock::iterator(nullptr);
- }
-
static unsigned getHashValue(const BasicBlock::iterator &It) {
return DenseMapInfo<void *>::getHashValue(
reinterpret_cast<void *>(It.getNodePtr())) ^
diff --git a/llvm/include/llvm/IR/DebugInfo.h b/llvm/include/llvm/IR/DebugInfo.h
index 16d780bb6c8e2..01f8e97d24bce 100644
--- a/llvm/include/llvm/IR/DebugInfo.h
+++ b/llvm/include/llvm/IR/DebugInfo.h
@@ -260,11 +260,6 @@ struct VarRecord {
} // namespace at
template <> struct DenseMapInfo<at::VarRecord> {
- static inline at::VarRecord getEmptyKey() {
- return at::VarRecord(DenseMapInfo<DILocalVariable *>::getEmptyKey(),
- DenseMapInfo<DILocation *>::getEmptyKey());
- }
-
static unsigned getHashValue(const at::VarRecord &Var) {
return hash_combine(Var.Var, Var.DL);
}
diff --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h
index 29d2de7a58884..d1e1e0606ba1a 100644
--- a/llvm/include/llvm/IR/DebugInfoMetadata.h
+++ b/llvm/include/llvm/IR/DebugInfoMetadata.h
@@ -3923,8 +3923,6 @@ template <> struct DenseMapInfo<DIExpression::FragmentInfo> {
using FragInfo = DIExpression::FragmentInfo;
static const uint64_t MaxVal = std::numeric_limits<uint64_t>::max();
- static inline FragInfo getEmptyKey() { return {MaxVal, MaxVal}; }
-
static unsigned getHashValue(const FragInfo &Frag) {
return (Frag.SizeInBits & 0xffff) << 16 | (Frag.OffsetInBits & 0xffff);
}
@@ -4794,10 +4792,6 @@ template <> struct DenseMapInfo<DebugVariable> {
using FragmentInfo = DIExpression::FragmentInfo;
/// Empty key: no key should be generated that has no DILocalVariable.
- static inline DebugVariable getEmptyKey() {
- return DebugVariable(nullptr, std::nullopt, nullptr);
- }
-
static unsigned getHashValue(const DebugVariable &D) {
unsigned HV = 0;
const std::optional<FragmentInfo> Fragment = D.getFragment();
diff --git a/llvm/include/llvm/IR/Dominators.h b/llvm/include/llvm/IR/Dominators.h
index 7ea06ddccdc5d..4b84b5791ab77 100644
--- a/llvm/include/llvm/IR/Dominators.h
+++ b/llvm/include/llvm/IR/Dominators.h
@@ -119,10 +119,6 @@ template <> struct DenseMapInfo<BasicBlockEdge> {
LLVM_ABI static unsigned getHashValue(const BasicBlockEdge *V);
- static inline BasicBlockEdge getEmptyKey() {
- return BasicBlockEdge(BBInfo::getEmptyKey(), BBInfo::getEmptyKey());
- }
-
static unsigned getHashValue(const BasicBlockEdge &Edge) {
return hash_combine(BBInfo::getHashValue(Edge.getStart()),
BBInfo::getHashValue(Edge.getEnd()));
diff --git a/llvm/include/llvm/IR/Metadata.h b/llvm/include/llvm/IR/Metadata.h
index a6317bd021a9a..ce12c833cdbc7 100644
--- a/llvm/include/llvm/IR/Metadata.h
+++ b/llvm/include/llvm/IR/Metadata.h
@@ -869,11 +869,6 @@ struct AAMDNodes {
// Specialize DenseMapInfo for AAMDNodes.
template<>
struct DenseMapInfo<AAMDNodes> {
- static inline AAMDNodes getEmptyKey() {
- return AAMDNodes(DenseMapInfo<MDNode *>::getEmptyKey(), nullptr, nullptr,
- nullptr, nullptr);
- }
-
static unsigned getHashValue(const AAMDNodes &Val) {
return DenseMapInfo<MDNode *>::getHashValue(Val.TBAA) ^
DenseMapInfo<MDNode *>::getHashValue(Val.TBAAStruct) ^
diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index ae99593d16b6b..359026cfc85a0 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -301,16 +301,10 @@ inline bool operator<(const ValueInfo &A, const ValueInfo &B) {
}
template <> struct DenseMapInfo<ValueInfo> {
- static inline ValueInfo getEmptyKey() {
- return ValueInfo(false, (GlobalValueSummaryMapTy::value_type *)-8);
- }
-
- static inline bool isSpecialKey(ValueInfo V) { return V == getEmptyKey(); }
-
static bool isEqual(ValueInfo L, ValueInfo R) {
// We are not supposed to mix ValueInfo(s) with different HaveGVs flag
// in a same container.
- assert(isSpecialKey(L) || isSpecialKey(R) || (L.haveGVs() == R.haveGVs()));
+ assert(L.haveGVs() == R.haveGVs());
return L.getRef() == R.getRef();
}
static unsigned getHashValue(ValueInfo I) { return hash_value(I.getRef()); }
@@ -1125,8 +1119,6 @@ class FunctionSummary : public GlobalValueSummary {
};
template <> struct DenseMapInfo<FunctionSummary::VFuncId> {
- static FunctionSummary::VFuncId getEmptyKey() { return {0, uint64_t(-1)}; }
-
static bool isEqual(FunctionSummary::VFuncId L, FunctionSummary::VFuncId R) {
return L.GUID == R.GUID && L.Offset == R.Offset;
}
@@ -1135,10 +1127,6 @@ template <> struct DenseMapInfo<FunctionSummary::VFuncId> {
};
template <> struct DenseMapInfo<FunctionSummary::ConstVCall> {
- static FunctionSummary::ConstVCall getEmptyKey() {
- return {{0, uint64_t(-1)}, {}};
- }
-
static bool isEqual(FunctionSummary::ConstVCall L,
FunctionSummary::ConstVCall R) {
return DenseMapInfo<FunctionSummary::VFuncId>::isEqual(L.VFunc, R.VFunc) &&
diff --git a/llvm/include/llvm/IR/ValueHandle.h b/llvm/include/llvm/IR/ValueHandle.h
index 480f2bb92ebc6..4ad034cb54646 100644
--- a/llvm/include/llvm/IR/ValueHandle.h
+++ b/llvm/include/llvm/IR/ValueHandle.h
@@ -129,9 +129,7 @@ class ValueHandleBase {
protected:
Value *getValPtr() const { return Val; }
- static bool isValid(Value *V) {
- return V && V != DenseMapInfo<Value *>::getEmptyKey();
- }
+ static bool isValid(Value *V) { return V; }
/// Remove this ValueHandle from its current use list.
LLVM_ABI void RemoveFromUseList();
@@ -206,10 +204,6 @@ template <> struct simplify_type<const WeakVH> {
// Specialize DenseMapInfo to allow WeakVH to participate in DenseMap.
template <> struct DenseMapInfo<WeakVH> {
- static inline WeakVH getEmptyKey() {
- return WeakVH(DenseMapInfo<Value *>::getEmptyKey());
- }
-
static unsigned getHashValue(const WeakVH &Val) {
return DenseMapInfo<Value *>::getHashValue(Val);
}
@@ -576,12 +570,6 @@ class PoisoningVH final
// Specialize DenseMapInfo to allow PoisoningVH to participate in DenseMap.
template <typename T> struct DenseMapInfo<PoisoningVH<T>> {
- static inline PoisoningVH<T> getEmptyKey() {
- PoisoningVH<T> Res;
- Res.setRawValPtr(DenseMapInfo<Value *>::getEmptyKey());
- return Res;
- }
-
static unsigned getHashValue(const PoisoningVH<T> &Val) {
return DenseMapInfo<Value *>::getHashValue(Val.getRawValPtr());
}
diff --git a/llvm/include/llvm/IR/ValueMap.h b/llvm/include/llvm/IR/ValueMap.h
index 350ac8288d2e8..435347be3f3c1 100644
--- a/llvm/include/llvm/IR/ValueMap.h
+++ b/llvm/include/llvm/IR/ValueMap.h
@@ -292,10 +292,6 @@ template <typename KeyT, typename ValueT, typename Config>
struct DenseMapInfo<ValueMapCallbackVH<KeyT, ValueT, Config>> {
using VH = ValueMapCallbackVH<KeyT, ValueT, Config>;
- static inline VH getEmptyKey() {
- return VH(DenseMapInfo<Value *>::getEmptyKey());
- }
-
static unsigned getHashValue(const VH &Val) {
return DenseMapInfo<KeyT>::getHashValue(Val.Unwrap());
}
diff --git a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
index e180c203d13c5..256835bdba474 100644
--- a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
+++ b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
@@ -359,9 +359,6 @@ unsigned IRInstructionMapper::mapToLegalUnsigned(
assert(LegalInstrNumber < IllegalInstrNumber &&
"Instruction mapping overflow!");
- assert(LegalInstrNumber != DenseMapInfo<unsigned>::getEmptyKey() &&
- "Tried to assign DenseMap empty key to instruction.");
-
return INumber;
}
@@ -408,9 +405,6 @@ unsigned IRInstructionMapper::mapToIllegalUnsigned(
assert(LegalInstrNumber < IllegalInstrNumber &&
"Instruction mapping overflow!");
- assert(IllegalInstrNumber != DenseMapInfo<unsigned>::getEmptyKey() &&
- "IllegalInstrNumber cannot be DenseMap empty key!");
-
return INumber;
}
diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp
index c092187841e2a..10034d5ce2671 100644
--- a/llvm/lib/Analysis/MemorySSA.cpp
+++ b/llvm/lib/Analysis/MemorySSA.cpp
@@ -217,10 +217,6 @@ class MemoryLocOrCall {
namespace llvm {
template <> struct DenseMapInfo<MemoryLocOrCall> {
- static inline MemoryLocOrCall getEmptyKey() {
- return MemoryLocOrCall(DenseMapInfo<MemoryLocation>::getEmptyKey());
- }
-
static unsigned getHashValue(const MemoryLocOrCall &MLOC) {
if (!MLOC.IsCall)
return hash_combine(
diff --git a/llvm/lib/IR/ConstantsContext.h b/llvm/lib/IR/ConstantsContext.h
index 0fb2d2e49232e..424eeee739e07 100644
--- a/llvm/lib/IR/ConstantsContext.h
+++ b/llvm/lib/IR/ConstantsContext.h
@@ -565,10 +565,6 @@ template <class ConstantClass> class ConstantUniqueMap {
struct MapInfo {
using ConstantClassInfo = DenseMapInfo<ConstantClass *>;
- static inline ConstantClass *getEmptyKey() {
- return ConstantClassInfo::getEmptyKey();
- }
-
static unsigned getHashValue(const ConstantClass *CP) {
SmallVector<Constant *, 32> Storage;
return getHashValue(LookupKey(CP->getType(), ValType(CP, Storage)));
@@ -587,8 +583,6 @@ template <class ConstantClass> class ConstantUniqueMap {
}
static bool isEqual(const LookupKey &LHS, const ConstantClass *RHS) {
- if (RHS == getEmptyKey())
- return false;
if (LHS.first != RHS->getType())
return false;
return LHS.second == RHS;
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index 57ff622b08813..41c8a92c56eda 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -76,8 +76,6 @@ class TypedPointerType;
class ValueHandleBase;
template <> struct DenseMapInfo<APFloat> {
- static inline APFloat getEmptyKey() { return APFloat(APFloat::Bogus(), 1); }
-
static unsigned getHashValue(const APFloat &Key) {
return static_cast<unsigned>(hash_value(Key));
}
@@ -107,10 +105,6 @@ struct AnonStructTypeKeyInfo {
bool operator!=(const KeyTy &that) const { return !this->operator==(that); }
};
- static inline StructType *getEmptyKey() {
- return DenseMapInfo<StructType *>::getEmptyKey();
- }
-
static unsigned getHashValue(const KeyTy &Key) {
return hash_combine(hash_combine_range(Key.ETypes), Key.isPacked);
}
@@ -120,8 +114,6 @@ struct AnonStructTypeKeyInfo {
}
static bool isEqual(const KeyTy &LHS, const StructType *RHS) {
- if (RHS == getEmptyKey())
- return false;
return LHS == KeyTy(RHS);
}
@@ -154,10 +146,6 @@ struct FunctionTypeKeyInfo {
bool operator!=(const KeyTy &that) const { return !this->operator==(that); }
};
- static inline FunctionType *getEmptyKey() {
- return DenseMapInfo<FunctionType *>::getEmptyKey();
- }
-
static unsigned getHashValue(const KeyTy &Key) {
return hash_combine(Key.ReturnType, hash_combine_range(Key.Params),
Key.isVarArg);
@@ -168,8 +156,6 @@ struct FunctionTypeKeyInfo {
}
static bool isEqual(const KeyTy &LHS, const FunctionType *RHS) {
- if (RHS == getEmptyKey())
- return false;
return LHS == KeyTy(RHS);
}
@@ -197,10 +183,6 @@ struct TargetExtTypeKeyInfo {
bool operator!=(const KeyTy &that) const { return !this->operator==(that); }
};
- static inline TargetExtType *getEmptyKey() {
- return DenseMapInfo<TargetExtType *>::getEmptyKey();
- }
-
static unsigned getHashValue(const KeyTy &Key) {
return hash_combine(Key.Name, hash_combine_range(Key.TypeParams),
hash_combine_range(Key.IntParams));
@@ -211,8 +193,6 @@ struct TargetExtTypeKeyInfo {
}
static bool isEqual(const KeyTy &LHS, const TargetExtType *RHS) {
- if (RHS == getEmptyKey())
- return false;
return LHS == KeyTy(RHS);
}
@@ -1508,10 +1488,6 @@ struct DIArgListKeyInfo {
struct DIArgListInfo {
using KeyTy = DIArgListKeyInfo;
- static inline DIArgList *getEmptyKey() {
- return DenseMapInfo<DIArgList *>::getEmptyKey();
- }
-
static unsigned getHashValue(const KeyTy &Key) { return Key.getHashValue(); }
static unsigned getHashValue(const DIArgList *N) {
@@ -1519,8 +1495,6 @@ struct DIArgListInfo {
}
...
[truncated]
|
|
@llvm/pr-subscribers-llvm-ir Author: Fangrui Song (MaskRay) ChangesAfter #201281 DenseMapInfo<T>::getEmptyKey() is no longer used by Patch is 21.01 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/201997.diff 20 Files Affected:
diff --git a/llvm/include/llvm/Analysis/AliasAnalysis.h b/llvm/include/llvm/Analysis/AliasAnalysis.h
index 26b6dca986685..4fbe8ea7b8de6 100644
--- a/llvm/include/llvm/Analysis/AliasAnalysis.h
+++ b/llvm/include/llvm/Analysis/AliasAnalysis.h
@@ -217,10 +217,6 @@ struct AACacheLoc {
};
template <> struct DenseMapInfo<AACacheLoc> {
- static inline AACacheLoc getEmptyKey() {
- return {DenseMapInfo<AACacheLoc::PtrTy>::getEmptyKey(),
- DenseMapInfo<LocationSize>::getEmptyKey()};
- }
static unsigned getHashValue(const AACacheLoc &Val) {
return DenseMapInfo<AACacheLoc::PtrTy>::getHashValue(Val.Ptr) ^
DenseMapInfo<LocationSize>::getHashValue(Val.Size);
diff --git a/llvm/include/llvm/Analysis/AssumeBundleQueries.h b/llvm/include/llvm/Analysis/AssumeBundleQueries.h
index 56a49b5db8d6f..5b61f45a4375e 100644
--- a/llvm/include/llvm/Analysis/AssumeBundleQueries.h
+++ b/llvm/include/llvm/Analysis/AssumeBundleQueries.h
@@ -50,9 +50,6 @@ inline bool hasAttributeInAssume(AssumeInst &Assume, Value *IsOn,
}
template<> struct DenseMapInfo<Attribute::AttrKind> {
- static Attribute::AttrKind getEmptyKey() {
- return Attribute::EmptyKey;
- }
static unsigned getHashValue(Attribute::AttrKind AK) {
return hash_combine(AK);
}
diff --git a/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h b/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
index c26e7529f9a91..c9eb5a40f0477 100644
--- a/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
+++ b/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
@@ -314,8 +314,6 @@ struct IRInstructionDataList
LLVM_ABI bool isClose(const IRInstructionData &A, const IRInstructionData &B);
struct IRInstructionDataTraits : DenseMapInfo<IRInstructionData *> {
- static inline IRInstructionData *getEmptyKey() { return nullptr; }
-
static unsigned getHashValue(const IRInstructionData *E) {
using llvm::hash_value;
assert(E && "IRInstructionData is a nullptr?");
@@ -324,10 +322,7 @@ struct IRInstructionDataTraits : DenseMapInfo<IRInstructionData *> {
static bool isEqual(const IRInstructionData *LHS,
const IRInstructionData *RHS) {
- if (RHS == getEmptyKey() || LHS == getEmptyKey())
- return LHS == RHS;
-
- assert(LHS && RHS && "nullptr should have been caught by getEmptyKey?");
+ assert(LHS && RHS && "nullptr is not expected as a key");
return isClose(*LHS, *RHS);
}
};
@@ -503,11 +498,6 @@ struct IRInstructionMapper {
IRInstructionMapper(SpecificBumpPtrAllocator<IRInstructionData> *IDA,
SpecificBumpPtrAllocator<IRInstructionDataList> *IDLA)
: InstDataAllocator(IDA), IDLAllocator(IDLA) {
- // Make sure that the implementation of DenseMapInfo<unsigned> hasn't
- // changed.
- static_assert(DenseMapInfo<unsigned>::getEmptyKey() ==
- static_cast<unsigned>(-1));
-
IDL = new (IDLAllocator->Allocate())
IRInstructionDataList();
}
diff --git a/llvm/include/llvm/Analysis/MemoryLocation.h b/llvm/include/llvm/Analysis/MemoryLocation.h
index cba55eb8198f6..f9ad8f9c40d98 100644
--- a/llvm/include/llvm/Analysis/MemoryLocation.h
+++ b/llvm/include/llvm/Analysis/MemoryLocation.h
@@ -329,7 +329,6 @@ class MemoryLocation {
// Specialize DenseMapInfo.
template <> struct DenseMapInfo<LocationSize> {
- static inline LocationSize getEmptyKey() { return LocationSize::mapEmpty(); }
static unsigned getHashValue(const LocationSize &Val) {
return DenseMapInfo<uint64_t>::getHashValue(Val.toRaw());
}
@@ -339,10 +338,6 @@ template <> struct DenseMapInfo<LocationSize> {
};
template <> struct DenseMapInfo<MemoryLocation> {
- static inline MemoryLocation getEmptyKey() {
- return MemoryLocation(DenseMapInfo<const Value *>::getEmptyKey(),
- DenseMapInfo<LocationSize>::getEmptyKey());
- }
static unsigned getHashValue(const MemoryLocation &Val) {
return DenseMapInfo<const Value *>::getHashValue(Val.Ptr) ^
DenseMapInfo<LocationSize>::getHashValue(Val.Size) ^
diff --git a/llvm/include/llvm/Analysis/MemorySSA.h b/llvm/include/llvm/Analysis/MemorySSA.h
index 9b0038567fa69..b95a8d0a80e9f 100644
--- a/llvm/include/llvm/Analysis/MemorySSA.h
+++ b/llvm/include/llvm/Analysis/MemorySSA.h
@@ -1203,11 +1203,6 @@ struct UpwardDefsElem {
};
template <> struct DenseMapInfo<UpwardDefsElem> {
- static inline UpwardDefsElem getEmptyKey() {
- return {DenseMapInfo<MemoryAccess *>::getEmptyKey(),
- DenseMapInfo<MemoryLocation>::getEmptyKey(), false};
- }
-
static unsigned getHashValue(const UpwardDefsElem &Val) {
return hash_combine(DenseMapInfo<MemoryAccess *>::getHashValue(Val.MA),
DenseMapInfo<MemoryLocation>::getHashValue(Val.Loc),
diff --git a/llvm/include/llvm/Analysis/ScalarEvolution.h b/llvm/include/llvm/Analysis/ScalarEvolution.h
index 2a536e81e691c..15b891b5b4da9 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolution.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolution.h
@@ -201,11 +201,6 @@ template <> struct PointerLikeTypeTraits<SCEVUse> {
};
template <> struct DenseMapInfo<SCEVUse> {
- static inline SCEVUse getEmptyKey() {
- uintptr_t Val = static_cast<uintptr_t>(-1);
- return PointerLikeTypeTraits<SCEVUse>::getFromVoidPointer((void *)Val);
- }
-
static unsigned getHashValue(SCEVUse U) {
return hash_value(U.getOpaqueValue());
}
@@ -2729,11 +2724,6 @@ class PredicatedScalarEvolution {
};
template <> struct DenseMapInfo<ScalarEvolution::FoldID> {
- static inline ScalarEvolution::FoldID getEmptyKey() {
- ScalarEvolution::FoldID ID(0);
- return ID;
- }
-
static unsigned getHashValue(const ScalarEvolution::FoldID &Val) {
return Val.computeHash();
}
diff --git a/llvm/include/llvm/Analysis/VectorUtils.h b/llvm/include/llvm/Analysis/VectorUtils.h
index 04c2041513aff..b863a307b143e 100644
--- a/llvm/include/llvm/Analysis/VectorUtils.h
+++ b/llvm/include/llvm/Analysis/VectorUtils.h
@@ -544,10 +544,6 @@ template <typename InstTy> class InterleaveGroup {
return false;
int32_t Key = *MaybeKey;
- // Skip if the key is used for the empty special value.
- if (DenseMapInfo<int32_t>::getEmptyKey() == Key)
- return false;
-
// Skip if there is already a member with the same index.
if (Members.contains(Key))
return false;
diff --git a/llvm/include/llvm/IR/Attributes.h b/llvm/include/llvm/IR/Attributes.h
index 2424d1c0b512d..5dc09ef66370a 100644
--- a/llvm/include/llvm/IR/Attributes.h
+++ b/llvm/include/llvm/IR/Attributes.h
@@ -526,12 +526,6 @@ class AttributeSet {
/// \class
/// Provide DenseMapInfo for AttributeSet.
template <> struct DenseMapInfo<AttributeSet, void> {
- static AttributeSet getEmptyKey() {
- auto Val = static_cast<uintptr_t>(-1);
- Val <<= PointerLikeTypeTraits<void *>::NumLowBitsAvailable;
- return AttributeSet(reinterpret_cast<AttributeSetNode *>(Val));
- }
-
static unsigned getHashValue(AttributeSet AS) {
return (unsigned((uintptr_t)AS.SetNode) >> 4) ^
(unsigned((uintptr_t)AS.SetNode) >> 9);
@@ -1095,12 +1089,6 @@ class AttributeList {
/// \class
/// Provide DenseMapInfo for AttributeList.
template <> struct DenseMapInfo<AttributeList, void> {
- static AttributeList getEmptyKey() {
- auto Val = static_cast<uintptr_t>(-1);
- Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;
- return AttributeList(reinterpret_cast<AttributeListImpl *>(Val));
- }
-
static unsigned getHashValue(AttributeList AS) {
return (unsigned((uintptr_t)AS.pImpl) >> 4) ^
(unsigned((uintptr_t)AS.pImpl) >> 9);
diff --git a/llvm/include/llvm/IR/BasicBlock.h b/llvm/include/llvm/IR/BasicBlock.h
index abf5b72f3df10..6b91902571b24 100644
--- a/llvm/include/llvm/IR/BasicBlock.h
+++ b/llvm/include/llvm/IR/BasicBlock.h
@@ -767,10 +767,6 @@ inline void BasicBlock::validateInstrOrdering() const {}
// maps and sets. The iterator is made up of its node pointer, and the
// debug-info "head" bit.
template <> struct DenseMapInfo<BasicBlock::iterator> {
- static inline BasicBlock::iterator getEmptyKey() {
- return BasicBlock::iterator(nullptr);
- }
-
static unsigned getHashValue(const BasicBlock::iterator &It) {
return DenseMapInfo<void *>::getHashValue(
reinterpret_cast<void *>(It.getNodePtr())) ^
diff --git a/llvm/include/llvm/IR/DebugInfo.h b/llvm/include/llvm/IR/DebugInfo.h
index 16d780bb6c8e2..01f8e97d24bce 100644
--- a/llvm/include/llvm/IR/DebugInfo.h
+++ b/llvm/include/llvm/IR/DebugInfo.h
@@ -260,11 +260,6 @@ struct VarRecord {
} // namespace at
template <> struct DenseMapInfo<at::VarRecord> {
- static inline at::VarRecord getEmptyKey() {
- return at::VarRecord(DenseMapInfo<DILocalVariable *>::getEmptyKey(),
- DenseMapInfo<DILocation *>::getEmptyKey());
- }
-
static unsigned getHashValue(const at::VarRecord &Var) {
return hash_combine(Var.Var, Var.DL);
}
diff --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h
index 29d2de7a58884..d1e1e0606ba1a 100644
--- a/llvm/include/llvm/IR/DebugInfoMetadata.h
+++ b/llvm/include/llvm/IR/DebugInfoMetadata.h
@@ -3923,8 +3923,6 @@ template <> struct DenseMapInfo<DIExpression::FragmentInfo> {
using FragInfo = DIExpression::FragmentInfo;
static const uint64_t MaxVal = std::numeric_limits<uint64_t>::max();
- static inline FragInfo getEmptyKey() { return {MaxVal, MaxVal}; }
-
static unsigned getHashValue(const FragInfo &Frag) {
return (Frag.SizeInBits & 0xffff) << 16 | (Frag.OffsetInBits & 0xffff);
}
@@ -4794,10 +4792,6 @@ template <> struct DenseMapInfo<DebugVariable> {
using FragmentInfo = DIExpression::FragmentInfo;
/// Empty key: no key should be generated that has no DILocalVariable.
- static inline DebugVariable getEmptyKey() {
- return DebugVariable(nullptr, std::nullopt, nullptr);
- }
-
static unsigned getHashValue(const DebugVariable &D) {
unsigned HV = 0;
const std::optional<FragmentInfo> Fragment = D.getFragment();
diff --git a/llvm/include/llvm/IR/Dominators.h b/llvm/include/llvm/IR/Dominators.h
index 7ea06ddccdc5d..4b84b5791ab77 100644
--- a/llvm/include/llvm/IR/Dominators.h
+++ b/llvm/include/llvm/IR/Dominators.h
@@ -119,10 +119,6 @@ template <> struct DenseMapInfo<BasicBlockEdge> {
LLVM_ABI static unsigned getHashValue(const BasicBlockEdge *V);
- static inline BasicBlockEdge getEmptyKey() {
- return BasicBlockEdge(BBInfo::getEmptyKey(), BBInfo::getEmptyKey());
- }
-
static unsigned getHashValue(const BasicBlockEdge &Edge) {
return hash_combine(BBInfo::getHashValue(Edge.getStart()),
BBInfo::getHashValue(Edge.getEnd()));
diff --git a/llvm/include/llvm/IR/Metadata.h b/llvm/include/llvm/IR/Metadata.h
index a6317bd021a9a..ce12c833cdbc7 100644
--- a/llvm/include/llvm/IR/Metadata.h
+++ b/llvm/include/llvm/IR/Metadata.h
@@ -869,11 +869,6 @@ struct AAMDNodes {
// Specialize DenseMapInfo for AAMDNodes.
template<>
struct DenseMapInfo<AAMDNodes> {
- static inline AAMDNodes getEmptyKey() {
- return AAMDNodes(DenseMapInfo<MDNode *>::getEmptyKey(), nullptr, nullptr,
- nullptr, nullptr);
- }
-
static unsigned getHashValue(const AAMDNodes &Val) {
return DenseMapInfo<MDNode *>::getHashValue(Val.TBAA) ^
DenseMapInfo<MDNode *>::getHashValue(Val.TBAAStruct) ^
diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index ae99593d16b6b..359026cfc85a0 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -301,16 +301,10 @@ inline bool operator<(const ValueInfo &A, const ValueInfo &B) {
}
template <> struct DenseMapInfo<ValueInfo> {
- static inline ValueInfo getEmptyKey() {
- return ValueInfo(false, (GlobalValueSummaryMapTy::value_type *)-8);
- }
-
- static inline bool isSpecialKey(ValueInfo V) { return V == getEmptyKey(); }
-
static bool isEqual(ValueInfo L, ValueInfo R) {
// We are not supposed to mix ValueInfo(s) with different HaveGVs flag
// in a same container.
- assert(isSpecialKey(L) || isSpecialKey(R) || (L.haveGVs() == R.haveGVs()));
+ assert(L.haveGVs() == R.haveGVs());
return L.getRef() == R.getRef();
}
static unsigned getHashValue(ValueInfo I) { return hash_value(I.getRef()); }
@@ -1125,8 +1119,6 @@ class FunctionSummary : public GlobalValueSummary {
};
template <> struct DenseMapInfo<FunctionSummary::VFuncId> {
- static FunctionSummary::VFuncId getEmptyKey() { return {0, uint64_t(-1)}; }
-
static bool isEqual(FunctionSummary::VFuncId L, FunctionSummary::VFuncId R) {
return L.GUID == R.GUID && L.Offset == R.Offset;
}
@@ -1135,10 +1127,6 @@ template <> struct DenseMapInfo<FunctionSummary::VFuncId> {
};
template <> struct DenseMapInfo<FunctionSummary::ConstVCall> {
- static FunctionSummary::ConstVCall getEmptyKey() {
- return {{0, uint64_t(-1)}, {}};
- }
-
static bool isEqual(FunctionSummary::ConstVCall L,
FunctionSummary::ConstVCall R) {
return DenseMapInfo<FunctionSummary::VFuncId>::isEqual(L.VFunc, R.VFunc) &&
diff --git a/llvm/include/llvm/IR/ValueHandle.h b/llvm/include/llvm/IR/ValueHandle.h
index 480f2bb92ebc6..4ad034cb54646 100644
--- a/llvm/include/llvm/IR/ValueHandle.h
+++ b/llvm/include/llvm/IR/ValueHandle.h
@@ -129,9 +129,7 @@ class ValueHandleBase {
protected:
Value *getValPtr() const { return Val; }
- static bool isValid(Value *V) {
- return V && V != DenseMapInfo<Value *>::getEmptyKey();
- }
+ static bool isValid(Value *V) { return V; }
/// Remove this ValueHandle from its current use list.
LLVM_ABI void RemoveFromUseList();
@@ -206,10 +204,6 @@ template <> struct simplify_type<const WeakVH> {
// Specialize DenseMapInfo to allow WeakVH to participate in DenseMap.
template <> struct DenseMapInfo<WeakVH> {
- static inline WeakVH getEmptyKey() {
- return WeakVH(DenseMapInfo<Value *>::getEmptyKey());
- }
-
static unsigned getHashValue(const WeakVH &Val) {
return DenseMapInfo<Value *>::getHashValue(Val);
}
@@ -576,12 +570,6 @@ class PoisoningVH final
// Specialize DenseMapInfo to allow PoisoningVH to participate in DenseMap.
template <typename T> struct DenseMapInfo<PoisoningVH<T>> {
- static inline PoisoningVH<T> getEmptyKey() {
- PoisoningVH<T> Res;
- Res.setRawValPtr(DenseMapInfo<Value *>::getEmptyKey());
- return Res;
- }
-
static unsigned getHashValue(const PoisoningVH<T> &Val) {
return DenseMapInfo<Value *>::getHashValue(Val.getRawValPtr());
}
diff --git a/llvm/include/llvm/IR/ValueMap.h b/llvm/include/llvm/IR/ValueMap.h
index 350ac8288d2e8..435347be3f3c1 100644
--- a/llvm/include/llvm/IR/ValueMap.h
+++ b/llvm/include/llvm/IR/ValueMap.h
@@ -292,10 +292,6 @@ template <typename KeyT, typename ValueT, typename Config>
struct DenseMapInfo<ValueMapCallbackVH<KeyT, ValueT, Config>> {
using VH = ValueMapCallbackVH<KeyT, ValueT, Config>;
- static inline VH getEmptyKey() {
- return VH(DenseMapInfo<Value *>::getEmptyKey());
- }
-
static unsigned getHashValue(const VH &Val) {
return DenseMapInfo<KeyT>::getHashValue(Val.Unwrap());
}
diff --git a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
index e180c203d13c5..256835bdba474 100644
--- a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
+++ b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
@@ -359,9 +359,6 @@ unsigned IRInstructionMapper::mapToLegalUnsigned(
assert(LegalInstrNumber < IllegalInstrNumber &&
"Instruction mapping overflow!");
- assert(LegalInstrNumber != DenseMapInfo<unsigned>::getEmptyKey() &&
- "Tried to assign DenseMap empty key to instruction.");
-
return INumber;
}
@@ -408,9 +405,6 @@ unsigned IRInstructionMapper::mapToIllegalUnsigned(
assert(LegalInstrNumber < IllegalInstrNumber &&
"Instruction mapping overflow!");
- assert(IllegalInstrNumber != DenseMapInfo<unsigned>::getEmptyKey() &&
- "IllegalInstrNumber cannot be DenseMap empty key!");
-
return INumber;
}
diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp
index c092187841e2a..10034d5ce2671 100644
--- a/llvm/lib/Analysis/MemorySSA.cpp
+++ b/llvm/lib/Analysis/MemorySSA.cpp
@@ -217,10 +217,6 @@ class MemoryLocOrCall {
namespace llvm {
template <> struct DenseMapInfo<MemoryLocOrCall> {
- static inline MemoryLocOrCall getEmptyKey() {
- return MemoryLocOrCall(DenseMapInfo<MemoryLocation>::getEmptyKey());
- }
-
static unsigned getHashValue(const MemoryLocOrCall &MLOC) {
if (!MLOC.IsCall)
return hash_combine(
diff --git a/llvm/lib/IR/ConstantsContext.h b/llvm/lib/IR/ConstantsContext.h
index 0fb2d2e49232e..424eeee739e07 100644
--- a/llvm/lib/IR/ConstantsContext.h
+++ b/llvm/lib/IR/ConstantsContext.h
@@ -565,10 +565,6 @@ template <class ConstantClass> class ConstantUniqueMap {
struct MapInfo {
using ConstantClassInfo = DenseMapInfo<ConstantClass *>;
- static inline ConstantClass *getEmptyKey() {
- return ConstantClassInfo::getEmptyKey();
- }
-
static unsigned getHashValue(const ConstantClass *CP) {
SmallVector<Constant *, 32> Storage;
return getHashValue(LookupKey(CP->getType(), ValType(CP, Storage)));
@@ -587,8 +583,6 @@ template <class ConstantClass> class ConstantUniqueMap {
}
static bool isEqual(const LookupKey &LHS, const ConstantClass *RHS) {
- if (RHS == getEmptyKey())
- return false;
if (LHS.first != RHS->getType())
return false;
return LHS.second == RHS;
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index 57ff622b08813..41c8a92c56eda 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -76,8 +76,6 @@ class TypedPointerType;
class ValueHandleBase;
template <> struct DenseMapInfo<APFloat> {
- static inline APFloat getEmptyKey() { return APFloat(APFloat::Bogus(), 1); }
-
static unsigned getHashValue(const APFloat &Key) {
return static_cast<unsigned>(hash_value(Key));
}
@@ -107,10 +105,6 @@ struct AnonStructTypeKeyInfo {
bool operator!=(const KeyTy &that) const { return !this->operator==(that); }
};
- static inline StructType *getEmptyKey() {
- return DenseMapInfo<StructType *>::getEmptyKey();
- }
-
static unsigned getHashValue(const KeyTy &Key) {
return hash_combine(hash_combine_range(Key.ETypes), Key.isPacked);
}
@@ -120,8 +114,6 @@ struct AnonStructTypeKeyInfo {
}
static bool isEqual(const KeyTy &LHS, const StructType *RHS) {
- if (RHS == getEmptyKey())
- return false;
return LHS == KeyTy(RHS);
}
@@ -154,10 +146,6 @@ struct FunctionTypeKeyInfo {
bool operator!=(const KeyTy &that) const { return !this->operator==(that); }
};
- static inline FunctionType *getEmptyKey() {
- return DenseMapInfo<FunctionType *>::getEmptyKey();
- }
-
static unsigned getHashValue(const KeyTy &Key) {
return hash_combine(Key.ReturnType, hash_combine_range(Key.Params),
Key.isVarArg);
@@ -168,8 +156,6 @@ struct FunctionTypeKeyInfo {
}
static bool isEqual(const KeyTy &LHS, const FunctionType *RHS) {
- if (RHS == getEmptyKey())
- return false;
return LHS == KeyTy(RHS);
}
@@ -197,10 +183,6 @@ struct TargetExtTypeKeyInfo {
bool operator!=(const KeyTy &that) const { return !this->operator==(that); }
};
- static inline TargetExtType *getEmptyKey() {
- return DenseMapInfo<TargetExtType *>::getEmptyKey();
- }
-
static unsigned getHashValue(const KeyTy &Key) {
return hash_combine(Key.Name, hash_combine_range(Key.TypeParams),
hash_combine_range(Key.IntParams));
@@ -211,8 +193,6 @@ struct TargetExtTypeKeyInfo {
}
static bool isEqual(const KeyTy &LHS, const TargetExtType *RHS) {
- if (RHS == getEmptyKey())
- return false;
return LHS == KeyTy(RHS);
}
@@ -1508,10 +1488,6 @@ struct DIArgListKeyInfo {
struct DIArgListInfo {
using KeyTy = DIArgListKeyInfo;
- static inline DIArgList *getEmptyKey() {
- return DenseMapInfo<DIArgList *>::getEmptyKey();
- }
-
static unsigned getHashValue(const KeyTy &Key) { return Key.getHashValue(); }
static unsigned getHashValue(const DIArgList *N) {
@@ -1519,8 +1495,6 @@ struct DIArgListInfo {
}
...
[truncated]
|
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
aengelke
left a comment
There was a problem hiding this comment.
LGTM with clang-format issues addressed (should be ok to do that here).
… for CTT) Squash of the landed SmallPtrSet/DenseMap optimization series plus the IR/Analysis getTombstoneKey/getEmptyKey cleanups, on top of the pre-SmallPtrSet baseline (parent of llvm#197637), so the compile-time tracker measures the whole series' cumulative impact as one from->to. The ADT DenseMapInfo getEmptyKey/getTombstoneKey definitions are intentionally kept: the primitive/generic specializations have direct callers tree-wide (e.g. CodeView TypeIndex.h, TableGen), so their removal needs the whole-tree caller cleanup that is out of scope here. Includes: llvm#197637 [SmallPtrSet] Drop tombstones in large mode llvm#198982 Don't assume non-erased DenseMap entries remain valid after erase llvm#199369 [DenseMap] Invalidate iterators on erase llvm#200540 [IR] Fix PoisoningVH relocation of a poisoned handle llvm#200595 [DenseMap] Replace tombstone deletion with TAOCP 6.4 Algorithm R llvm#200958 [IR][Analysis] Remove unused DenseMapInfo::getTombstoneKey llvm#201281 [DenseMap] Store occupancy in a packed used-bit array llvm#201742 [DenseMap] Fix ubsan error after llvm#201281 llvm#201997 [IR][Analysis] Remove unused DenseMapInfo::getEmptyKey Not for merge; measurement aid only.
After #201281 DenseMapInfo::getEmptyKey() is no longer used by
DenseMap. Remove the unused getEmptyKey definitions and dead sentinel
uses.