Skip to content

Commit 921c7f6

Browse files
committed
[SIL] Only lexical owned args are lexical.
Previously, every owned argument was considered lexical. That included owned arguments with eager move lifetimes. Here, only owned arguments whose lifetimes are lexical (i.e. not those whose lifetimes are eager move) are considered lexical.
1 parent 3c78a0b commit 921c7f6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/SIL/IR/SILValue.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,11 @@ ValueBase::getDefiningInstructionResult() {
106106
}
107107

108108
bool ValueBase::isLexical() const {
109-
if (auto *argument = dyn_cast<SILFunctionArgument>(this))
110-
return argument->getOwnershipKind() == OwnershipKind::Owned;
109+
if (auto *argument = dyn_cast<SILFunctionArgument>(this)) {
110+
// TODO: Recognize guaranteed arguments as lexical too.
111+
return argument->getOwnershipKind() == OwnershipKind::Owned &&
112+
argument->getLifetime().isLexical();
113+
}
111114
if (auto *bbi = dyn_cast<BeginBorrowInst>(this))
112115
return bbi->isLexical();
113116
if (auto *mvi = dyn_cast<MoveValueInst>(this))

0 commit comments

Comments
 (0)