diff options
author | Chris Lattner <sabre@nondot.org> | 2011-07-15 06:18:52 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-07-15 06:18:52 +0000 |
commit | 678f9e05c949bc565b736b0bb4337bffb0f3c687 (patch) | |
tree | 8a6bb974c2e98cf0169d95e44f12b47051682aff /lib/VMCore/Value.cpp | |
parent | 032c6eb1c4d36a9e906f5efc0ada76c952225a4f (diff) |
remove the old and dangerous uncheckedReplaceAllUsesWith method,
which was just replaceAllUsesWith without some assertions. It was
needed back when type refinement was alive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135253 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Value.cpp')
-rw-r--r-- | lib/VMCore/Value.cpp | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp index c7a4212614..f1815e377e 100644 --- a/lib/VMCore/Value.cpp +++ b/lib/VMCore/Value.cpp @@ -280,17 +280,16 @@ void Value::takeName(Value *V) { } -// uncheckedReplaceAllUsesWith - This is exactly the same as replaceAllUsesWith, -// except that it doesn't have all of the asserts. The asserts fail because we -// are half-way done resolving types, which causes some types to exist as two -// different Type*'s at the same time. This is a sledgehammer to work around -// this problem. -// -void Value::uncheckedReplaceAllUsesWith(Value *New) { +void Value::replaceAllUsesWith(Value *New) { + assert(New && "Value::replaceAllUsesWith(<null>) is invalid!"); + assert(New != this && "this->replaceAllUsesWith(this) is NOT valid!"); + assert(New->getType() == getType() && + "replaceAllUses of value with new value of different type!"); + // Notify all ValueHandles (if present) that this value is going away. if (HasValueHandle) ValueHandleBase::ValueIsRAUWd(this, New); - + while (!use_empty()) { Use &U = *UseList; // Must handle Constants specially, we cannot call replaceUsesOfWith on a @@ -301,23 +300,14 @@ void Value::uncheckedReplaceAllUsesWith(Value *New) { continue; } } - + U.set(New); } - + if (BasicBlock *BB = dyn_cast<BasicBlock>(this)) BB->replaceSuccessorsPhiUsesWith(cast<BasicBlock>(New)); } -void Value::replaceAllUsesWith(Value *New) { - assert(New && "Value::replaceAllUsesWith(<null>) is invalid!"); - assert(New != this && "this->replaceAllUsesWith(this) is NOT valid!"); - assert(New->getType() == getType() && - "replaceAllUses of value with new value of different type!"); - - uncheckedReplaceAllUsesWith(New); -} - Value *Value::stripPointerCasts() { if (!getType()->isPointerTy()) return this; |