mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-27 13:30:05 +00:00
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
This commit is contained in:
parent
40cdedecf5
commit
d0ff1adbdb
@ -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();
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user