summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Value.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-07-15 06:18:52 +0000
committerChris Lattner <sabre@nondot.org>2011-07-15 06:18:52 +0000
commitaf1783f9877b341ab8f2de87170054898b21d370 (patch)
tree7c27499415b34b619fd917f90e9066bb9b4812d3 /llvm/lib/VMCore/Value.cpp
parentbe6610caba8076c864f0e6584442472115d72b2b (diff)
downloadbcm5719-llvm-af1783f9877b341ab8f2de87170054898b21d370.tar.gz
bcm5719-llvm-af1783f9877b341ab8f2de87170054898b21d370.zip
remove the old and dangerous uncheckedReplaceAllUsesWith method,
which was just replaceAllUsesWith without some assertions. It was needed back when type refinement was alive. llvm-svn: 135253
Diffstat (limited to 'llvm/lib/VMCore/Value.cpp')
-rw-r--r--llvm/lib/VMCore/Value.cpp28
1 files changed, 9 insertions, 19 deletions
diff --git a/llvm/lib/VMCore/Value.cpp b/llvm/lib/VMCore/Value.cpp
index c7a42126142..f1815e377ed 100644
--- a/llvm/lib/VMCore/Value.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud