Skip to content

[mlir] Remove unused DenseMapInfo::getTombstoneKey#200633

Merged
MaskRay merged 1 commit into
llvm:mainfrom
MaskRay:pr/drop-tombstone-mlir
Jun 1, 2026
Merged

[mlir] Remove unused DenseMapInfo::getTombstoneKey#200633
MaskRay merged 1 commit into
llvm:mainfrom
MaskRay:pr/drop-tombstone-mlir

Conversation

@MaskRay
Copy link
Copy Markdown
Member

@MaskRay MaskRay commented May 31, 2026

#200595 changed DenseMap to no longer create tombstone buckets, so
DenseMapInfo::getTombstoneKey() is never called. Remove dead
definitions and dead tombstone branches.

llvm#200595 changed DenseMap to no longer create tombstone buckets, so
DenseMapInfo<T>::getTombstoneKey() is never called. Remove dead
definitions and dead tombstone branches.
@llvmorg-github-actions
Copy link
Copy Markdown

llvmorg-github-actions Bot commented May 31, 2026

@llvm/pr-subscribers-mlir-llvm

@llvm/pr-subscribers-mlir

Author: Fangrui Song (MaskRay)

Changes

#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 32.36 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/200633.diff

37 Files Affected:

  • (modified) mlir/docs/DefiningDialects/Operations.md (-8)
  • (modified) mlir/include/mlir/Analysis/CallGraph.h (-1)
  • (modified) mlir/include/mlir/Analysis/DataFlowFramework.h (-6)
  • (modified) mlir/include/mlir/Dialect/LLVMIR/LLVMAttrs.h (+1-1)
  • (modified) mlir/include/mlir/IR/AffineExpr.h (-4)
  • (modified) mlir/include/mlir/IR/AffineMap.h (-4)
  • (modified) mlir/include/mlir/IR/Attributes.h (-12)
  • (modified) mlir/include/mlir/IR/Block.h (-4)
  • (modified) mlir/include/mlir/IR/BlockSupport.h (-6)
  • (modified) mlir/include/mlir/IR/BuiltinAttributes.h (-4)
  • (modified) mlir/include/mlir/IR/DialectInterface.h (+1-1)
  • (modified) mlir/include/mlir/IR/IntegerSet.h (-4)
  • (modified) mlir/include/mlir/IR/Location.h (-4)
  • (modified) mlir/include/mlir/IR/OpDefinition.h (-4)
  • (modified) mlir/include/mlir/IR/OpImplementation.h (-4)
  • (modified) mlir/include/mlir/IR/OperationSupport.h (-8)
  • (modified) mlir/include/mlir/IR/Remarks.h (+2-14)
  • (modified) mlir/include/mlir/IR/TypeRange.h (-17)
  • (modified) mlir/include/mlir/IR/Types.h (-8)
  • (modified) mlir/include/mlir/IR/Value.h (-16)
  • (modified) mlir/include/mlir/Pass/PassInstrumentation.h (-4)
  • (modified) mlir/include/mlir/Pass/PassManager.h (+2-2)
  • (modified) mlir/include/mlir/Support/InterfaceSupport.h (+1-5)
  • (modified) mlir/include/mlir/Support/TypeID.h (-4)
  • (modified) mlir/include/mlir/TableGen/Constraint.h (-1)
  • (modified) mlir/include/mlir/TableGen/Format.h (-3)
  • (modified) mlir/include/mlir/TableGen/Pattern.h (-8)
  • (modified) mlir/include/mlir/Tools/PDLL/AST/Types.h (-5)
  • (modified) mlir/lib/Conversion/PDLToPDLInterp/PredicateTree.cpp (-1)
  • (modified) mlir/lib/Dialect/Func/Transforms/DuplicateFunctionElimination.cpp (+1-2)
  • (modified) mlir/lib/Dialect/Vector/Transforms/VectorUnroll.cpp (-2)
  • (modified) mlir/lib/Support/StorageUniquer.cpp (+1-4)
  • (modified) mlir/lib/TableGen/Constraint.cpp (+2-11)
  • (modified) mlir/lib/Transforms/Utils/CFGToSCF.cpp (+1-2)
  • (modified) mlir/lib/Transforms/Utils/CSE.cpp (+1-2)
  • (modified) mlir/lib/Transforms/Utils/DialectConversion.cpp (-1)
  • (modified) mlir/tools/mlir-tblgen/EnumsGen.cpp (-4)
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/Pa...
[truncated]

