Skip to content

Commit 5e23e98

Browse files
committed
[CapturePromotion] See through borrows.
1 parent ceea4cf commit 5e23e98

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/SILOptimizer/Mandatory/CapturePromotion.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,7 @@ class NonEscapingUserVisitor
10401040
ALWAYS_NON_ESCAPING_INST(Load)
10411041
ALWAYS_NON_ESCAPING_INST(StrongRelease)
10421042
ALWAYS_NON_ESCAPING_INST(DestroyValue)
1043+
ALWAYS_NON_ESCAPING_INST(EndBorrow)
10431044
#undef ALWAYS_NON_ESCAPING_INST
10441045

10451046
bool visitDeallocBoxInst(DeallocBoxInst *dbi) {
@@ -1213,7 +1214,8 @@ static bool findEscapeOrMutationUses(Operand *op,
12131214
// we want to be more conservative around non-top level copies (i.e. a copy
12141215
// derived from a projection like instruction). In fact such a thing may not
12151216
// even make any sense!
1216-
if (isa<CopyValueInst>(user) || isa<MarkUninitializedInst>(user)) {
1217+
if (isa<CopyValueInst>(user) || isa<MarkUninitializedInst>(user) ||
1218+
isa<BeginBorrowInst>(user)) {
12171219
bool foundSomeMutations = false;
12181220
for (auto *use : cast<SingleValueInstruction>(user)->getUses()) {
12191221
foundSomeMutations |= findEscapeOrMutationUses(use, state);

0 commit comments

Comments
 (0)