Skip to content

Commit 8687bd8

Browse files
committed
Adjust TypeID DenseMapInfo
1 parent b4509bd commit 8687bd8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mlir/include/mlir/Support/TypeID.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,12 @@ namespace llvm {
395395
template <>
396396
struct DenseMapInfo<mlir::TypeID> {
397397
static inline mlir::TypeID getEmptyKey() {
398-
void *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
398+
// Shift by 3 to satisfy the TypeID alignment requirement.
399+
void *pointer = reinterpret_cast<void *>(uintptr_t(-1) << 3);
399400
return mlir::TypeID::getFromOpaquePointer(pointer);
400401
}
401402
static inline mlir::TypeID getTombstoneKey() {
402-
void *pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
403+
void *pointer = reinterpret_cast<void *>(uintptr_t(-2) << 3);
403404
return mlir::TypeID::getFromOpaquePointer(pointer);
404405
}
405406
static unsigned getHashValue(mlir::TypeID val) {

0 commit comments

Comments
 (0)