Add an assertion to catch a misuse of replaceAllUsesWith
authorChris Lattner <sabre@nondot.org>
Thu, 21 Mar 2002 05:38:15 +0000 (05:38 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 21 Mar 2002 05:38:15 +0000 (05:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1924 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Value.cpp

index c4327a1814dc16870bf32f71b3468def16b4a4c5..6c01f65e4e455ac663db57ed0eeefe226f2d2342 100644 (file)
@@ -50,6 +50,8 @@ Value::~Value() {
 void Value::replaceAllUsesWith(Value *D) {
   assert(D && "Value::replaceAllUsesWith(<null>) is invalid!");
   assert(D != this && "V->replaceAllUsesWith(V) is NOT valid!");
+  assert(D->getType() == getType() &&
+         "replaceAllUses of value with new value of different type!");
   while (!Uses.empty()) {
     User *Use = Uses.back();
 #ifndef NDEBUG