File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -240,8 +240,8 @@ bool PartialApplyCombiner::combine() {
240
240
auto *user = use->getUser ();
241
241
242
242
// Recurse through copy_value
243
- if (auto *cvi = dyn_cast<CopyValueInst >(user)) {
244
- for (auto *copyUse : cvi ->getUses ())
243
+ if (isa<CopyValueInst>(user) || isa<BeginBorrowInst >(user)) {
244
+ for (auto *copyUse : cast<SingleValueInstruction>(user) ->getUses ())
245
245
worklist.push_back (copyUse);
246
246
continue ;
247
247
}
Original file line number Diff line number Diff line change @@ -1152,3 +1152,22 @@ bb3:
1152
1152
%rv = tuple()
1153
1153
return %rv : $()
1154
1154
}
1155
+
1156
+ // CHECK-LABEL: sil [ossa] @test_copy_and_borrow_of_closure
1157
+ // CHECK-NOT: partial_apply
1158
+ // CHECK-LABEL: } // end sil function 'test_copy_and_borrow_of_closure'
1159
+ sil [ossa] @test_copy_and_borrow_of_closure : $@convention(thin) (Int) -> () {
1160
+ bb0(%0 : $Int):
1161
+ %3 = function_ref @closure2 : $@convention(thin) (Int) -> ()
1162
+ %5 = partial_apply %3(%0) : $@convention(thin) (Int) -> ()
1163
+ %6 = begin_borrow [lexical] %5 : $@callee_owned () -> ()
1164
+ %7 = copy_value %6 : $@callee_owned () -> ()
1165
+ apply %7() : $@callee_owned () -> ()
1166
+ end_borrow %6 : $@callee_owned () -> ()
1167
+ destroy_value %5 : $@callee_owned () -> ()
1168
+ %r = tuple ()
1169
+ return %r : $()
1170
+ }
1171
+
1172
+ sil [ossa] @closure2 : $@convention(thin) (Int) -> ()
1173
+
You can’t perform that action at this time.
0 commit comments