[Mlir-commits] [mlir] [mlir] Remove unused DenseMapInfo::getTombstoneKey (PR #200633)
Fangrui Song
llvmlistbot at llvm.org
Sat May 30 22:18:12 PDT 2026
https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/200633
#200595 changed DenseMap to no longer create tombstone buckets, so
DenseMapInfo<T>::getTombstoneKey() is never called. Remove dead
definitions and dead tombstone branches.
>From dfaf671b4feae448bca90da3aa965d261aac337f Mon Sep 17 00:00:00 2001
From: Fangrui Song <i at maskray.me>
Date: Sat, 30 May 2026 21:41:57 -0700
Subject: [PATCH] [mlir] Remove unused DenseMapInfo::getTombstoneKey
#200595 changed DenseMap to no longer create tombstone buckets, so
DenseMapInfo<T>::getTombstoneKey() is never called. Remove dead
definitions and dead tombstone branches.
---
mlir/docs/DefiningDialects/Operations.md | 8 --------
mlir/include/mlir/Analysis/CallGraph.h | 1 -
mlir/include/mlir/Analysis/DataFlowFramework.h | 6 ------
mlir/include/mlir/Dialect/LLVMIR/LLVMAttrs.h | 2 +-
mlir/include/mlir/IR/AffineExpr.h | 4 ----
mlir/include/mlir/IR/AffineMap.h | 4 ----
mlir/include/mlir/IR/Attributes.h | 12 ------------
mlir/include/mlir/IR/Block.h | 4 ----
mlir/include/mlir/IR/BlockSupport.h | 6 ------
mlir/include/mlir/IR/BuiltinAttributes.h | 4 ----
mlir/include/mlir/IR/DialectInterface.h | 2 +-
mlir/include/mlir/IR/IntegerSet.h | 4 ----
mlir/include/mlir/IR/Location.h | 4 ----
mlir/include/mlir/IR/OpDefinition.h | 4 ----
mlir/include/mlir/IR/OpImplementation.h | 4 ----
mlir/include/mlir/IR/OperationSupport.h | 8 --------
mlir/include/mlir/IR/Remarks.h | 16 ++--------------
mlir/include/mlir/IR/TypeRange.h | 17 -----------------
mlir/include/mlir/IR/Types.h | 8 --------
mlir/include/mlir/IR/Value.h | 16 ----------------
mlir/include/mlir/Pass/PassInstrumentation.h | 4 ----
mlir/include/mlir/Pass/PassManager.h | 4 ++--
mlir/include/mlir/Support/InterfaceSupport.h | 6 +-----
mlir/include/mlir/Support/TypeID.h | 4 ----
mlir/include/mlir/TableGen/Constraint.h | 1 -
mlir/include/mlir/TableGen/Format.h | 3 ---
mlir/include/mlir/TableGen/Pattern.h | 8 --------
mlir/include/mlir/Tools/PDLL/AST/Types.h | 5 -----
.../Conversion/PDLToPDLInterp/PredicateTree.cpp | 1 -
.../Transforms/DuplicateFunctionElimination.cpp | 3 +--
.../Dialect/Vector/Transforms/VectorUnroll.cpp | 2 --
mlir/lib/Support/StorageUniquer.cpp | 5 +----
mlir/lib/TableGen/Constraint.cpp | 13 ++-----------
mlir/lib/Transforms/Utils/CFGToSCF.cpp | 3 +--
mlir/lib/Transforms/Utils/CSE.cpp | 3 +--
mlir/lib/Transforms/Utils/DialectConversion.cpp | 1 -
mlir/tools/mlir-tblgen/EnumsGen.cpp | 4 ----
37 files changed, 13 insertions(+), 191 deletions(-)
diff --git a/mlir/docs/DefiningDialects/Operations.md b/mlir/docs/DefiningDialects/Operations.md
index b64bffdf72ae3..7e6d49a7b53f2 100644
--- a/mlir/docs/DefiningDialects/Operations.md
+++ b/mlir/docs/DefiningDialects/Operations.md
@@ -1571,10 +1571,6 @@ template<> struct DenseMapInfo<Outer::Inner::MyIntEnum> {
return static_cast<Outer::Inner::MyIntEnum>(StorageInfo::getEmptyKey());
}
- static inline Outer::Inner::MyIntEnum getTombstoneKey() {
- return static_cast<Outer::Inner::MyIntEnum>(StorageInfo::getTombstoneKey());
- }
-
static unsigned getHashValue(const Outer::Inner::MyIntEnum &val) {
return StorageInfo::getHashValue(static_cast<uint32_t>(val));
}
@@ -1701,10 +1697,6 @@ template<> struct DenseMapInfo<::MyBitEnum> {
return static_cast<::MyBitEnum>(StorageInfo::getEmptyKey());
}
- static inline ::MyBitEnum getTombstoneKey() {
- return static_cast<::MyBitEnum>(StorageInfo::getTombstoneKey());
- }
-
static unsigned getHashValue(const ::MyBitEnum &val) {
return StorageInfo::getHashValue(static_cast<uint32_t>(val));
}
diff --git a/mlir/include/mlir/Analysis/CallGraph.h b/mlir/include/mlir/Analysis/CallGraph.h
index 631cdd1ad2290..6b34a08b4799b 100644
--- a/mlir/include/mlir/Analysis/CallGraph.h
+++ b/mlir/include/mlir/Analysis/CallGraph.h
@@ -121,7 +121,6 @@ class CallGraphNode {
DenseMapInfo<llvm::PointerIntPair<CallGraphNode *, 2, Edge::Kind>>;
static Edge getEmptyKey() { return Edge(BaseInfo::getEmptyKey()); }
- static Edge getTombstoneKey() { return Edge(BaseInfo::getTombstoneKey()); }
static unsigned getHashValue(const Edge &edge) {
return BaseInfo::getHashValue(edge.targetAndKind);
}
diff --git a/mlir/include/mlir/Analysis/DataFlowFramework.h b/mlir/include/mlir/Analysis/DataFlowFramework.h
index 25506645f2f26..0995fe1fcdef8 100644
--- a/mlir/include/mlir/Analysis/DataFlowFramework.h
+++ b/mlir/include/mlir/Analysis/DataFlowFramework.h
@@ -817,12 +817,6 @@ struct DenseMapInfo<mlir::ProgramPoint> {
(mlir::Block *)pointer,
mlir::Block::iterator((mlir::Operation *)pointer));
}
- static mlir::ProgramPoint getTombstoneKey() {
- void *pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
- return mlir::ProgramPoint(
- (mlir::Block *)pointer,
- mlir::Block::iterator((mlir::Operation *)pointer));
- }
static unsigned getHashValue(mlir::ProgramPoint pp) {
return hash_combine(pp.getBlock(), pp.getPoint().getNodePtr());
}
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrs.h b/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrs.h
index ce62f0751d876..e10d7f7df3450 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrs.h
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrs.h
@@ -79,7 +79,7 @@ class TBAANodeAttr : public Attribute {
/// Support LLVM type casting.
static bool classof(Attribute attr);
- /// Required by DenseMapInfo to create empty and tombstone key.
+ /// Required by DenseMapInfo to create the empty key.
static TBAANodeAttr getFromOpaquePointer(const void *pointer) {
return TBAANodeAttr(reinterpret_cast<const ImplType *>(pointer));
}
diff --git a/mlir/include/mlir/IR/AffineExpr.h b/mlir/include/mlir/IR/AffineExpr.h
index 94eacdb4735f8..a5a7e9f2455ea 100644
--- a/mlir/include/mlir/IR/AffineExpr.h
+++ b/mlir/include/mlir/IR/AffineExpr.h
@@ -358,10 +358,6 @@ struct DenseMapInfo<mlir::AffineExpr> {
auto *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
return mlir::AffineExpr(static_cast<mlir::AffineExpr::ImplType *>(pointer));
}
- static mlir::AffineExpr getTombstoneKey() {
- auto *pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
- return mlir::AffineExpr(static_cast<mlir::AffineExpr::ImplType *>(pointer));
- }
static unsigned getHashValue(mlir::AffineExpr val) {
return mlir::hash_value(val);
}
diff --git a/mlir/include/mlir/IR/AffineMap.h b/mlir/include/mlir/IR/AffineMap.h
index de10b99771da1..d483d5f271560 100644
--- a/mlir/include/mlir/IR/AffineMap.h
+++ b/mlir/include/mlir/IR/AffineMap.h
@@ -719,10 +719,6 @@ struct DenseMapInfo<mlir::AffineMap> {
auto *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
return mlir::AffineMap(static_cast<mlir::AffineMap::ImplType *>(pointer));
}
- static mlir::AffineMap getTombstoneKey() {
- auto *pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
- return mlir::AffineMap(static_cast<mlir::AffineMap::ImplType *>(pointer));
- }
static unsigned getHashValue(mlir::AffineMap val) {
return mlir::hash_value(val);
}
diff --git a/mlir/include/mlir/IR/Attributes.h b/mlir/include/mlir/IR/Attributes.h
index 6eef0e3f79bae..011b7c496268f 100644
--- a/mlir/include/mlir/IR/Attributes.h
+++ b/mlir/include/mlir/IR/Attributes.h
@@ -306,10 +306,6 @@ struct DenseMapInfo<mlir::Attribute> {
auto *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
return mlir::Attribute(static_cast<mlir::Attribute::ImplType *>(pointer));
}
- static mlir::Attribute getTombstoneKey() {
- auto *pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
- return mlir::Attribute(static_cast<mlir::Attribute::ImplType *>(pointer));
- }
static unsigned getHashValue(mlir::Attribute val) {
return mlir::hash_value(val);
}
@@ -326,10 +322,6 @@ struct DenseMapInfo<
const void *pointer = llvm::DenseMapInfo<const void *>::getEmptyKey();
return T::getFromOpaquePointer(pointer);
}
- static T getTombstoneKey() {
- const void *pointer = llvm::DenseMapInfo<const void *>::getTombstoneKey();
- return T::getFromOpaquePointer(pointer);
- }
};
/// Allow LLVM to steal the low bits of Attributes.
@@ -351,10 +343,6 @@ struct DenseMapInfo<mlir::NamedAttribute> {
auto emptyAttr = llvm::DenseMapInfo<mlir::Attribute>::getEmptyKey();
return mlir::NamedAttribute(emptyAttr, emptyAttr);
}
- static mlir::NamedAttribute getTombstoneKey() {
- auto tombAttr = llvm::DenseMapInfo<mlir::Attribute>::getTombstoneKey();
- return mlir::NamedAttribute(tombAttr, tombAttr);
- }
static unsigned getHashValue(mlir::NamedAttribute val) {
return mlir::hash_value(val);
}
diff --git a/mlir/include/mlir/IR/Block.h b/mlir/include/mlir/IR/Block.h
index 92351402ed53b..72a07e04e0d3a 100644
--- a/mlir/include/mlir/IR/Block.h
+++ b/mlir/include/mlir/IR/Block.h
@@ -444,10 +444,6 @@ struct DenseMapInfo<mlir::Block::iterator> {
void *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
return mlir::Block::iterator((mlir::Operation *)pointer);
}
- static mlir::Block::iterator getTombstoneKey() {
- void *pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
- return mlir::Block::iterator((mlir::Operation *)pointer);
- }
static unsigned getHashValue(mlir::Block::iterator iter) {
return hash_value(iter.getNodePtr());
}
diff --git a/mlir/include/mlir/IR/BlockSupport.h b/mlir/include/mlir/IR/BlockSupport.h
index 77c2f314a9345..f256708a1afa6 100644
--- a/mlir/include/mlir/IR/BlockSupport.h
+++ b/mlir/include/mlir/IR/BlockSupport.h
@@ -180,18 +180,12 @@ struct DenseMapInfo<mlir::SuccessorRange> {
auto *pointer = llvm::DenseMapInfo<mlir::BlockOperand *>::getEmptyKey();
return mlir::SuccessorRange(pointer, 0);
}
- static mlir::SuccessorRange getTombstoneKey() {
- auto *pointer = llvm::DenseMapInfo<mlir::BlockOperand *>::getTombstoneKey();
- return mlir::SuccessorRange(pointer, 0);
- }
static unsigned getHashValue(mlir::SuccessorRange value) {
return llvm::hash_combine_range(value);
}
static bool isEqual(mlir::SuccessorRange lhs, mlir::SuccessorRange rhs) {
if (rhs.getBase() == getEmptyKey().getBase())
return lhs.getBase() == getEmptyKey().getBase();
- if (rhs.getBase() == getTombstoneKey().getBase())
- return lhs.getBase() == getTombstoneKey().getBase();
return lhs == rhs;
}
};
diff --git a/mlir/include/mlir/IR/BuiltinAttributes.h b/mlir/include/mlir/IR/BuiltinAttributes.h
index c7eddf44fb29b..ce3870f00bc13 100644
--- a/mlir/include/mlir/IR/BuiltinAttributes.h
+++ b/mlir/include/mlir/IR/BuiltinAttributes.h
@@ -1108,10 +1108,6 @@ struct DenseMapInfo<mlir::StringAttr> : public DenseMapInfo<mlir::Attribute> {
const void *pointer = llvm::DenseMapInfo<const void *>::getEmptyKey();
return mlir::StringAttr::getFromOpaquePointer(pointer);
}
- static mlir::StringAttr getTombstoneKey() {
- const void *pointer = llvm::DenseMapInfo<const void *>::getTombstoneKey();
- return mlir::StringAttr::getFromOpaquePointer(pointer);
- }
};
template <>
struct PointerLikeTypeTraits<mlir::StringAttr>
diff --git a/mlir/include/mlir/IR/DialectInterface.h b/mlir/include/mlir/IR/DialectInterface.h
index 36502cc304b69..fcef3cafb1b43 100644
--- a/mlir/include/mlir/IR/DialectInterface.h
+++ b/mlir/include/mlir/IR/DialectInterface.h
@@ -87,7 +87,7 @@ class DialectInterfaceCollectionBase {
}
static bool isEqual(Dialect *lhs, const DialectInterface *rhs) {
- if (rhs == getEmptyKey() || rhs == getTombstoneKey())
+ if (rhs == getEmptyKey())
return false;
return lhs == rhs->getDialect();
}
diff --git a/mlir/include/mlir/IR/IntegerSet.h b/mlir/include/mlir/IR/IntegerSet.h
index f814776f1ee7f..68b0b9f324f4e 100644
--- a/mlir/include/mlir/IR/IntegerSet.h
+++ b/mlir/include/mlir/IR/IntegerSet.h
@@ -135,10 +135,6 @@ struct DenseMapInfo<mlir::IntegerSet> {
auto *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
return mlir::IntegerSet(static_cast<mlir::IntegerSet::ImplType *>(pointer));
}
- static mlir::IntegerSet getTombstoneKey() {
- auto *pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
- return mlir::IntegerSet(static_cast<mlir::IntegerSet::ImplType *>(pointer));
- }
static unsigned getHashValue(mlir::IntegerSet val) {
return mlir::hash_value(val);
}
diff --git a/mlir/include/mlir/IR/Location.h b/mlir/include/mlir/IR/Location.h
index d286befe1920c..772a974950408 100644
--- a/mlir/include/mlir/IR/Location.h
+++ b/mlir/include/mlir/IR/Location.h
@@ -232,10 +232,6 @@ struct DenseMapInfo<mlir::Location> {
auto *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
return mlir::Location::getFromOpaquePointer(pointer);
}
- static mlir::Location getTombstoneKey() {
- auto *pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
- return mlir::Location::getFromOpaquePointer(pointer);
- }
static unsigned getHashValue(mlir::Location val) {
return mlir::hash_value(val);
}
diff --git a/mlir/include/mlir/IR/OpDefinition.h b/mlir/include/mlir/IR/OpDefinition.h
index c1fba10e06a90..b93dfc0258207 100644
--- a/mlir/include/mlir/IR/OpDefinition.h
+++ b/mlir/include/mlir/IR/OpDefinition.h
@@ -2168,10 +2168,6 @@ struct DenseMapInfo<T,
auto *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
return T::getFromOpaquePointer(pointer);
}
- static inline T getTombstoneKey() {
- auto *pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
- return T::getFromOpaquePointer(pointer);
- }
static unsigned getHashValue(T val) {
return hash_value(val.getAsOpaquePointer());
}
diff --git a/mlir/include/mlir/IR/OpImplementation.h b/mlir/include/mlir/IR/OpImplementation.h
index e66f149b6f812..6142a986b89e0 100644
--- a/mlir/include/mlir/IR/OpImplementation.h
+++ b/mlir/include/mlir/IR/OpImplementation.h
@@ -1848,10 +1848,6 @@ struct DenseMapInfo<mlir::AsmDialectResourceHandle> {
return {DenseMapInfo<void *>::getEmptyKey(),
DenseMapInfo<mlir::TypeID>::getEmptyKey(), nullptr};
}
- static inline mlir::AsmDialectResourceHandle getTombstoneKey() {
- return {DenseMapInfo<void *>::getTombstoneKey(),
- DenseMapInfo<mlir::TypeID>::getTombstoneKey(), nullptr};
- }
static unsigned getHashValue(const mlir::AsmDialectResourceHandle &handle) {
return DenseMapInfo<void *>::getHashValue(handle.getResource());
}
diff --git a/mlir/include/mlir/IR/OperationSupport.h b/mlir/include/mlir/IR/OperationSupport.h
index c4ba2f324df72..f7d9c4f936b8f 100644
--- a/mlir/include/mlir/IR/OperationSupport.h
+++ b/mlir/include/mlir/IR/OperationSupport.h
@@ -1455,10 +1455,6 @@ struct DenseMapInfo<mlir::OperationName> {
void *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
return mlir::OperationName::getFromOpaquePointer(pointer);
}
- static mlir::OperationName getTombstoneKey() {
- void *pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
- return mlir::OperationName::getFromOpaquePointer(pointer);
- }
static unsigned getHashValue(mlir::OperationName val) {
return DenseMapInfo<void *>::getHashValue(val.getAsOpaquePointer());
}
@@ -1473,10 +1469,6 @@ struct DenseMapInfo<mlir::RegisteredOperationName>
void *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
return mlir::RegisteredOperationName::getFromOpaquePointer(pointer);
}
- static mlir::RegisteredOperationName getTombstoneKey() {
- void *pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
- return mlir::RegisteredOperationName::getFromOpaquePointer(pointer);
- }
};
template <>
diff --git a/mlir/include/mlir/IR/Remarks.h b/mlir/include/mlir/IR/Remarks.h
index 93f7993400e4f..8390ac7520c6c 100644
--- a/mlir/include/mlir/IR/Remarks.h
+++ b/mlir/include/mlir/IR/Remarks.h
@@ -750,7 +750,6 @@ namespace llvm {
template <>
struct DenseMapInfo<mlir::remark::detail::Remark> {
static constexpr StringRef kEmptyKey = "<EMPTY_KEY>";
- static constexpr StringRef kTombstoneKey = "<TOMBSTONE_KEY>";
/// Helper to provide a static dummy context for sentinel keys.
static mlir::MLIRContext *getStaticDummyContext() {
@@ -766,14 +765,6 @@ struct DenseMapInfo<mlir::remark::detail::Remark> {
mlir::remark::RemarkOpts::name(kEmptyKey));
}
- /// Create a dead remark
- static inline mlir::remark::detail::Remark getTombstoneKey() {
- return mlir::remark::detail::Remark(
- mlir::remark::RemarkKind::RemarkUnknown, mlir::DiagnosticSeverity::Note,
- mlir::UnknownLoc::get(getStaticDummyContext()),
- mlir::remark::RemarkOpts::name(kTombstoneKey));
- }
-
/// Compute the hash value of the remark
static unsigned getHashValue(const mlir::remark::detail::Remark &remark) {
return llvm::hash_combine(
@@ -785,11 +776,8 @@ struct DenseMapInfo<mlir::remark::detail::Remark> {
static bool isEqual(const mlir::remark::detail::Remark &lhs,
const mlir::remark::detail::Remark &rhs) {
- // Check for empty/tombstone keys first
- if (lhs.getRemarkName() == kEmptyKey ||
- lhs.getRemarkName() == kTombstoneKey ||
- rhs.getRemarkName() == kEmptyKey ||
- rhs.getRemarkName() == kTombstoneKey) {
+ // Check for empty keys first.
+ if (lhs.getRemarkName() == kEmptyKey || rhs.getRemarkName() == kEmptyKey) {
return lhs.getRemarkName() == rhs.getRemarkName();
}
diff --git a/mlir/include/mlir/IR/TypeRange.h b/mlir/include/mlir/IR/TypeRange.h
index 67d010f88a9a0..ffe49e6ca4e87 100644
--- a/mlir/include/mlir/IR/TypeRange.h
+++ b/mlir/include/mlir/IR/TypeRange.h
@@ -209,17 +209,11 @@ struct DenseMapInfo<mlir::TypeRange> {
return mlir::TypeRange(getEmptyKeyPointer(), 0);
}
- static mlir::TypeRange getTombstoneKey() {
- return mlir::TypeRange(getTombstoneKeyPointer(), 0);
- }
-
static unsigned getHashValue(mlir::TypeRange val) { return hash_value(val); }
static bool isEqual(mlir::TypeRange lhs, mlir::TypeRange rhs) {
if (isEmptyKey(rhs))
return isEmptyKey(lhs);
- if (isTombstoneKey(rhs))
- return isTombstoneKey(lhs);
return lhs == rhs;
}
@@ -228,23 +222,12 @@ struct DenseMapInfo<mlir::TypeRange> {
return DenseMapInfo<mlir::Type *>::getEmptyKey();
}
- static const mlir::Type *getTombstoneKeyPointer() {
- return DenseMapInfo<mlir::Type *>::getTombstoneKey();
- }
-
static bool isEmptyKey(mlir::TypeRange range) {
if (const auto *type =
llvm::dyn_cast_if_present<const mlir::Type *>(range.getBase()))
return type == getEmptyKeyPointer();
return false;
}
-
- static bool isTombstoneKey(mlir::TypeRange range) {
- if (const auto *type =
- llvm::dyn_cast_if_present<const mlir::Type *>(range.getBase()))
- return type == getTombstoneKeyPointer();
- return false;
- }
};
} // namespace llvm
diff --git a/mlir/include/mlir/IR/Types.h b/mlir/include/mlir/IR/Types.h
index 97583a93f6157..3d010b234f49a 100644
--- a/mlir/include/mlir/IR/Types.h
+++ b/mlir/include/mlir/IR/Types.h
@@ -317,10 +317,6 @@ struct DenseMapInfo<mlir::Type> {
auto *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
return mlir::Type(static_cast<mlir::Type::ImplType *>(pointer));
}
- static mlir::Type getTombstoneKey() {
- auto *pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
- return mlir::Type(static_cast<mlir::Type::ImplType *>(pointer));
- }
static unsigned getHashValue(mlir::Type val) { return mlir::hash_value(val); }
static bool isEqual(mlir::Type LHS, mlir::Type RHS) { return LHS == RHS; }
};
@@ -332,10 +328,6 @@ struct DenseMapInfo<T, std::enable_if_t<std::is_base_of<mlir::Type, T>::value &&
const void *pointer = llvm::DenseMapInfo<const void *>::getEmptyKey();
return T::getFromOpaquePointer(pointer);
}
- static T getTombstoneKey() {
- const void *pointer = llvm::DenseMapInfo<const void *>::getTombstoneKey();
- return T::getFromOpaquePointer(pointer);
- }
};
/// We align TypeStorage by 8, so allow LLVM to steal the low bits.
diff --git a/mlir/include/mlir/IR/Value.h b/mlir/include/mlir/IR/Value.h
index fa09209b93c71..78061af400687 100644
--- a/mlir/include/mlir/IR/Value.h
+++ b/mlir/include/mlir/IR/Value.h
@@ -504,10 +504,6 @@ struct DenseMapInfo<mlir::Value> {
void *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
return mlir::Value::getFromOpaquePointer(pointer);
}
- static mlir::Value getTombstoneKey() {
- void *pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
- return mlir::Value::getFromOpaquePointer(pointer);
- }
static unsigned getHashValue(mlir::Value val) {
return mlir::hash_value(val);
}
@@ -519,10 +515,6 @@ struct DenseMapInfo<mlir::BlockArgument> : public DenseMapInfo<mlir::Value> {
void *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
return reinterpret_cast<mlir::detail::BlockArgumentImpl *>(pointer);
}
- static mlir::BlockArgument getTombstoneKey() {
- void *pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
- return reinterpret_cast<mlir::detail::BlockArgumentImpl *>(pointer);
- }
};
template <>
struct DenseMapInfo<mlir::OpResult> : public DenseMapInfo<mlir::Value> {
@@ -530,10 +522,6 @@ struct DenseMapInfo<mlir::OpResult> : public DenseMapInfo<mlir::Value> {
void *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
return reinterpret_cast<mlir::detail::OpResultImpl *>(pointer);
}
- static mlir::OpResult getTombstoneKey() {
- void *pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
- return reinterpret_cast<mlir::detail::OpResultImpl *>(pointer);
- }
};
template <typename T>
struct DenseMapInfo<mlir::detail::TypedValue<T>>
@@ -542,10 +530,6 @@ struct DenseMapInfo<mlir::detail::TypedValue<T>>
void *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
return reinterpret_cast<mlir::detail::ValueImpl *>(pointer);
}
- static mlir::detail::TypedValue<T> getTombstoneKey() {
- void *pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
- return reinterpret_cast<mlir::detail::ValueImpl *>(pointer);
- }
};
/// Allow stealing the low bits of a value.
diff --git a/mlir/include/mlir/Pass/PassInstrumentation.h b/mlir/include/mlir/Pass/PassInstrumentation.h
index 4ceff9d657aa4..6f121da843235 100644
--- a/mlir/include/mlir/Pass/PassInstrumentation.h
+++ b/mlir/include/mlir/Pass/PassInstrumentation.h
@@ -139,10 +139,6 @@ struct DenseMapInfo<mlir::PassInstrumentation::PipelineParentInfo> {
auto pair = PairInfo::getEmptyKey();
return {pair.first, reinterpret_cast<mlir::Pass *>(pair.second)};
}
- static T getTombstoneKey() {
- auto pair = PairInfo::getTombstoneKey();
- return {pair.first, reinterpret_cast<mlir::Pass *>(pair.second)};
- }
static unsigned getHashValue(T val) {
return PairInfo::getHashValue({val.parentThreadID, val.parentPass});
}
diff --git a/mlir/include/mlir/Pass/PassManager.h b/mlir/include/mlir/Pass/PassManager.h
index 6e59b0f32ac6f..4f7f60f6dba1a 100644
--- a/mlir/include/mlir/Pass/PassManager.h
+++ b/mlir/include/mlir/Pass/PassManager.h
@@ -488,9 +488,9 @@ class PassManager : public OpPassManager {
/// Hash keys used to detect when reinitialization is necessary.
llvm::hash_code initializationKey =
- DenseMapInfo<llvm::hash_code>::getTombstoneKey();
+ DenseMapInfo<llvm::hash_code>::getEmptyKey();
llvm::hash_code pipelineInitializationKey =
- DenseMapInfo<llvm::hash_code>::getTombstoneKey();
+ DenseMapInfo<llvm::hash_code>::getEmptyKey();
/// Flag that specifies if pass timing is enabled.
bool passTiming : 1;
diff --git a/mlir/include/mlir/Support/InterfaceSupport.h b/mlir/include/mlir/Support/InterfaceSupport.h
index e24dd2676cfa3..ddb1b2fe6856f 100644
--- a/mlir/include/mlir/Support/InterfaceSupport.h
+++ b/mlir/include/mlir/Support/InterfaceSupport.h
@@ -116,7 +116,7 @@ class Interface : public BaseType {
assert(!t || ConcreteType::getInterfaceFor(t) == conceptImpl);
}
- /// Constructor for DenseMapInfo's empty key and tombstone key.
+ /// Constructor for DenseMapInfo's empty key.
Interface(ValueT t, std::nullptr_t) : BaseType(t), conceptImpl(nullptr) {}
/// Support 'classof' by checking if the given object defines the concrete
@@ -300,10 +300,6 @@ struct DenseMapInfo<T, std::enable_if_t<mlir::detail::IsInterface<T>::value>> {
static T getEmptyKey() { return T(ValueTypeInfo::getEmptyKey(), nullptr); }
- static T getTombstoneKey() {
- return T(ValueTypeInfo::getTombstoneKey(), nullptr);
- }
-
static unsigned getHashValue(T val) {
return ValueTypeInfo::getHashValue(val);
}
diff --git a/mlir/include/mlir/Support/TypeID.h b/mlir/include/mlir/Support/TypeID.h
index 459e9dae12a9f..807a3ee391dc5 100644
--- a/mlir/include/mlir/Support/TypeID.h
+++ b/mlir/include/mlir/Support/TypeID.h
@@ -398,10 +398,6 @@ struct DenseMapInfo<mlir::TypeID> {
void *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
return mlir::TypeID::getFromOpaquePointer(pointer);
}
- static inline mlir::TypeID getTombstoneKey() {
- void *pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
- return mlir::TypeID::getFromOpaquePointer(pointer);
- }
static unsigned getHashValue(mlir::TypeID val) {
return mlir::hash_value(val);
}
diff --git a/mlir/include/mlir/TableGen/Constraint.h b/mlir/include/mlir/TableGen/Constraint.h
index af00d2b4a7e7d..21438a9dd99ea 100644
--- a/mlir/include/mlir/TableGen/Constraint.h
+++ b/mlir/include/mlir/TableGen/Constraint.h
@@ -122,7 +122,6 @@ struct DenseMapInfo<mlir::tblgen::Constraint> {
using RecordDenseMapInfo = llvm::DenseMapInfo<const llvm::Record *>;
static mlir::tblgen::Constraint getEmptyKey();
- static mlir::tblgen::Constraint getTombstoneKey();
static unsigned getHashValue(mlir::tblgen::Constraint constraint);
static bool isEqual(mlir::tblgen::Constraint lhs,
mlir::tblgen::Constraint rhs);
diff --git a/mlir/include/mlir/TableGen/Format.h b/mlir/include/mlir/TableGen/Format.h
index e92f6c64eab56..e81195d9b77ca 100644
--- a/mlir/include/mlir/TableGen/Format.h
+++ b/mlir/include/mlir/TableGen/Format.h
@@ -71,9 +71,6 @@ class FmtContext {
static inline PHKind getEmptyKey() {
return static_cast<PHKind>(CharInfo::getEmptyKey());
}
- static inline PHKind getTombstoneKey() {
- return static_cast<PHKind>(CharInfo::getTombstoneKey());
- }
static unsigned getHashValue(const PHKind &val) {
return CharInfo::getHashValue(static_cast<char>(val));
}
diff --git a/mlir/include/mlir/TableGen/Pattern.h b/mlir/include/mlir/TableGen/Pattern.h
index d2610f09b6241..66b272cb67dbd 100644
--- a/mlir/include/mlir/TableGen/Pattern.h
+++ b/mlir/include/mlir/TableGen/Pattern.h
@@ -676,10 +676,6 @@ struct DenseMapInfo<mlir::tblgen::DagNode> {
return mlir::tblgen::DagNode(
llvm::DenseMapInfo<llvm::DagInit *>::getEmptyKey());
}
- static mlir::tblgen::DagNode getTombstoneKey() {
- return mlir::tblgen::DagNode(
- llvm::DenseMapInfo<llvm::DagInit *>::getTombstoneKey());
- }
static unsigned getHashValue(mlir::tblgen::DagNode node) {
return llvm::hash_value(node.getAsOpaquePointer());
}
@@ -694,10 +690,6 @@ struct DenseMapInfo<mlir::tblgen::DagLeaf> {
return mlir::tblgen::DagLeaf(
llvm::DenseMapInfo<llvm::Init *>::getEmptyKey());
}
- static mlir::tblgen::DagLeaf getTombstoneKey() {
- return mlir::tblgen::DagLeaf(
- llvm::DenseMapInfo<llvm::Init *>::getTombstoneKey());
- }
static unsigned getHashValue(mlir::tblgen::DagLeaf leaf) {
return llvm::hash_value(leaf.getAsOpaquePointer());
}
diff --git a/mlir/include/mlir/Tools/PDLL/AST/Types.h b/mlir/include/mlir/Tools/PDLL/AST/Types.h
index b7e57dc184701..6e0ace101c654 100644
--- a/mlir/include/mlir/Tools/PDLL/AST/Types.h
+++ b/mlir/include/mlir/Tools/PDLL/AST/Types.h
@@ -399,11 +399,6 @@ struct DenseMapInfo<mlir::pdll::ast::Type> {
return mlir::pdll::ast::Type(
static_cast<mlir::pdll::ast::Type::Storage *>(pointer));
}
- static mlir::pdll::ast::Type getTombstoneKey() {
- void *pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
- return mlir::pdll::ast::Type(
- static_cast<mlir::pdll::ast::Type::Storage *>(pointer));
- }
static unsigned getHashValue(mlir::pdll::ast::Type val) {
return llvm::hash_value(val.getImpl());
}
diff --git a/mlir/lib/Conversion/PDLToPDLInterp/PredicateTree.cpp b/mlir/lib/Conversion/PDLToPDLInterp/PredicateTree.cpp
index 4490c326d864c..93f963753a6cf 100644
--- a/mlir/lib/Conversion/PDLToPDLInterp/PredicateTree.cpp
+++ b/mlir/lib/Conversion/PDLToPDLInterp/PredicateTree.cpp
@@ -768,7 +768,6 @@ struct OrderedPredicateDenseInfo {
using Base = DenseMapInfo<std::pair<Position *, Qualifier *>>;
static OrderedPredicate getEmptyKey() { return Base::getEmptyKey(); }
- static OrderedPredicate getTombstoneKey() { return Base::getTombstoneKey(); }
static bool isEqual(const OrderedPredicate &lhs,
const OrderedPredicate &rhs) {
return lhs.position == rhs.position && lhs.question == rhs.question;
diff --git a/mlir/lib/Dialect/Func/Transforms/DuplicateFunctionElimination.cpp b/mlir/lib/Dialect/Func/Transforms/DuplicateFunctionElimination.cpp
index ea85c20cd1f8f..6441504d9d297 100644
--- a/mlir/lib/Dialect/Func/Transforms/DuplicateFunctionElimination.cpp
+++ b/mlir/lib/Dialect/Func/Transforms/DuplicateFunctionElimination.cpp
@@ -53,8 +53,7 @@ struct DuplicateFuncOpEquivalenceInfo
static bool isEqual(func::FuncOp lhs, func::FuncOp rhs) {
if (lhs == rhs)
return true;
- if (lhs == getTombstoneKey() || lhs == getEmptyKey() ||
- rhs == getTombstoneKey() || rhs == getEmptyKey())
+ if (lhs == getEmptyKey() || rhs == getEmptyKey())
return false;
if (lhs.isDeclaration() || rhs.isDeclaration())
diff --git a/mlir/lib/Dialect/Vector/Transforms/VectorUnroll.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorUnroll.cpp
index c6215abd847d9..4847de420c281 100644
--- a/mlir/lib/Dialect/Vector/Transforms/VectorUnroll.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/VectorUnroll.cpp
@@ -263,8 +263,6 @@ struct UnrollTransferWritePattern
struct OffsetMapInfo {
static SmallVector<int64_t> getEmptyKey() { return {int64_t(-1)}; }
- static SmallVector<int64_t> getTombstoneKey() { return {int64_t(-2)}; }
-
static unsigned getHashValue(const SmallVector<int64_t> &v) {
return static_cast<unsigned>(llvm::hash_combine_range(v));
}
diff --git a/mlir/lib/Support/StorageUniquer.cpp b/mlir/lib/Support/StorageUniquer.cpp
index 2e9b17e1e1c76..71e0bf74ed402 100644
--- a/mlir/lib/Support/StorageUniquer.cpp
+++ b/mlir/lib/Support/StorageUniquer.cpp
@@ -51,9 +51,6 @@ class ParametricStorageUniquer {
static inline HashedStorage getEmptyKey() {
return HashedStorage(0, DenseMapInfo<BaseStorage *>::getEmptyKey());
}
- static inline HashedStorage getTombstoneKey() {
- return HashedStorage(0, DenseMapInfo<BaseStorage *>::getTombstoneKey());
- }
static inline unsigned getHashValue(const HashedStorage &key) {
return key.hashValue;
@@ -67,7 +64,7 @@ class ParametricStorageUniquer {
return lhs.storage == rhs.storage;
}
static inline bool isEqual(const LookupKey &lhs, const HashedStorage &rhs) {
- if (isEqual(rhs, getEmptyKey()) || isEqual(rhs, getTombstoneKey()))
+ if (isEqual(rhs, getEmptyKey()))
return false;
// Invoke the equality function on the lookup key.
return lhs.isEqual(rhs.storage);
diff --git a/mlir/lib/TableGen/Constraint.cpp b/mlir/lib/TableGen/Constraint.cpp
index 92d33bff68bed..68452610c58fc 100644
--- a/mlir/lib/TableGen/Constraint.cpp
+++ b/mlir/lib/TableGen/Constraint.cpp
@@ -130,27 +130,18 @@ Constraint DenseMapInfo<Constraint>::getEmptyKey() {
Constraint::CK_Uncategorized);
}
-Constraint DenseMapInfo<Constraint>::getTombstoneKey() {
- return Constraint(RecordDenseMapInfo::getTombstoneKey(),
- Constraint::CK_Uncategorized);
-}
-
unsigned DenseMapInfo<Constraint>::getHashValue(Constraint constraint) {
if (constraint == getEmptyKey())
return RecordDenseMapInfo::getHashValue(RecordDenseMapInfo::getEmptyKey());
- if (constraint == getTombstoneKey()) {
- return RecordDenseMapInfo::getHashValue(
- RecordDenseMapInfo::getTombstoneKey());
- }
return llvm::hash_combine(constraint.getPredicate(), constraint.getSummary());
}
bool DenseMapInfo<Constraint>::isEqual(Constraint lhs, Constraint rhs) {
if (lhs == rhs)
return true;
- if (lhs == getEmptyKey() || lhs == getTombstoneKey())
+ if (lhs == getEmptyKey())
return false;
- if (rhs == getEmptyKey() || rhs == getTombstoneKey())
+ if (rhs == getEmptyKey())
return false;
return lhs.getPredicate() == rhs.getPredicate() &&
lhs.getSummary() == rhs.getSummary();
diff --git a/mlir/lib/Transforms/Utils/CFGToSCF.cpp b/mlir/lib/Transforms/Utils/CFGToSCF.cpp
index ebfd74a5ee496..6981c1e4837b3 100644
--- a/mlir/lib/Transforms/Utils/CFGToSCF.cpp
+++ b/mlir/lib/Transforms/Utils/CFGToSCF.cpp
@@ -404,8 +404,7 @@ struct ReturnLikeOpEquivalence : public llvm::DenseMapInfo<Operation *> {
static bool isEqual(const Operation *lhs, const Operation *rhs) {
if (lhs == rhs)
return true;
- if (lhs == getTombstoneKey() || lhs == getEmptyKey() ||
- rhs == getTombstoneKey() || rhs == getEmptyKey())
+ if (lhs == getEmptyKey() || rhs == getEmptyKey())
return false;
return OperationEquivalence::isEquivalentTo(
const_cast<Operation *>(lhs), const_cast<Operation *>(rhs),
diff --git a/mlir/lib/Transforms/Utils/CSE.cpp b/mlir/lib/Transforms/Utils/CSE.cpp
index 90444e6201891..612d3eac4dce4 100644
--- a/mlir/lib/Transforms/Utils/CSE.cpp
+++ b/mlir/lib/Transforms/Utils/CSE.cpp
@@ -38,8 +38,7 @@ struct SimpleOperationInfo : public llvm::DenseMapInfo<Operation *> {
auto *rhs = const_cast<Operation *>(rhsC);
if (lhs == rhs)
return true;
- if (lhs == getTombstoneKey() || lhs == getEmptyKey() ||
- rhs == getTombstoneKey() || rhs == getEmptyKey())
+ if (lhs == getEmptyKey() || rhs == getEmptyKey())
return false;
return OperationEquivalence::isEquivalentTo(
const_cast<Operation *>(lhsC), const_cast<Operation *>(rhsC),
diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index 9666302507281..c0af1d59b4c18 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -124,7 +124,6 @@ namespace {
/// Helper class to make it possible to use `ValueVector` as a key in DenseMap.
struct ValueVectorMapInfo {
static ValueVector getEmptyKey() { return ValueVector{Value()}; }
- static ValueVector getTombstoneKey() { return ValueVector{Value(), Value()}; }
static ::llvm::hash_code getHashValue(const ValueVector &val) {
return ::llvm::hash_combine_range(val);
}
diff --git a/mlir/tools/mlir-tblgen/EnumsGen.cpp b/mlir/tools/mlir-tblgen/EnumsGen.cpp
index abf3fd9505f25..04f2a27cc1913 100644
--- a/mlir/tools/mlir-tblgen/EnumsGen.cpp
+++ b/mlir/tools/mlir-tblgen/EnumsGen.cpp
@@ -317,10 +317,6 @@ template<> struct DenseMapInfo<{0}> {{
return static_cast<{0}>(StorageInfo::getEmptyKey());
}
- static inline {0} getTombstoneKey() {{
- return static_cast<{0}>(StorageInfo::getTombstoneKey());
- }
-
static unsigned getHashValue(const {0} &val) {{
return StorageInfo::getHashValue(static_cast<{1}>(val));
}
More information about the Mlir-commits
mailing list