[move-only] Fix a thinko where we are treating inout convention as a consuming use instead of liveness use.

rdar://109217216
This commit is contained in:
Michael Gottesman
2023-05-09 14:38:53 -07:00
parent f1d274042b
commit a4fcdd893e
5 changed files with 20 additions and 41 deletions

View File

@@ -433,7 +433,7 @@ static bool memInstMustConsume(Operand *memOper) {
return false;
ApplySite applySite(pai);
auto convention = applySite.getArgumentConvention(*memOper);
return convention.isInoutConvention();
return !convention.isInoutConvention();
}
case SILInstructionKind::DestroyAddrInst:
return true;
@@ -1802,8 +1802,9 @@ bool GatherUsesVisitor::visitUse(Operand *op) {
}
if (auto *pas = dyn_cast<PartialApplyInst>(user)) {
if (pas->isOnStack()) {
LLVM_DEBUG(llvm::dbgs() << "Found on stack partial apply!\n");
if (pas->isOnStack() ||
ApplySite(pas).getArgumentConvention(*op).isInoutConvention()) {
LLVM_DEBUG(llvm::dbgs() << "Found on stack partial apply or inout usage!\n");
// On-stack partial applications and their final consumes are always a
// liveness use of their captures.
auto leafRange = TypeTreeLeafTypeRange::get(op->get(), getRootAddress());