llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-llvm-binary-utilities @llvm/pr-subscribers-llvm-ir Author: Fangrui Song (MaskRay) <details> <summary>Changes</summary> #<!-- -->200595 changed DenseMap to no longer create tombstone buckets, so DenseMapInfo<T>::getTombstoneKey() is never called. Remove dead definitions and dead tombstone branches. --- Patch is 126.42 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/200628.diff 128 Files Affected: - (modified) bolt/include/bolt/Passes/DataflowAnalysis.h (-5) - (modified) bolt/include/bolt/Passes/SplitFunctions.h (-3) - (modified) bolt/include/bolt/Profile/DataReader.h (-4) - (modified) llvm/include/llvm/ADT/APFixedPoint.h (-8) - (modified) llvm/include/llvm/ADT/APInt.h (-6) - (modified) llvm/include/llvm/ADT/APSInt.h (-4) - (modified) llvm/include/llvm/ADT/ArrayRef.h (-9) - (modified) llvm/include/llvm/ADT/BitVector.h (-5) - (modified) llvm/include/llvm/ADT/CachedHashString.h (+12-28) - (modified) llvm/include/llvm/ADT/DenseMapInfo.h (-32) - (modified) llvm/include/llvm/ADT/DenseMapInfoVariant.h (-5) - (modified) llvm/include/llvm/ADT/Hashing.h (-2) - (modified) llvm/include/llvm/ADT/ImmutableList.h (-4) - (modified) llvm/include/llvm/ADT/PointerEmbeddedInt.h (-1) - (modified) llvm/include/llvm/ADT/PointerIntPair.h (-6) - (modified) llvm/include/llvm/ADT/PointerSumType.h (-5) - (modified) llvm/include/llvm/ADT/PointerUnion.h (-4) - (modified) llvm/include/llvm/ADT/SmallBitVector.h (-5) - (modified) llvm/include/llvm/ADT/SmallVector.h (-4) - (modified) llvm/include/llvm/ADT/StringRef.h (-7) - (modified) llvm/include/llvm/Analysis/AliasAnalysis.h (-4) - (modified) llvm/include/llvm/Analysis/AssumeBundleQueries.h (-3) - (modified) llvm/include/llvm/Analysis/IRSimilarityIdentifier.h (+1-7) - (modified) llvm/include/llvm/Analysis/MemoryLocation.h (-7) - (modified) llvm/include/llvm/Analysis/MemorySSA.h (-5) - (modified) llvm/include/llvm/Analysis/ScalarEvolution.h (-9) - (modified) llvm/include/llvm/Analysis/VectorUtils.h (+2-3) - (modified) llvm/include/llvm/BinaryFormat/Minidump.h (-4) - (modified) llvm/include/llvm/BinaryFormat/Wasm.h (+2-2) - (modified) llvm/include/llvm/BinaryFormat/WasmTraits.h (-16) - (modified) llvm/include/llvm/CAS/CASID.h (+5-5) - (modified) llvm/include/llvm/CAS/CASReference.h (-4) - (modified) llvm/include/llvm/CodeGen/AccelTable.h (-3) - (modified) llvm/include/llvm/CodeGen/MachineBasicBlock.h (-3) - (modified) llvm/include/llvm/CodeGen/MachineInstr.h (+1-6) - (modified) llvm/include/llvm/CodeGen/MachineOperand.h (+1-9) - (modified) llvm/include/llvm/CodeGen/PBQP/CostAllocator.h (+2-6) - (modified) llvm/include/llvm/CodeGen/Register.h (-3) - (modified) llvm/include/llvm/CodeGen/SelectionDAGNodes.h (-6) - (modified) llvm/include/llvm/CodeGen/TargetInstrInfo.h (-5) - (modified) llvm/include/llvm/CodeGenTypes/LowLevelType.h (-5) - (modified) llvm/include/llvm/DWARFLinker/Classic/DWARFLinkerDeclContext.h (+1-2) - (modified) llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h (-6) - (modified) llvm/include/llvm/DebugInfo/CodeView/TypeIndex.h (-3) - (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h (-2) - (modified) llvm/include/llvm/DebugInfo/GSYM/FileEntry.h (-4) - (modified) llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h (-3) - (modified) llvm/include/llvm/ExecutionEngine/Orc/Shared/MemoryFlags.h (-6) - (modified) llvm/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h (-8) - (modified) llvm/include/llvm/Frontend/OpenMP/OMPContext.h (-3) - (modified) llvm/include/llvm/IR/Attributes.h (-12) - (modified) llvm/include/llvm/IR/BasicBlock.h (-6) - (modified) llvm/include/llvm/IR/DebugInfo.h (-5) - (modified) llvm/include/llvm/IR/DebugInfoMetadata.h (-7) - (modified) llvm/include/llvm/IR/Dominators.h (-4) - (modified) llvm/include/llvm/IR/Metadata.h (-5) - (modified) llvm/include/llvm/IR/ModuleSummaryIndex.h (+1-15) - (modified) llvm/include/llvm/IR/ValueHandle.h (+1-13) - (modified) llvm/include/llvm/IR/ValueMap.h (+1-5) - (modified) llvm/include/llvm/Linker/IRMover.h (-1) - (modified) llvm/include/llvm/MC/MCRegister.h (-3) - (modified) llvm/include/llvm/Object/ObjectFile.h (-5) - (modified) llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h (-8) - (modified) llvm/include/llvm/ProfileData/FunctionId.h (-4) - (modified) llvm/include/llvm/ProfileData/SampleProf.h (-4) - (modified) llvm/include/llvm/SandboxIR/Context.h (-3) - (modified) llvm/include/llvm/Support/FileSystem/UniqueID.h (-6) - (modified) llvm/include/llvm/Support/TypeSize.h (-3) - (modified) llvm/include/llvm/Support/UniqueBBID.h (-5) - (modified) llvm/include/llvm/Support/VersionTuple.h (-3) - (modified) llvm/include/llvm/TextAPI/SymbolSet.h (-5) - (modified) llvm/include/llvm/Transforms/IPO/Attributor.h (+2-17) - (modified) llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h (+1-2) - (modified) llvm/include/llvm/Transforms/IPO/IROutliner.h (-2) - (modified) llvm/include/llvm/Transforms/Scalar/GVNExpression.h (+1-2) - (modified) llvm/include/llvm/Transforms/Utils/BypassSlowDivision.h (-4) - (modified) llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/VecUtils.h (-3) - (modified) llvm/lib/Analysis/IRSimilarityIdentifier.cpp (+2-7) - (modified) llvm/lib/Analysis/MemorySSA.cpp (-5) - (modified) llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h (-11) - (modified) llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp (-3) - (modified) llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp (-4) - (modified) llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp (-1) - (modified) llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h (-10) - (modified) llvm/lib/CodeGen/MachineOutliner.cpp (+2-9) - (modified) llvm/lib/CodeGen/StackMaps.cpp (+3-5) - (modified) llvm/lib/DebugInfo/CodeView/TypeHashing.cpp (-4) - (modified) llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp (-4) - (modified) llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp (-5) - (modified) llvm/lib/IR/ConstantsContext.h (+1-5) - (modified) llvm/lib/IR/LLVMContextImpl.h (+6-29) - (modified) llvm/lib/Linker/IRMover.cpp (+2-6) - (modified) llvm/lib/Object/Minidump.cpp (+1-2) - (modified) llvm/lib/Support/StringRef.cpp (+1-5) - (modified) llvm/lib/Target/AArch64/AArch64StackTaggingPreRA.cpp (-1) - (modified) llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp (+2-10) - (modified) llvm/lib/Target/CSKY/MCTargetDesc/CSKYTargetStreamer.h (-3) - (modified) llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp (-3) - (modified) llvm/lib/Target/SPIRV/SPIRVTypeInst.h (-3) - (modified) llvm/lib/Target/X86/X86OptimizeLEAs.cpp (+2-12) - (modified) llvm/lib/Transforms/IPO/Attributor.cpp (-2) - (modified) llvm/lib/Transforms/IPO/AttributorAttributes.cpp (+1-18) - (modified) llvm/lib/Transforms/IPO/FunctionSpecialization.cpp (-3) - (modified) llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp (-9) - (modified) llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp (-3) - (modified) llvm/lib/Transforms/Scalar/EarlyCSE.cpp (+3-18) - (modified) llvm/lib/Transforms/Scalar/GVN.cpp (-1) - (modified) llvm/lib/Transforms/Scalar/GVNSink.cpp (-5) - (modified) llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp (-4) - (modified) llvm/lib/Transforms/Scalar/NewGVN.cpp (+2-9) - (modified) llvm/lib/Transforms/Utils/CanonicalizeFreezeInLoops.cpp (-5) - (modified) llvm/lib/Transforms/Utils/Local.cpp (+2-13) - (modified) llvm/lib/Transforms/Utils/SimplifyCFG.cpp (+1-6) - (modified) llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp (-5) - (modified) llvm/lib/Transforms/Vectorize/LoopVectorize.cpp (+1-6) - (modified) llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp (-11) - (modified) llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp (+1-1) - (modified) llvm/tools/dsymutil/BinaryHolder.h (-4) - (modified) llvm/tools/llvm-c-test/echo.cpp (-4) - (modified) llvm/tools/llvm-reduce/deltas/Delta.h (-6) - (modified) llvm/tools/llvm-split/llvm-split.cpp (-2) - (modified) llvm/unittests/ADT/DenseMapTest.cpp (-5) - (modified) llvm/unittests/ADT/DenseSetTest.cpp (-4) - (modified) llvm/unittests/ADT/MapVectorTest.cpp (-1) - (modified) llvm/unittests/Support/ReverseIterationTest.cpp (-5) - (modified) llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp (-5) - (modified) llvm/utils/gdb-scripts/prettyprinters.py (+2-5) - (modified) polly/include/polly/Support/VirtualInstruction.h (-7) ``````````diff diff --git a/bolt/include/bolt/Passes/DataflowAnalysis.h b/bolt/include/bolt/Passes/DataflowAnalysis.h index 41b7667a5c9db..5d9442c85be19 100644 --- a/bolt/include/bolt/Passes/DataflowAnalysis.h +++ b/bolt/include/bolt/Passes/DataflowAnalysis.h @@ -570,11 +570,6 @@ template <> struct DenseMapInfo<bolt::ProgramPoint> { Val <<= PointerLikeTypeTraits<MCInst *>::NumLowBitsAvailable; return bolt::ProgramPoint(reinterpret_cast<MCInst *>(Val)); } - static inline bolt::ProgramPoint getTombstoneKey() { - uintptr_t Val = static_cast<uintptr_t>(-2); - Val <<= PointerLikeTypeTraits<MCInst *>::NumLowBitsAvailable; - return bolt::ProgramPoint(reinterpret_cast<MCInst *>(Val)); - } static unsigned getHashValue(const bolt::ProgramPoint &PP) { return (unsigned((uintptr_t)PP.Data.BB) >> 4) ^ (unsigned((uintptr_t)PP.Data.BB) >> 9); diff --git a/bolt/include/bolt/Passes/SplitFunctions.h b/bolt/include/bolt/Passes/SplitFunctions.h index 2c1bf1890cd97..ddbdaf0e7e5f4 100644 --- a/bolt/include/bolt/Passes/SplitFunctions.h +++ b/bolt/include/bolt/Passes/SplitFunctions.h @@ -43,9 +43,6 @@ class SplitFunctions : public BinaryFunctionPass { : SourceFN(SourceFN), Target(Target) {} static inline TrampolineKey getEmptyKey() { return TrampolineKey(); }; - static inline TrampolineKey getTombstoneKey() { - return TrampolineKey(FragmentNum(UINT_MAX), nullptr); - }; static unsigned getHashValue(const TrampolineKey &Val) { return llvm::hash_combine(Val.SourceFN.get(), Val.Target); } diff --git a/bolt/include/bolt/Profile/DataReader.h b/bolt/include/bolt/Profile/DataReader.h index d5fc1ef38d6a4..01bf17064432b 100644 --- a/bolt/include/bolt/Profile/DataReader.h +++ b/bolt/include/bolt/Profile/DataReader.h @@ -491,10 +491,6 @@ template <> struct DenseMapInfo<bolt::Location> { static inline bolt::Location getEmptyKey() { return bolt::Location(true, StringRef(), static_cast<uint64_t>(-1LL)); } - static inline bolt::Location getTombstoneKey() { - return bolt::Location(true, StringRef(), static_cast<uint64_t>(-2LL)); - ; - } static unsigned getHashValue(const bolt::Location &L) { return (unsigned(DenseMapInfo<StringRef>::getHashValue(L.Name)) >> 4) ^ (unsigned(L.Offset)); 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<FixedPointSemantics> { 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<APFixedPoint> { return APFixedPoint(DenseMapInfo<FixedPointSemantics>::getEmptyKey()); } - static inline APFixedPoint getTombstoneKey() { - return APFixedPoint(DenseMapInfo<FixedPointSemantics>::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<APInt, void> { 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<APSInt, void> { return APSInt(DenseMapInfo<APInt, void>::getEmptyKey()); } - static inline APSInt getTombstoneKey() { - return APSInt(DenseMapInfo<APInt, void>::getTombstoneKey()); - } - static unsigned getHashValue(const APSInt &Key) { return DenseMapInfo<APInt, void>::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 <typename T> struct DenseMapInfo<ArrayRef<T>, void> { size_t(0)); } - static inline ArrayRef<T> getTombstoneKey() { - return ArrayRef<T>(reinterpret_cast<const T *>(~static_cast<uintptr_t>(1)), - size_t(0)); - } - static unsigned getHashValue(ArrayRef<T> 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<T> LHS, ArrayRef<T> 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..266c181be6d03 100644 --- a/llvm/include/llvm/ADT/BitVector.h +++ b/llvm/include/llvm/ADT/BitVector.h @@ -854,11 +854,6 @@ inline BitVector::size_type capacity_in_bytes(const BitVector &X) { template <> struct DenseMapInfo<BitVector> { static inline BitVector getEmptyKey() { return {}; } - static inline BitVector getTombstoneKey() { - BitVector V; - V.invalid(); - return V; - } static unsigned getHashValue(const BitVector &V) { return DenseMapInfo<std::pair<BitVector::size_type, ArrayRef<uintptr_t>>>:: getHashValue(std::make_pair(V.size(), V.getData())); 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<CachedHashStringRef> { static CachedHashStringRef getEmptyKey() { return CachedHashStringRef(DenseMapInfo<StringRef>::getEmptyKey(), 0); } - static CachedHashStringRef getTombstoneKey() { - return CachedHashStringRef(DenseMapInfo<StringRef>::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<char *>::getEmptyKey(); } - static char *getTombstoneKeyPtr() { - return DenseMapInfo<char *>::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<CachedHashString> { 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<CachedHashString> { 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<typename T, typename Enable = void> 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<T*> { return reinterpret_cast<T*>(Val); } - static constexpr T *getTombstoneKey() { - uintptr_t Val = static_cast<uintptr_t>(-2); - Val <<= Log2MaxAlign; - return reinterpret_cast<T*>(Val); - } - static unsigned getHashValue(const T *PtrVal) { return densemap::detail::mix(reinterpret_cast<uintptr_t>(PtrVal)); } @@ -93,7 +86,6 @@ struct DenseMapInfo<T*> { // Provide DenseMapInfo for chars. template<> struct DenseMapInfo<char> { 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_integral_v<T> && !std::is_same_v<T, char>>> { static constexpr T getEmptyKey() { return std::numeric_limits<T>::max(); } - static constexpr T getTombstoneKey() { - if constexpr (std::is_unsigned_v<T> || std::is_same_v<T, long>) - return std::numeric_limits<T>::max() - 1; - else - return std::numeric_limits<T>::min(); - } - static unsigned getHashValue(const T &Val) { if constexpr (std::is_unsigned_v<T> && sizeof(T) > sizeof(unsigned)) return densemap::detail::mix(Val); @@ -141,10 +126,6 @@ struct DenseMapInfo<std::pair<T, U>> { 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 <typename... Ts> struct DenseMapInfo<std::tuple<Ts...>> { return Tuple(DenseMapInfo<Ts>::getEmptyKey()...); } - static constexpr Tuple getTombstoneKey() { - return Tuple(DenseMapInfo<Ts>::getTombstoneKey()...); - } - template <unsigned I> static unsigned getHashValueImpl(const Tuple &values) { if constexpr (I == sizeof...(Ts)) { return 0; @@ -223,11 +200,6 @@ struct DenseMapInfo<Enum, std::enable_if_t<std::is_enum_v<Enum>>> { return V; } - static constexpr Enum getTombstoneKey() { - constexpr Enum V = static_cast<Enum>(Info::getTombstoneKey()); - return V; - } - static unsigned getHashValue(const Enum &Val) { return Info::getHashValue(static_cast<UnderlyingType>(Val)); } @@ -241,10 +213,6 @@ template <typename T> struct DenseMapInfo<std::optional<T>> { 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 <typename... Ts> struct DenseMapInfo<std::variant<Ts...>> { return Variant(std::in_place_index<0>, DenseMapInfo<FirstT>::getEmptyKey()); } - static inline Variant getTombstoneKey() { - return Variant(std::in_place_index<0>, - DenseMapInfo<FirstT>::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..af395b0128b5e 100644 --- a/llvm/include/llvm/ADT/Hashing.h +++ b/llvm/include/llvm/ADT/Hashing.h @@ -294,7 +294,6 @@ inline void store_hashable_data(char *buf, size_t &off, const T &arg) { } // namespace detail } // namespace hashing - /// Compute a hash_code for a sequence of values. /// /// This hashes a sequence of values. It produces the same hash_code as @@ -392,7 +391,6 @@ template <typename T> hash_code hash_value(const std::optional<T> &arg) { template <> struct DenseMapInfo<hash_code, void> { 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<unsigned>(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 <typename T> struct DenseMapInfo<ImmutableList<T>, void> { return reinterpret_cast<ImmutableListImpl<T>*>(-1); } - static inline ImmutableList<T> getTombstoneKey() { - return reinterpret_cast<ImmutableListImpl<T>*>(-2); - } - static unsigned getHashValue(ImmutableList<T> X) { uintptr_t PtrVal = reinterpret_cast<uintptr_t>(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<PointerEmbeddedInt<IntT, Bits>> { using IntInfo = DenseMapInfo<IntT>; 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<PointerIntPair<PointerTy, IntBits, IntType>, void> { return Ty::getFromOpaqueValue(reinterpret_cast<void *>(Val)); } - static Ty getTombstoneKey() { - uintptr_t Val = static_cast<uintptr_t>(-2); - Val <<= PointerLikeTypeTraits<PointerTy>::NumLowBitsAvailable; - return Ty::getFromOpaqueValue(reinterpret_cast<void *>(Val)); - } - static unsigned getHashValue(Ty V) { uintptr_t IV = reinterpret_cast<uintptr_t>(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<PointerSumType<TagT, MemberTs...>> { return SumType::template create<SomeTag>(SomePointerInfo::getEmptyKey()); } - static inline SumType getTombstoneKey() { - return SumType::template create<SomeTag>( - SomePointerInfo::getTombstoneKey()); - } - static unsigned getHashValue(const SumType &Arg) { uintptr_t OpaqueValue = Arg.getOpaqueValue(); return DenseMapInfo<uintptr_t>::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 <typename... PTs> struct DenseMapInfo<PointerUnion<PTs...>> { 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<uintptr_t>(UnionVal.getOpaqueValue()); return DenseMapInfo<uintptr_t>::getHashValue(Key); diff --git a/llvm/include/llvm/ADT/SmallBitVector.h b/llvm/include/llvm/ADT/SmallBitVector.h index 978dc3f073031..4d79b17a0e118 100644 --- a/llvm/include/llvm/ADT/SmallBitVector.h +++ b/llvm/include/llvm/ADT/SmallBitVector.h @@ -735,11 +735,6 @@ operator^(const SmallBitVector &LHS, const SmallBitVector &RHS) { template <> struct DenseMapInfo<SmallBitVector> { 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< 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 <typename T, unsigned N> struct DenseMapInfo<llvm::SmallVector<T, N>> { return {DenseMapInfo<T>::getEmptyKey()}; } - static SmallVector<T, N> getTombstoneKey() { - return {DenseMapInfo<T>::getTombstoneKey()}; - } - static unsigned getHashValue(const SmallVector<T, N> &V) { return static_cast<unsigned>(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<StringRef, void> { 0); } - static inline StringRef getTombstoneKey() { - return StringRef(reinterpret_cast<const char *>(~static_cast<uintptr_t>(1)), - 0); - } - LLVM_ABI static unsigned getHashValu... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/200628 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
