@@ -234,26 +234,28 @@ class ClassWithStoredProperty {
234
234
init()
235
235
}
236
236
// CHECK-LABEL: sil hidden [ossa] @classStoredProperty
237
- sil hidden [ossa] @classStoredProperty : $@convention(thin) (ClassWithStoredProperty) -> () {
238
- bb0(%0 : @unowned $ClassWithStoredProperty):
239
- %1 = ref_element_addr %0 : $ClassWithStoredProperty, #ClassWithStoredProperty.f
237
+ sil hidden [ossa] @classStoredProperty : $@convention(thin) (@owned ClassWithStoredProperty) -> () {
238
+ bb0(%0 : @owned $ClassWithStoredProperty):
239
+ %0a = begin_borrow %0 : $ClassWithStoredProperty
240
+ %1 = ref_element_addr %0a : $ClassWithStoredProperty, #ClassWithStoredProperty.f
240
241
241
242
// expected-error@+1{{overlapping accesses to 'f', but modification requires exclusive access; consider copying to a local variable}}
242
243
%2 = begin_access [modify] [dynamic] %1 : $*Int
243
- %3 = ref_element_addr %0 : $ClassWithStoredProperty, #ClassWithStoredProperty.f
244
+ %3 = ref_element_addr %0a : $ClassWithStoredProperty, #ClassWithStoredProperty.f
244
245
245
246
// expected-note@+1{{conflicting access is here}}
246
247
%4 = begin_access [modify] [dynamic] %3 : $*Int
247
248
end_access %4 : $*Int
248
249
end_access %2 : $*Int
250
+ end_borrow %0a : $ClassWithStoredProperty
249
251
destroy_value %0 : $ClassWithStoredProperty
250
252
%5 = tuple ()
251
253
return %5 : $()
252
254
}
253
255
254
256
// CHECK-LABEL: sil hidden [ossa] @lookThroughBeginBorrow
255
- sil hidden [ossa] @lookThroughBeginBorrow : $@convention(thin) (ClassWithStoredProperty) -> () {
256
- bb0(%0 : @unowned $ClassWithStoredProperty):
257
+ sil hidden [ossa] @lookThroughBeginBorrow : $@convention(thin) (@owned ClassWithStoredProperty) -> () {
258
+ bb0(%0 : @owned $ClassWithStoredProperty):
257
259
%1 = begin_borrow %0 : $ClassWithStoredProperty
258
260
%2 = begin_borrow %0 : $ClassWithStoredProperty
259
261
%3 = ref_element_addr %1 : $ClassWithStoredProperty, #ClassWithStoredProperty.f
@@ -605,6 +607,7 @@ bb0(%0 : $Int):
605
607
%7 = begin_access [modify] [unknown] %3 : $*Int // expected-error {{overlapping accesses, but modification requires exclusive access; consider copying to a local variable}}
606
608
%8 = apply %4(%7, %conv) : $@convention(thin) (@inout Int, @noescape @owned @callee_owned (Int) -> ()) -> ()
607
609
end_access %7: $*Int
610
+ destroy_value %6 : $@callee_owned (Int) -> ()
608
611
destroy_value %2 : ${ var Int }
609
612
%9 = tuple ()
610
613
return %9 : $()
@@ -625,6 +628,7 @@ bb0(%0 : $Int):
625
628
%8 = apply %4(%7, %bconv) : $@convention(thin) (@inout Int, @noescape @guaranteed @callee_guaranteed (Int) -> ()) -> ()
626
629
end_access %7: $*Int
627
630
end_borrow %bconv : $@callee_guaranteed @noescape (Int) -> ()
631
+ destroy_value %6 : $@callee_guaranteed (Int) -> ()
628
632
destroy_value %2 : ${ var Int }
629
633
%9 = tuple ()
630
634
return %9 : $()
@@ -651,6 +655,7 @@ bb0(%0 : $Int):
651
655
%7 = begin_access [read] [unknown] %3 : $*Int // expected-note {{conflicting access is here}}
652
656
%8 = apply %4(%3, %conv) : $@convention(thin) (@inout Int, @noescape @owned @callee_owned () -> ()) -> ()
653
657
end_access %7: $*Int
658
+ destroy_value %6 : $@callee_owned () -> ()
654
659
destroy_value %2 : ${ var Int }
655
660
%9 = tuple ()
656
661
return %9 : $()
@@ -681,6 +686,8 @@ bb0(%0 : $Int):
681
686
%11 = begin_access [modify] [unknown] %3 : $*Int // expected-error {{overlapping accesses, but modification requires exclusive access; consider copying to a local variable}}
682
687
%12 = apply %4<Int>(%11, %10) : $@convention(thin) <T_0> (@inout Int, @noescape @callee_owned (Int) -> @out T_0) -> ()
683
688
end_access %11: $*Int
689
+ destroy_value %9 : $@callee_owned (Int) -> @out Int
690
+ destroy_value %6 : $@callee_owned (Int) -> Int
684
691
destroy_value %2 : ${ var Int }
685
692
%13 = tuple ()
686
693
return %13 : $()
@@ -722,6 +729,8 @@ bb0(%0 : $Int):
722
729
end_access %13 : $*Int
723
730
destroy_addr %8 : $*@callee_guaranteed() -> ()
724
731
dealloc_stack %7 : $*@block_storage @callee_guaranteed () -> ()
732
+ destroy_value %sentinel2 : $@callee_guaranteed () -> ()
733
+ destroy_value %6 : $@callee_guaranteed () -> ()
725
734
destroy_value %2 : ${ var Int }
726
735
%ret = tuple ()
727
736
return %ret : $()
@@ -753,6 +762,8 @@ bb0(%0 : $Int):
753
762
end_access %14 : $*Int
754
763
destroy_addr %8 : $*@callee_guaranteed () -> ()
755
764
dealloc_stack %7 : $*@block_storage @callee_guaranteed () -> ()
765
+ destroy_value %sentinel2 : $@callee_guaranteed () -> ()
766
+ destroy_value %6 : $@callee_guaranteed () -> ()
756
767
destroy_value %2 : ${ var Int }
757
768
%ret = tuple ()
758
769
return %ret : $()
@@ -909,6 +920,7 @@ bb0(%0 : $Int):
909
920
%4 = enum $Optional<@convention(block) @noescape () -> ()>, #Optional.none!enumelt
910
921
%5 = function_ref @takesInoutAndNoEscapeOptionalBlockClosure : $@convention(thin) (@inout Int, @owned Optional<@convention(block) @noescape () -> ()>) -> ()
911
922
%6 = apply %5(%3, %4) : $@convention(thin) (@inout Int, @owned Optional<@convention(block) @noescape () -> ()>) -> ()
923
+ destroy_value %2 : ${ var Int }
912
924
%7 = tuple ()
913
925
return %7 : $()
914
926
}
@@ -933,6 +945,7 @@ bb0(%0 : $Int):
933
945
%access = begin_access [modify] [unknown] %boxadr : $*Int // expected-error {{overlapping accesses, but modification requires exclusive access; consider copying to a local variable}}
934
946
%call = apply %nepa(%access) : $@noescape @callee_guaranteed (@inout Int) -> ()
935
947
end_access %access : $*Int
948
+ destroy_value %pa : $@callee_guaranteed (@inout Int) -> ()
936
949
destroy_value %box : ${ var Int }
937
950
%v = tuple ()
938
951
return %v : $()
@@ -959,6 +972,7 @@ bb0(%0 : $Int):
959
972
%access = begin_access [modify] [unknown] %boxadr : $*Int // expected-error {{overlapping accesses, but modification requires exclusive access; consider copying to a local variable}}
960
973
%call = apply %nepa(%access) : $@noescape @callee_guaranteed (@inout Int) -> ()
961
974
end_access %access : $*Int
975
+ destroy_value %pa2 : $@callee_guaranteed (@inout Int) -> ()
962
976
destroy_value %box : ${ var Int }
963
977
%v = tuple ()
964
978
return %v : $()
@@ -986,6 +1000,7 @@ bb0(%0 : $Int):
986
1000
%8 = begin_access [modify] [unknown] %3 : $*Int // expected-error {{overlapping accesses, but modification requires exclusive access; consider copying to a local variable}}
987
1001
%9 = apply %4(%8, %conv) : $@convention(thin) (@inout Int, @noescape @owned @callee_owned () -> ()) -> ()
988
1002
end_access %8: $*Int
1003
+ destroy_value %7 : $@callee_owned () -> ()
989
1004
destroy_value %2 : ${ var Int }
990
1005
%v = tuple ()
991
1006
return %v : $()
@@ -1086,6 +1101,7 @@ bb0(%0 : $UnsafePointer<Int32>, %1 : $*Int32):
1086
1101
%closure = convert_escape_to_noescape [not_guaranteed] %pa2 : $@callee_guaranteed (UnsafePointer<Int32>) -> () to $@noescape @callee_guaranteed (UnsafePointer<Int32>) -> ()
1087
1102
%f2 = function_ref @takeMutatingNoescapeClosure : $@convention(thin) <τ_0_0> (UnsafePointer<τ_0_0>, @noescape @callee_guaranteed (UnsafePointer<Int32>) -> ()) -> ()
1088
1103
%call = apply %f2<Int32>(%0, %closure) : $@convention(thin) <τ_0_0> (UnsafePointer<τ_0_0>, @noescape @callee_guaranteed (UnsafePointer<Int32>) -> ()) -> ()
1104
+ destroy_value %pa2 : $@callee_guaranteed (UnsafePointer<Int32>) -> ()
1089
1105
%v = tuple ()
1090
1106
return %v : $()
1091
1107
}
@@ -1102,6 +1118,7 @@ bb0(%0 : $UnsafePointer<Int32>, %1 : $*Int32):
1102
1118
%f2 = function_ref @takeInoutAndMutatingNoescapeClosure : $@convention(thin) <τ_0_0> (@inout Int32, UnsafePointer<τ_0_0>, @noescape @callee_guaranteed (UnsafePointer<Int32>) -> ()) -> ()
1103
1119
%access = begin_access [modify] [unknown] %1 : $*Int32 // expected-error {{overlapping accesses, but modification requires exclusive access; consider copying to a local variable}}
1104
1120
%call = apply %f2<Int32>(%access, %0, %closure) : $@convention(thin) <τ_0_0> (@inout Int32, UnsafePointer<τ_0_0>, @noescape @callee_guaranteed (UnsafePointer<Int32>) -> ()) -> ()
1121
+ destroy_value %pa2 : $@callee_guaranteed (UnsafePointer<Int32>) -> ()
1105
1122
end_access %access : $*Int32
1106
1123
%v = tuple ()
1107
1124
return %v : $()
@@ -1159,6 +1176,7 @@ bb1:
1159
1176
%copyblock1 = copy_block %initblock1 : $@convention(block) @noescape () -> ()
1160
1177
destroy_addr %pbs1 : $*@callee_guaranteed() -> ()
1161
1178
dealloc_stack %bs1 : $*@block_storage @callee_guaranteed () -> ()
1179
+ destroy_value %sentinel2 : $@callee_guaranteed () -> ()
1162
1180
br bb3(%copyblock1 : $@convention(block) @noescape () -> ())
1163
1181
1164
1182
bb2:
@@ -1169,13 +1187,15 @@ bb2:
1169
1187
%copyblock2 = copy_block %initblock2 : $@convention(block) @noescape () -> ()
1170
1188
destroy_addr %pbs2 : $*@callee_guaranteed() -> ()
1171
1189
dealloc_stack %bs2 : $*@block_storage @callee_guaranteed () -> ()
1190
+ destroy_value %sentinel2 : $@callee_guaranteed () -> ()
1172
1191
br bb3(%copyblock2 : $@convention(block) @noescape () -> ())
1173
1192
1174
1193
bb3(%block : @owned $@convention(block) @noescape () -> ()):
1175
1194
%access = begin_access [modify] [unknown] %boxadr : $*Int // expected-error {{overlapping accesses, but modification requires exclusive access; consider copying to a local variable}}
1176
1195
%f = function_ref @takesInoutAndNoEscapeBlockClosure : $@convention(thin) (@inout Int, @owned @convention(block) @noescape () -> ()) -> ()
1177
1196
%call = apply %f(%access, %block) : $@convention(thin) (@inout Int, @owned @convention(block) @noescape () -> ()) -> ()
1178
1197
end_access %access : $*Int
1198
+ destroy_value %pa : $@callee_guaranteed () -> ()
1179
1199
destroy_value %box : ${ var Int }
1180
1200
%ret = tuple ()
1181
1201
return %ret : $()
@@ -1308,13 +1328,15 @@ bb0(%0 : $*Int):
1308
1328
%3 = partial_apply [callee_guaranteed] %2(%0) : $@convention(thin) (@inout_aliasable Int) -> ()
1309
1329
1310
1330
%4 = function_ref @thunkForWithoutActuallyEscapingVerify : $@convention(thin) (@guaranteed @callee_guaranteed () -> ()) -> ()
1311
- %5 = partial_apply [callee_guaranteed] %4(%3) : $@convention(thin) (@guaranteed @callee_guaranteed () -> ()) -> ()
1331
+ %3a = copy_value %3 : $@callee_guaranteed () -> ()
1332
+ %5 = partial_apply [callee_guaranteed] %4(%3a) : $@convention(thin) (@guaranteed @callee_guaranteed () -> ()) -> ()
1312
1333
%6 = mark_dependence %5 : $@callee_guaranteed () -> () on %3 : $@callee_guaranteed () -> ()
1313
1334
1314
1335
%8 = function_ref @closureForWithoutActuallyEscapingVerify : $@convention(thin) (@guaranteed @callee_guaranteed () -> ()) -> ()
1315
1336
%9 = apply %8(%6) : $@convention(thin) (@guaranteed @callee_guaranteed () -> ()) -> ()
1316
1337
%10 = is_escaping_closure %6 : $@callee_guaranteed () -> ()
1317
1338
cond_fail %10 : $Builtin.Int1
1339
+ destroy_value %3 : $@callee_guaranteed () -> ()
1318
1340
destroy_value %6 : $@callee_guaranteed () -> ()
1319
1341
%14 = tuple ()
1320
1342
return %14 : $()
@@ -1354,7 +1376,8 @@ bb0(%0 : $Int):
1354
1376
store %closure to [init] %blockproj : $*@callee_guaranteed () -> ()
1355
1377
// function_ref thunk for @escaping @callee_guaranteed () -> ()
1356
1378
%thunkF = function_ref @$sIeg_IeyB_TR : $@convention(c) (@inout_aliasable @block_storage @callee_guaranteed () -> ()) -> ()
1357
- %initblock = init_block_storage_header %block : $*@block_storage @callee_guaranteed () -> (), invoke %thunkF : $@convention(c) (@inout_aliasable @block_storage @callee_guaranteed () -> ()) -> (), type $@convention(block) () -> ()
1379
+ %initblock_unowned = init_block_storage_header %block : $*@block_storage @callee_guaranteed () -> (), invoke %thunkF : $@convention(c) (@inout_aliasable @block_storage @callee_guaranteed () -> ()) -> (), type $@convention(block) () -> ()
1380
+ %initblock = copy_block %initblock_unowned : $@convention(block) () -> ()
1358
1381
destroy_addr %blockproj : $*@callee_guaranteed () -> ()
1359
1382
dealloc_stack %block : $*@block_storage @callee_guaranteed () -> ()
1360
1383
%borrow = begin_borrow %initblock : $@convention(block) () -> ()
0 commit comments