Skip to content

Commit b3a7ec1

Browse files
committed
Add OSSA OwnershipUseVisitor support for mark_dependence
[nonescaping]
1 parent d944130 commit b3a7ec1

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

include/swift/SIL/OwnershipUseVisitor.h

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -289,18 +289,16 @@ bool OwnershipUseVisitor<Impl>::visitInnerBorrowScopeEnd(Operand *borrowEnd) {
289289

290290
return handleUsePoint(borrowEnd, UseLifetimeConstraint::NonLifetimeEnding);
291291
}
292-
case OperandOwnership::DestroyingConsume: {
293-
// partial_apply [on_stack] can introduce borrowing operand and can have
294-
// destroy_value consumes.
295-
auto *pai = dyn_cast<PartialApplyInst>(borrowEnd->get());
296-
// TODO: When we have ForwardingInstruction abstraction, walk the use-def
297-
// chain to ensure we have a partial_apply [on_stack] def.
298-
assert(pai && pai->isOnStack() ||
299-
ForwardingInstruction::get(
300-
cast<SingleValueInstruction>(borrowEnd->get())));
292+
case OperandOwnership::DestroyingConsume:
293+
case OperandOwnership::ForwardingConsume: {
294+
// partial_apply [on_stack] and mark_dependence [nonescaping] can introduce
295+
// borrowing operand and can have destroy_value, return, or store consumes.
296+
//
297+
// TODO: When we have a C++ ForwardingUseDefWalker, walk the def-use
298+
// chain to ensure we have a partial_apply [on_stack] or mark_dependence
299+
// [nonescaping] def.
301300
return handleUsePoint(borrowEnd, UseLifetimeConstraint::NonLifetimeEnding);
302301
}
303-
304302
default:
305303
llvm_unreachable("expected borrow scope end");
306304
}

0 commit comments

Comments
 (0)