@llvmorg-github-actions
Copy link
Copy Markdown

@llvm/pr-subscribers-mlir-func

Author: Fangrui Song (MaskRay)

Changes

#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 32.36 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/200633.diff

37 Files Affected:

  • (modified) mlir/docs/DefiningDialects/Operations.md (-8)
  • (modified) mlir/include/mlir/Analysis/CallGraph.h (-1)
  • (modified) mlir/include/mlir/Analysis/DataFlowFramework.h (-6)
  • (modified) mlir/include/mlir/Dialect/LLVMIR/LLVMAttrs.h (+1-1)
  • (modified) mlir/include/mlir/IR/AffineExpr.h (-4)
  • (modified) mlir/include/mlir/IR/AffineMap.h (-4)
  • (modified) mlir/include/mlir/IR/Attributes.h (-12)
  • (modified) mlir/include/mlir/IR/Block.h (-4)
  • (modified) mlir/include/mlir/IR/BlockSupport.h (-6)
  • (modified) mlir/include/mlir/IR/BuiltinAttributes.h (-4)
  • (modified) mlir/include/mlir/IR/DialectInterface.h (+1-1)
  • (modified) mlir/include/mlir/IR/IntegerSet.h (-4)
  • (modified) mlir/include/mlir/IR/Location.h (-4)
  • (modified) mlir/include/mlir/IR/OpDefinition.h (-4)
  • (modified) mlir/include/mlir/IR/OpImplementation.h (-4)
  • (modified) mlir/include/mlir/IR/OperationSupport.h (-8)
  • (modified) mlir/include/mlir/IR/Remarks.h (+2-14)
  • (modified) mlir/include/mlir/IR/TypeRange.h (-17)
  • (modified) mlir/include/mlir/IR/Types.h (-8)
  • (modified) mlir/include/mlir/IR/Value.h (-16)
  • (modified) mlir/include/mlir/Pass/PassInstrumentation.h (-4)
  • (modified) mlir/include/mlir/Pass/PassManager.h (+2-2)
  • (modified) mlir/include/mlir/Support/InterfaceSupport.h (+1-5)
  • (modified) mlir/include/mlir/Support/TypeID.h (-4)
  • (modified) mlir/include/mlir/TableGen/Constraint.h (-1)
  • (modified) mlir/include/mlir/TableGen/Format.h (-3)
  • (modified) mlir/include/mlir/TableGen/Pattern.h (-8)
  • (modified) mlir/include/mlir/Tools/PDLL/AST/Types.h (-5)
  • (modified) mlir/lib/Conversion/PDLToPDLInterp/PredicateTree.cpp (-1)
  • (modified) mlir/lib/Dialect/Func/Transforms/DuplicateFunctionElimination.cpp (+1-2)
  • (modified) mlir/lib/Dialect/Vector/Transforms/VectorUnroll.cpp (-2)
  • (modified) mlir/lib/Support/StorageUniquer.cpp (+1-4)
  • (modified) mlir/lib/TableGen/Constraint.cpp (+2-11)
  • (modified) mlir/lib/Transforms/Utils/CFGToSCF.cpp (+1-2)
  • (modified) mlir/lib/Transforms/Utils/CSE.cpp (+1-2)
  • (modified) mlir/lib/Transforms/Utils/DialectConversion.cpp (-1)
  • (modified) mlir/tools/mlir-tblgen/EnumsGen.cpp (-4)
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/Pa...
[truncated]

@llvmorg-github-actions
Copy link
Copy Markdown

@llvm/pr-subscribers-mlir-core

Author: Fangrui Song (MaskRay)

Changes

#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 32.36 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/200633.diff

37 Files Affected:

  • (modified) mlir/docs/DefiningDialects/Operations.md (-8)
  • (modified) mlir/include/mlir/Analysis/CallGraph.h (-1)
  • (modified) mlir/include/mlir/Analysis/DataFlowFramework.h (-6)
  • (modified) mlir/include/mlir/Dialect/LLVMIR/LLVMAttrs.h (+1-1)
  • (modified) mlir/include/mlir/IR/AffineExpr.h (-4)
  • (modified) mlir/include/mlir/IR/AffineMap.h (-4)
  • (modified) mlir/include/mlir/IR/Attributes.h (-12)
  • (modified) mlir/include/mlir/IR/Block.h (-4)
  • (modified) mlir/include/mlir/IR/BlockSupport.h (-6)
  • (modified) mlir/include/mlir/IR/BuiltinAttributes.h (-4)
  • (modified) mlir/include/mlir/IR/DialectInterface.h (+1-1)
  • (modified) mlir/include/mlir/IR/IntegerSet.h (-4)
  • (modified) mlir/include/mlir/IR/Location.h (-4)
  • (modified) mlir/include/mlir/IR/OpDefinition.h (-4)
  • (modified) mlir/include/mlir/IR/OpImplementation.h (-4)
  • (modified) mlir/include/mlir/IR/OperationSupport.h (-8)
  • (modified) mlir/include/mlir/IR/Remarks.h (+2-14)
  • (modified) mlir/include/mlir/IR/TypeRange.h (-17)
  • (modified) mlir/include/mlir/IR/Types.h (-8)
  • (modified) mlir/include/mlir/IR/Value.h (-16)
  • (modified) mlir/include/mlir/Pass/PassInstrumentation.h (-4)
  • (modified) mlir/include/mlir/Pass/PassManager.h (+2-2)
  • (modified) mlir/include/mlir/Support/InterfaceSupport.h (+1-5)
  • (modified) mlir/include/mlir/Support/TypeID.h (-4)
  • (modified) mlir/include/mlir/TableGen/Constraint.h (-1)
  • (modified) mlir/include/mlir/TableGen/Format.h (-3)
  • (modified) mlir/include/mlir/TableGen/Pattern.h (-8)
  • (modified) mlir/include/mlir/Tools/PDLL/AST/Types.h (-5)
  • (modified) mlir/lib/Conversion/PDLToPDLInterp/PredicateTree.cpp (-1)
  • (modified) mlir/lib/Dialect/Func/Transforms/DuplicateFunctionElimination.cpp (+1-2)
  • (modified) mlir/lib/Dialect/Vector/Transforms/VectorUnroll.cpp (-2)
  • (modified) mlir/lib/Support/StorageUniquer.cpp (+1-4)
  • (modified) mlir/lib/TableGen/Constraint.cpp (+2-11)
  • (modified) mlir/lib/Transforms/Utils/CFGToSCF.cpp (+1-2)
  • (modified) mlir/lib/Transforms/Utils/CSE.cpp (+1-2)
  • (modified) mlir/lib/Transforms/Utils/DialectConversion.cpp (-1)
  • (modified) mlir/tools/mlir-tblgen/EnumsGen.cpp (-4)
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/Pa...
[truncated]

@llvmorg-github-actions
Copy link
Copy Markdown

@llvm/pr-subscribers-mlir-vector

Author: Fangrui Song (MaskRay)

Changes

#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 32.36 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/200633.diff

