diff --git a/mlir/include/mlir/IR/Value.h b/mlir/include/mlir/IR/Value.h --- a/mlir/include/mlir/IR/Value.h +++ b/mlir/include/mlir/IR/Value.h @@ -529,6 +529,18 @@ return reinterpret_cast(pointer); } }; +template +struct DenseMapInfo> + : public DenseMapInfo { + static mlir::detail::TypedValue getEmptyKey() { + void *pointer = llvm::DenseMapInfo::getEmptyKey(); + return mlir::Value::getFromOpaquePointer(pointer); + } + static mlir::detail::TypedValue getTombstoneKey() { + void *pointer = llvm::DenseMapInfo::getTombstoneKey(); + return mlir::Value::getFromOpaquePointer(pointer); + } +}; /// Allow stealing the low bits of a value. template <> @@ -561,6 +573,14 @@ return reinterpret_cast(pointer); } }; +template +struct PointerLikeTypeTraits> + : public PointerLikeTypeTraits { +public: + static inline mlir::detail::TypedValue getFromVoidPointer(void *pointer) { + return mlir::Value::getFromOpaquePointer(pointer); + } +}; /// Add support for llvm style casts. We provide a cast between To and From if /// From is mlir::Value or derives from it.