DIBuilder: Delete dead code, NFC
[oota-llvm.git] / include / llvm / IR / ValueHandle.h
index aa29b2ed6906ead0a28b63365061cd1e90553e03..1371da5a6c6de2e2c5baa756f9ef01940578c913 100644 (file)
@@ -189,6 +189,7 @@ class AssertingVH
   : public ValueHandleBase
 #endif
   {
+  friend struct DenseMapInfo<AssertingVH<ValueTy> >;
 
 #ifndef NDEBUG
   ValueTy *getValPtr() const {
@@ -248,11 +249,19 @@ struct DenseMapInfo<AssertingVH<T> > {
   static unsigned getHashValue(const AssertingVH<T> &Val) {
     return PointerInfo::getHashValue(Val);
   }
+#ifndef NDEBUG
+  static bool isEqual(const AssertingVH<T> &LHS, const AssertingVH<T> &RHS) {
+    // Avoid downcasting AssertingVH<T> 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<T> &LHS, const AssertingVH<T> &RHS) {
     return LHS == RHS;
   }
+#endif
 };
-  
+
 template <typename T>
 struct isPodLike<AssertingVH<T> > {
 #ifdef NDEBUG