Change the signature of replaceUsesOfWithOnConstant. The bool was always
authorChris Lattner <sabre@nondot.org>
Tue, 4 Oct 2005 18:13:04 +0000 (18:13 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 4 Oct 2005 18:13:04 +0000 (18:13 +0000)
true dynamically.  Finally, pass the Use* that replaceAllUsesWith has into
the method for future use.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23626 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Constants.cpp
lib/VMCore/Globals.cpp
lib/VMCore/Value.cpp

index c03d9526e0571adfc84fc99407afc198fafa354f..0f0894bc53e2b6788fa71fc613ca546f98b2dbbc 100644 (file)
@@ -815,14 +815,6 @@ void ConstantAggregateZero::destroyConstant() {
   destroyConstantImpl();
 }
 
-void ConstantAggregateZero::replaceUsesOfWithOnConstant(Value *From, Value *To,
-                                                        bool DisableChecking) {
-  assert(0 && "No uses!");
-  abort();
-}
-
-
-
 //---- ConstantArray::get() implementation...
 //
 namespace llvm {
@@ -1395,7 +1387,7 @@ const char *ConstantExpr::getOpcodeName() const {
 //                replaceUsesOfWithOnConstant implementations
 
 void ConstantArray::replaceUsesOfWithOnConstant(Value *From, Value *To,
-                                                bool DisableChecking) {
+                                                Use *U) {
   assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!");
   Constant *ToC = cast<Constant>(To);
   
@@ -1448,18 +1440,15 @@ void ConstantArray::replaceUsesOfWithOnConstant(Value *From, Value *To,
   // Otherwise, I do need to replace this with an existing value.
   assert(Replacement != this && "I didn't contain From!");
   
-  // Everyone using this now uses the replacement...
-  if (DisableChecking)
-    uncheckedReplaceAllUsesWith(Replacement);
-  else
-    replaceAllUsesWith(Replacement);
+  // Everyone using this now uses the replacement.
+  uncheckedReplaceAllUsesWith(Replacement);
   
   // Delete the old constant!
   destroyConstant();
 }
 
 void ConstantStruct::replaceUsesOfWithOnConstant(Value *From, Value *To,
-                                                 bool DisableChecking) {
+                                                 Use *U) {
   assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!");
   Constant *ToC = cast<Constant>(To);
 
@@ -1511,18 +1500,15 @@ void ConstantStruct::replaceUsesOfWithOnConstant(Value *From, Value *To,
   
   assert(Replacement != this && "I didn't contain From!");
   
-  // Everyone using this now uses the replacement...
-  if (DisableChecking)
-    uncheckedReplaceAllUsesWith(Replacement);
-  else
-    replaceAllUsesWith(Replacement);
+  // Everyone using this now uses the replacement.
+  uncheckedReplaceAllUsesWith(Replacement);
   
   // Delete the old constant!
   destroyConstant();
 }
 
 void ConstantPacked::replaceUsesOfWithOnConstant(Value *From, Value *To,
-                                                 bool DisableChecking) {
+                                                 Use *U) {
   assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!");
   
   std::vector<Constant*> Values;
@@ -1536,18 +1522,15 @@ void ConstantPacked::replaceUsesOfWithOnConstant(Value *From, Value *To,
   Constant *Replacement = ConstantPacked::get(getType(), Values);
   assert(Replacement != this && "I didn't contain From!");
   
-  // Everyone using this now uses the replacement...
-  if (DisableChecking)
-    uncheckedReplaceAllUsesWith(Replacement);
-  else
-    replaceAllUsesWith(Replacement);
+  // Everyone using this now uses the replacement.
+  uncheckedReplaceAllUsesWith(Replacement);
   
   // Delete the old constant!
   destroyConstant();
 }
 
 void ConstantExpr::replaceUsesOfWithOnConstant(Value *From, Value *ToV,
-                                               bool DisableChecking) {
+                                               Use *U) {
   assert(isa<Constant>(ToV) && "Cannot make Constant refer to non-constant!");
   Constant *To = cast<Constant>(ToV);
   
@@ -1588,11 +1571,8 @@ void ConstantExpr::replaceUsesOfWithOnConstant(Value *From, Value *ToV,
   
   assert(Replacement != this && "I didn't contain From!");
   
-  // Everyone using this now uses the replacement...
-  if (DisableChecking)
-    uncheckedReplaceAllUsesWith(Replacement);
-  else
-    replaceAllUsesWith(Replacement);
+  // Everyone using this now uses the replacement.
+  uncheckedReplaceAllUsesWith(Replacement);
   
   // Delete the old constant!
   destroyConstant();
index 87eca2a99541926fd2694fcb92a799957dca6ec7..be6c6eb05378999350c0d785cc362fbeb63f201a 100644 (file)
@@ -108,7 +108,7 @@ void GlobalVariable::eraseFromParent() {
 }
 
 void GlobalVariable::replaceUsesOfWithOnConstant(Value *From, Value *To,
-                                                 bool DisableChecking) {
+                                                 Use *U) {
   // If you call this, then you better know this GVar has a constant
   // initializer worth replacing. Enforce that here.
   assert(getNumOperands() == 1 &&
@@ -126,6 +126,3 @@ void GlobalVariable::replaceUsesOfWithOnConstant(Value *From, Value *To,
   // Okay, preconditions out of the way, replace the constant initializer.
   this->setOperand(0, cast<Constant>(To));
 }
-
-// vim: sw=2 ai
-
index f59e8ef957e5a5e97a5f6e6de83544f81bd442a9..1f0c4442de8eab38fb5e2f7f78fc131ef3ee892e 100644 (file)
@@ -141,7 +141,7 @@ void Value::uncheckedReplaceAllUsesWith(Value *New) {
     // constant!
     if (Constant *C = dyn_cast<Constant>(U.getUser())) {
       if (!isa<GlobalValue>(C))
-        C->replaceUsesOfWithOnConstant(this, New, true);
+        C->replaceUsesOfWithOnConstant(this, New, &U);
       else
         U.set(New);
     } else {