From 2dd58aefa50324f288ec6899b6025423bb7d6726 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 29 Jun 2001 05:25:51 +0000 Subject: [PATCH] Add a check to avoid allowing V->replaceAllUsesWith(V) llvm-svn: 104 --- llvm/lib/VMCore/Value.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/llvm/lib/VMCore/Value.cpp b/llvm/lib/VMCore/Value.cpp index 79d8e0a46205..fa3c0f60fb4f 100644 --- a/llvm/lib/VMCore/Value.cpp +++ b/llvm/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