37 Files Affected:

  • (modified) mlir/docs/DefiningDialects/Operations.md (-8)
  • (modified) mlir/include/mlir/Analysis/CallGraph.h (-1)
  • (modified) mlir/include/mlir/Analysis/DataFlowFramework.h (-6)
  • (modified) mlir/include/mlir/Dialect/LLVMIR/LLVMAttrs.h (+1-1)
  • (modified) mlir/include/mlir/IR/AffineExpr.h (-4)
  • (modified) mlir/include/mlir/IR/AffineMap.h (-4)
  • (modified) mlir/include/mlir/IR/Attributes.h (-12)
  • (modified) mlir/include/mlir/IR/Block.h (-4)
  • (modified) mlir/include/mlir/IR/BlockSupport.h (-6)
  • (modified) mlir/include/mlir/IR/BuiltinAttributes.h (-4)
  • (modified) mlir/include/mlir/IR/DialectInterface.h (+1-1)
  • (modified) mlir/include/mlir/IR/IntegerSet.h (-4)
  • (modified) mlir/include/mlir/IR/Location.h (-4)
  • (modified) mlir/include/mlir/IR/OpDefinition.h (-4)
  • (modified) mlir/include/mlir/IR/OpImplementation.h (-4)
  • (modified) mlir/include/mlir/IR/OperationSupport.h (-8)
  • (modified) mlir/include/mlir/IR/Remarks.h (+2-14)
  • (modified) mlir/include/mlir/IR/TypeRange.h (-17)
  • (modified) mlir/include/mlir/IR/Types.h (-8)
  • (modified) mlir/include/mlir/IR/Value.h (-16)
  • (modified) mlir/include/mlir/Pass/PassInstrumentation.h (-4)
  • (modified) mlir/include/mlir/Pass/PassManager.h (+2-2)
  • (modified) mlir/include/mlir/Support/InterfaceSupport.h (+1-5)
  • (modified) mlir/include/mlir/Support/TypeID.h (-4)
  • (modified) mlir/include/mlir/TableGen/Constraint.h (-1)
  • (modified) mlir/include/mlir/TableGen/Format.h (-3)
  • (modified) mlir/include/mlir/TableGen/Pattern.h (-8)
  • (modified) mlir/include/mlir/Tools/PDLL/AST/Types.h (-5)
  • (modified) mlir/lib/Conversion/PDLToPDLInterp/PredicateTree.cpp (-1)
  • (modified) mlir/lib/Dialect/Func/Transforms/DuplicateFunctionElimination.cpp (+1-2)
  • (modified) mlir/lib/Dialect/Vector/Transforms/VectorUnroll.cpp (-2)
  • (modified) mlir/lib/Support/StorageUniquer.cpp (+1-4)
  • (modified) mlir/lib/TableGen/Constraint.cpp (+2-11)
  • (modified) mlir/lib/Transforms/Utils/CFGToSCF.cpp (+1-2)
  • (modified) mlir/lib/Transforms/Utils/CSE.cpp (+1-2)
  • (modified) mlir/lib/Transforms/Utils/DialectConversion.cpp (-1)
  • (modified) mlir/tools/mlir-tblgen/EnumsGen.cpp (-4)
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/Pa...
[truncated]

Copy link
Copy Markdown
Contributor

@aengelke aengelke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. But please wait for 1-2 days in case we have to revert the DenseMap change again.

@MaskRay MaskRay merged commit 4b91251 into llvm:main Jun 1, 2026
17 checks passed
@MaskRay MaskRay deleted the pr/drop-tombstone-mlir branch June 1, 2026 22:09
ingomueller-net added a commit to substrait-io/substrait-mlir-contrib that referenced this pull request Jun 4, 2026
This was introduced by llvm/llvm-project#200633. We used this class in
code we copied from upstream. The fix just copies the new version of the
code and adapts the link to it because it moved since the last copy.

Signed-off-by: Ingo Müller <[email protected]>
ingomueller-net added a commit to substrait-io/substrait-mlir-contrib that referenced this pull request Jun 4, 2026
#222)

* build(deps): bump third_party/llvm-project from `a26e8fa` to `0f4b1e1`

Bumps [third_party/llvm-project](https://github.com/llvm/llvm-project) from `a26e8fa` to `0f4b1e1`.
- [Release notes](https://github.com/llvm/llvm-project/releases)
- [Commits](llvm/llvm-project@a26e8fa...0f4b1e1)

---
updated-dependencies:
- dependency-name: third_party/llvm-project
  dependency-version: 0f4b1e11e64fdaaf6258043e1a30014b00bd04d3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* fix: adapt to upstream changes in DenseMapInfo

This was introduced by llvm/llvm-project#200633. We used this class in
code we copied from upstream. The fix just copies the new version of the
code and adapts the link to it because it moved since the last copy.

Signed-off-by: Ingo Müller <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Ingo Müller <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ingo Müller <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants