[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp Globals.cpp Value.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Oct 4 11:13:16 PDT 2005
Changes in directory llvm/lib/VMCore:
Constants.cpp updated: 1.135 -> 1.136
Globals.cpp updated: 1.11 -> 1.12
Value.cpp updated: 1.57 -> 1.58
---
Log message:
Change the signature of replaceUsesOfWithOnConstant. The bool was always
true dynamically. Finally, pass the Use* that replaceAllUsesWith has into
the method for future use.
---
Diffs of the changes: (+14 -37)
Constants.cpp | 44 ++++++++++++--------------------------------
Globals.cpp | 5 +----
Value.cpp | 2 +-
3 files changed, 14 insertions(+), 37 deletions(-)
Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.135 llvm/lib/VMCore/Constants.cpp:1.136
--- llvm/lib/VMCore/Constants.cpp:1.135 Tue Oct 4 12:48:46 2005
+++ llvm/lib/VMCore/Constants.cpp Tue Oct 4 13:13:04 2005
@@ -815,14 +815,6 @@
destroyConstantImpl();
}
-void ConstantAggregateZero::replaceUsesOfWithOnConstant(Value *From, Value *To,
- bool DisableChecking) {
- assert(0 && "No uses!");
- abort();
-}
-
-
-
//---- ConstantArray::get() implementation...
//
namespace llvm {
@@ -1395,7 +1387,7 @@
// 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 @@
// 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 @@
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 @@
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 @@
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: llvm/lib/VMCore/Globals.cpp
diff -u llvm/lib/VMCore/Globals.cpp:1.11 llvm/lib/VMCore/Globals.cpp:1.12
--- llvm/lib/VMCore/Globals.cpp:1.11 Thu Apr 21 18:46:51 2005
+++ llvm/lib/VMCore/Globals.cpp Tue Oct 4 13:13:04 2005
@@ -108,7 +108,7 @@
}
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 @@
// Okay, preconditions out of the way, replace the constant initializer.
this->setOperand(0, cast<Constant>(To));
}
-
-// vim: sw=2 ai
-
Index: llvm/lib/VMCore/Value.cpp
diff -u llvm/lib/VMCore/Value.cpp:1.57 llvm/lib/VMCore/Value.cpp:1.58
--- llvm/lib/VMCore/Value.cpp:1.57 Thu Apr 21 18:46:51 2005
+++ llvm/lib/VMCore/Value.cpp Tue Oct 4 13:13:04 2005
@@ -141,7 +141,7 @@
// 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 {
More information about the llvm-commits
mailing list