Skip to content

Commit 6d3b4e0

Browse files
committed
Handle borrow uses and interior pointer uses in swift::findPointerEscape
1 parent 4862ecc commit 6d3b4e0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/SIL/Utils/OwnershipUtils.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ bool swift::findPointerEscape(SILValue original) {
5656
worklist.pushIfNotVisited(phi);
5757
break;
5858
}
59+
case OperandOwnership::Borrow: {
60+
auto borrowOp = BorrowingOperand(use);
61+
if (auto borrowValue = borrowOp.getBorrowIntroducingUserResult()) {
62+
worklist.pushIfNotVisited(borrowValue.value);
63+
}
64+
break;
65+
}
5966
case OperandOwnership::Reborrow: {
6067
SILArgument *phi = PhiOperand(use).getValue();
6168
worklist.pushIfNotVisited(phi);
@@ -72,6 +79,13 @@ bool swift::findPointerEscape(SILValue original) {
7279
});
7380
break;
7481
}
82+
case OperandOwnership::InteriorPointer: {
83+
if (InteriorPointerOperand(use).findTransitiveUses() !=
84+
AddressUseKind::NonEscaping) {
85+
return true;
86+
}
87+
break;
88+
}
7589
default:
7690
break;
7791
}

0 commit comments

Comments
 (0)