diff options
author | Chris Lattner <sabre@nondot.org> | 2005-10-04 18:13:04 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-10-04 18:13:04 +0000 |
commit | d0ff1adbdb4b7b565b7f8f191aac0731e80aa1ef (patch) | |
tree | 4c834c0295bf27b9e6753ed56596da89173e6e35 /lib | |
parent | 40cdedecf5d871a83363cb7d69a6f6eed525651c (diff) | |
download | external_llvm-d0ff1adbdb4b7b565b7f8f191aac0731e80aa1ef.zip external_llvm-d0ff1adbdb4b7b565b7f8f191aac0731e80aa1ef.tar.gz external_llvm-d0ff1adbdb4b7b565b7f8f191aac0731e80aa1ef.tar.bz2 |
Change the signature of replaceUsesOfWithOnConstant. The bool was always
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VMCore/Constants.cpp | 44 | ||||
-rw-r--r-- | lib/VMCore/Globals.cpp | 5 | ||||
-rw-r--r-- | lib/VMCore/Value.cpp | 2 |
3 files changed, 14 insertions, 37 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index c03d952..0f0894b 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -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(); diff --git a/lib/VMCore/Globals.cpp b/lib/VMCore/Globals.cpp index 87eca2a..be6c6eb 100644 --- a/lib/VMCore/Globals.cpp +++ b/lib/VMCore/Globals.cpp @@ -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 - diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp index f59e8ef..1f0c444 100644 --- a/lib/VMCore/Value.cpp +++ b/lib/VMCore/Value.cpp @@ -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 { |