Index: include/llvm/IR/ValueHandle.h =================================================================== --- include/llvm/IR/ValueHandle.h +++ include/llvm/IR/ValueHandle.h @@ -189,6 +189,7 @@ : public ValueHandleBase #endif { + friend struct DenseMapInfo >; #ifndef NDEBUG ValueTy *getValPtr() const { @@ -248,11 +249,19 @@ static unsigned getHashValue(const AssertingVH &Val) { return PointerInfo::getHashValue(Val); } +#ifndef NDEBUG + static bool isEqual(const AssertingVH &LHS, const AssertingVH &RHS) { + // Avoid downcasting AssertingVH to T*, as empty/tombstone keys may not + // be properly aligned pointers to T*. + return LHS.ValueHandleBase::getValPtr() == RHS.ValueHandleBase::getValPtr(); + } +#else static bool isEqual(const AssertingVH &LHS, const AssertingVH &RHS) { return LHS == RHS; } +#endif }; - + template struct isPodLike > { #ifdef NDEBUG