diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp index 79d8e0a4620..fa3c0f60fb4 100644 --- a/lib/VMCore/Value.cpp +++ b/lib/VMCore/Value.cpp @@ -43,6 +43,7 @@ Value::~Value() { void Value::replaceAllUsesWith(Value *D) { assert(D && "Value::replaceAllUsesWith() is invalid!"); + assert(D != this && "V->replaceAllUsesWith(V) is NOT valid!"); while (!Uses.empty()) { User *Use = Uses.front(); #ifndef NDEBUG