mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-20 05:38:50 +00:00
Don't let DeadArgElimination change the return type ({} into void and {T}
into T) when no return values are actually dead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52537 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9cb6ec26b3
commit
03d18569cb
@ -598,15 +598,21 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
|
|||||||
++NumRetValsEliminated;
|
++NumRetValsEliminated;
|
||||||
Changed = true;
|
Changed = true;
|
||||||
}
|
}
|
||||||
if (RetTypes.size() == 0)
|
if (RetTypes.size() > 1 || (STy && STy->getNumElements() == RetTypes.size()))
|
||||||
// No return types? Make it void
|
// More than one return type? Return a struct with them. Also, if we used
|
||||||
NRetTy = Type::VoidTy;
|
// to return a struct and didn't change the number of return values,
|
||||||
|
// return a struct again. This prevents chaning {something} into something
|
||||||
|
// and {} into void.
|
||||||
|
// Make the new struct packed if we used to return a packed struct
|
||||||
|
// already.
|
||||||
|
NRetTy = StructType::get(RetTypes, STy->isPacked());
|
||||||
else if (RetTypes.size() == 1)
|
else if (RetTypes.size() == 1)
|
||||||
// One return type? Just a simple value then
|
// One return type? Just a simple value then, but only if we didn't use to
|
||||||
|
// return a struct with that simple value before.
|
||||||
NRetTy = RetTypes.front();
|
NRetTy = RetTypes.front();
|
||||||
else
|
else if (RetTypes.size() == 0)
|
||||||
// More return types? Return a struct with them
|
// No return types? Make it void, but only if we didn't use to return {}
|
||||||
NRetTy = StructType::get(RetTypes);
|
NRetTy = Type::VoidTy;
|
||||||
} else {
|
} else {
|
||||||
NRetTy = Type::VoidTy;
|
NRetTy = Type::VoidTy;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user