Skip to content

Commit bdfcc60

Browse files
committed
Add a createBorrowScopeForPhiOperands bailout
Avoid using GuaranteedPhiBorrowFixup on phis that cannot possibly have any guaranteed operands.
1 parent 14e9a01 commit bdfcc60

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/SILOptimizer/Utils/OwnershipOptUtils.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,5 +1632,9 @@ createExtendedNestedBorrowScope(SILPhiArgument *newPhi) {
16321632
// assumes that this API will eventually be called for all such new phis until
16331633
// OSSA is fully valid.
16341634
bool swift::createBorrowScopeForPhiOperands(SILPhiArgument *newPhi) {
1635+
if (newPhi->getOwnershipKind() != OwnershipKind::Guaranteed
1636+
&& newPhi->getOwnershipKind() != OwnershipKind::None) {
1637+
return false;
1638+
}
16351639
return GuaranteedPhiBorrowFixup().createExtendedNestedBorrowScope(newPhi);
16361640
}

0 commit comments

Comments
 (0)