Add a check to avoid allowing V->replaceAllUsesWith(V)
authorChris Lattner <sabre@nondot.org>
Fri, 29 Jun 2001 05:25:51 +0000 (05:25 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 29 Jun 2001 05:25:51 +0000 (05:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Value.cpp

index 79d8e0a46205f292cf839e122648b1fb04137120..fa3c0f60fb4fe773fd44e085113b9805b33c1882 100644 (file)
@@ -43,6 +43,7 @@ Value::~Value() {
 
 void Value::replaceAllUsesWith(Value *D) {
   assert(D && "Value::replaceAllUsesWith(<null>) is invalid!");
+  assert(D != this && "V->replaceAllUsesWith(V) is NOT valid!");
   while (!Uses.empty()) {
     User *Use = Uses.front();
 #ifndef NDEBUG