mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-21 03:32:21 +00:00
Don't let DeadArgumentElimination attempt to update callers when the return
type wasn't changed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52538 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
03d18569cb
commit
df0891d2ff
@ -743,11 +743,18 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
|
|||||||
Args.clear();
|
Args.clear();
|
||||||
|
|
||||||
if (!Call->use_empty()) {
|
if (!Call->use_empty()) {
|
||||||
if (New->getType() == Type::VoidTy)
|
if (New->getType() == Call->getType()) {
|
||||||
// Our return value was unused, replace by null for now, uses will get
|
// Return type not changed? Just replace users then
|
||||||
// removed later on
|
Call->replaceAllUsesWith(New);
|
||||||
|
New->takeName(Call);
|
||||||
|
} else if (New->getType() == Type::VoidTy) {
|
||||||
|
// Our return value has uses, but they will get removed later on.
|
||||||
|
// Replace by null for now.
|
||||||
Call->replaceAllUsesWith(Constant::getNullValue(Call->getType()));
|
Call->replaceAllUsesWith(Constant::getNullValue(Call->getType()));
|
||||||
else if (isa<StructType>(RetTy)) {
|
} else {
|
||||||
|
assert(isa<StructType>(RetTy) && "Return type changed, but not into a"
|
||||||
|
"void. The old return type must have"
|
||||||
|
"been a struct!");
|
||||||
// The original return value was a struct, update all uses (which are
|
// The original return value was a struct, update all uses (which are
|
||||||
// all extractvalue instructions).
|
// all extractvalue instructions).
|
||||||
for (Value::use_iterator I = Call->use_begin(), E = Call->use_end();
|
for (Value::use_iterator I = Call->use_begin(), E = Call->use_end();
|
||||||
@ -781,10 +788,6 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
New->takeName(Call);
|
New->takeName(Call);
|
||||||
} else {
|
|
||||||
// The original function had a single return value
|
|
||||||
Call->replaceAllUsesWith(New);
|
|
||||||
New->takeName(Call);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user