Skip to content

Commit 860aa58

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

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/SIL/Utils/OwnershipUtils.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ bool swift::findPointerEscape(SILValue original) {
5656
worklist.pushIfNotVisited(phi);
5757
break;
5858
}
59+
case OperandOwnership::Borrow: {
60+
auto *borrow = cast<SingleValueInstruction>(use->getUser());
61+
worklist.pushIfNotVisited(borrow);
62+
break;
63+
}
5964
case OperandOwnership::Reborrow: {
6065
SILArgument *phi = PhiOperand(use).getValue();
6166
worklist.pushIfNotVisited(phi);
@@ -72,6 +77,13 @@ bool swift::findPointerEscape(SILValue original) {
7277
});
7378
break;
7479
}
80+
case OperandOwnership::InteriorPointer: {
81+
if (InteriorPointerOperand(use).findTransitiveUses() !=
82+
AddressUseKind::NonEscaping) {
83+
return true;
84+
}
85+
break;
86+
}
7587
default:
7688
break;
7789
}

0 commit comments

Comments
 (0)