@@ -257,71 +257,6 @@ func testInOutVarClosureCaptureVar(_ f: inout () -> ()) {
257257 f ( )
258258}
259259
260- // CHECK-LABEL: sil hidden [ossa] @$s16moveonly_closure38testConsumingNoEscapeClosureCaptureVaryyyyXEnF : $@convention(thin) (@owned @noescape @callee_guaranteed () -> ()) -> () {
261- // CHECK: bb0([[ARG:%.*]] : @_eagerMove @owned
262- // CHECK: [[FUNC_BOX:%.*]] = alloc_box ${ var @noescape @callee_guaranteed () -> () }
263- // CHECK: [[FUNC_PROJECT:%.*]] = project_box [[FUNC_BOX]]
264- // CHECK: store [[ARG]] to [init] [[FUNC_PROJECT]]
265- //
266- // CHECK: [[BOX:%.*]] = alloc_box ${ var SingleElt }
267- // CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
268- // CHECK: [[CLOSURE:%.*]] = function_ref @$s16moveonly_closure38testConsumingNoEscapeClosureCaptureVaryyyyXEnFyyXEfU_ : $@convention(thin) (@inout_aliasable SingleElt) -> ()
269- // CHECK: [[PAI:%.*]] = partial_apply [callee_guaranteed] [[CLOSURE]]([[PROJECT]])
270- // CHECK: [[NO_ESCAPE:%.*]] = convert_escape_to_noescape [not_guaranteed] [[PAI]]
271- // CHECK: [[ACCESS:%.*]] = begin_access [modify] [unknown] [[FUNC_PROJECT]]
272- // CHECK: assign [[NO_ESCAPE]] to [[ACCESS]]
273- // CHECK: end_access [[ACCESS]]
274- // CHECK: } // end sil function '$s16moveonly_closure38testConsumingNoEscapeClosureCaptureVaryyyyXEnF'
275- //
276- // CHECK-LABEL: sil private [ossa] @$s16moveonly_closure38testConsumingNoEscapeClosureCaptureVaryyyyXEnFyyXEfU_ : $@convention(thin) (@inout_aliasable SingleElt) -> () {
277- // CHECK: bb0([[ARG:%.*]] :
278- // CHECK: [[CHECK:%.*]] = mark_must_check [consumable_and_assignable] [[ARG]]
279- //
280- // CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] [[CHECK]]
281- // CHECK: [[LOADED:%.*]] = load [copy] [[ACCESS]]
282- // CHECK: apply {{%.*}}([[LOADED]])
283- // CHECK: destroy_value [[LOADED]]
284- // CHECK: end_access [[ACCESS]]
285- //
286- // CHECK: [[ACCESS:%.*]] = begin_access [deinit] [unknown] [[CHECK]]
287- // CHECK: [[LOADED:%.*]] = load [take] [[ACCESS]]
288- // CHECK: apply {{%.*}}([[LOADED]])
289- // CHECK: end_access [[ACCESS]]
290- //
291- // CHECK: [[ACCESS:%.*]] = begin_access [deinit] [unknown] [[CHECK]]
292- // CHECK: [[LOADED:%.*]] = load [take] [[ACCESS]]
293- // CHECK: apply {{%.*}}([[LOADED]])
294- // CHECK: end_access [[ACCESS]]
295- //
296- // CHECK: [[READ_ACCESS:%.*]] = begin_access [read] [unknown] [[CHECK]]
297- // CHECK: [[LOADED_READ:%.*]] = load [copy] [[READ_ACCESS]]
298- // CHECK: [[DEINIT_ACCESS:%.*]] = begin_access [deinit] [unknown] [[CHECK]]
299- // CHECK: [[LOADED_TAKE:%.*]] = load [take] [[DEINIT_ACCESS]]
300- // CHECK: apply {{%.*}}([[LOADED_READ]], [[LOADED_TAKE]])
301- // CHECK: end_access [[DEINIT_ACCESS]]
302- // CHECK: destroy_value [[LOADED_READ]]
303- // CHECK: end_access [[READ_ACCESS]]
304- // CHECK: } // end sil function '$s16moveonly_closure38testConsumingNoEscapeClosureCaptureVaryyyyXEnFyyXEfU_'
305- func testConsumingNoEscapeClosureCaptureVar( _ f: consuming ( ) -> ( ) ) {
306- var x = SingleElt ( )
307- // expected-error @-1 {{'x' used after consume}}
308- // expected-error @-2 {{'x' used after consume}}
309- // expected-error @-3 {{'x' consumed more than once}}
310- x = SingleElt ( )
311- f = {
312- borrowVal ( x)
313- consumeVal ( x) // expected-note {{consuming use here}}
314- consumeVal ( x) // expected-note {{consuming use here}}
315- // expected-note @-1 {{consuming use here}}
316- borrowConsumeVal ( x, x)
317- // expected-note @-1 {{consuming use here}}
318- // expected-note @-2 {{consuming use here}}
319- // expected-note @-3 {{non-consuming use here}}
320- // expected-error @-4 {{overlapping accesses to 'x', but deinitialization requires exclusive access}}
321- // expected-note @-5 {{conflicting access is here}}
322- }
323- f ( )
324- }
325260
326261// CHECK-LABEL: sil hidden [ossa] @$s16moveonly_closure36testConsumingEscapeClosureCaptureVaryyyycnF : $@convention(thin) (@owned @callee_guaranteed () -> ()) -> () {
327262// CHECK: bb0([[ARG:%.*]] : @_eagerMove @owned
@@ -579,39 +514,6 @@ func testInOutVarClosureCaptureLet(_ f: inout () -> ()) {
579514 f ( )
580515}
581516
582- // CHECK-LABEL: sil hidden [ossa] @$s16moveonly_closure38testConsumingNoEscapeClosureCaptureLetyyyyXEnF : $@convention(thin) (@owned @noescape @callee_guaranteed () -> ()) -> () {
583- // CHECK: bb0([[ARG:%.*]] :
584- // CHECK: [[FUNC_BOX:%.*]] = alloc_box ${ var @noescape @callee_guaranteed () -> () }
585- // CHECK: [[FUNC_PROJECT:%.*]] = project_box [[FUNC_BOX]]
586- // CHECK: store [[ARG]] to [init] [[FUNC_PROJECT]]
587- //
588- // CHECK: [[BOX:%.*]] = alloc_box ${ let SingleElt }
589- // CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
590- // CHECK: [[CLOSURE:%.*]] = function_ref @$s16moveonly_closure38testConsumingNoEscapeClosureCaptureLetyyyyXEnFyyXEfU_ : $@convention(thin) (@guaranteed SingleElt) -> ()
591- // CHECK: [[MARKED:%.*]] = mark_must_check [assignable_but_not_consumable] [[PROJECT]]
592- // CHECK: [[LOADED_VALUE:%.*]] = load [copy] [[MARKED]]
593- // CHECK: [[PAI:%.*]] = partial_apply [callee_guaranteed] [[CLOSURE]]([[LOADED_VALUE]])
594- // CHECK: [[NO_ESCAPE:%.*]] = convert_escape_to_noescape [not_guaranteed] [[PAI]]
595- // CHECK: [[ACCESS:%.*]] = begin_access [modify] [unknown] [[FUNC_PROJECT]]
596- // CHECK: assign [[NO_ESCAPE]] to [[ACCESS]]
597- // CHECK: end_access [[ACCESS]]
598- // CHECK: } // end sil function '$s16moveonly_closure38testConsumingNoEscapeClosureCaptureLetyyyyXEnF'
599- //
600- // CHECK-LABEL: sil private [ossa] @$s16moveonly_closure38testConsumingNoEscapeClosureCaptureLetyyyyXEnFyyXEfU_ : $@convention(thin) (@guaranteed SingleElt) -> () {
601- // CHECK: bb0([[ARG:%.*]] :
602- // CHECK: [[ARG_COPY:%.*]] = copy_value [[ARG]]
603- // CHECK: [[CHECK:%.*]] = mark_must_check [no_consume_or_assign] [[ARG_COPY]]
604- // CHECK: } // end sil function '$s16moveonly_closure38testConsumingNoEscapeClosureCaptureLetyyyyXEnFyyXEfU_'
605- func testConsumingNoEscapeClosureCaptureLet( _ f: consuming ( ) -> ( ) ) {
606- let x = SingleElt ( ) // expected-error {{'x' consumed and used at the same time}}
607- f = {
608- borrowVal ( x)
609- consumeVal ( x)
610- consumeVal ( x)
611- borrowConsumeVal ( x, x) // expected-note {{consuming and non-consuming uses here}}
612- }
613- f ( )
614- }
615517
616518// CHECK-LABEL: sil hidden [ossa] @$s16moveonly_closure36testConsumingEscapeClosureCaptureLetyyyycnF : $@convention(thin) (@owned @callee_guaranteed () -> ()) -> () {
617519// CHECK: bb0([[ARG:%.*]] : @_eagerMove @owned
@@ -869,63 +771,6 @@ func testInOutVarClosureCaptureInOut(_ f: inout () -> (), _ x: inout SingleElt)
869771 f ( )
870772}
871773
872- // CHECK-LABEL: sil hidden [ossa] @$s16moveonly_closure40testConsumingNoEscapeClosureCaptureInOutyyyyXEn_AA9SingleEltVztF : $@convention(thin) (@owned @noescape @callee_guaranteed () -> (), @inout SingleElt) -> () {
873- // CHECK: bb0([[OWNED_F:%.*]] : @_eagerMove @owned $@noescape @callee_guaranteed () -> (), [[PROJECT:%.*]] : $*SingleElt):
874- // CHECK: [[FUNC_BOX:%.*]] = alloc_box ${ var @noescape @callee_guaranteed () -> () }
875- // CHECK: [[FUNC_PROJECT:%.*]] = project_box [[FUNC_BOX]]
876- // CHECK: store [[OWNED_F]] to [init] [[FUNC_PROJECT]]
877- //
878- // CHECK: [[MARKED_PROJECT:%.*]] = mark_must_check [consumable_and_assignable] [[PROJECT]]
879- // CHECK: [[CLOSURE:%.*]] = function_ref @$s16moveonly_closure40testConsumingNoEscapeClosureCaptureInOutyyyyXEn_AA9SingleEltVztFyyXEfU_ : $@convention(thin) (@inout_aliasable SingleElt) -> ()
880- // CHECK: [[PAI:%.*]] = partial_apply [callee_guaranteed] [[CLOSURE]]([[MARKED_PROJECT]])
881- // CHECK: [[NO_ESCAPE:%.*]] = convert_escape_to_noescape [not_guaranteed] [[PAI]]
882- // CHECK: [[ACCESS:%.*]] = begin_access [modify] [unknown] [[FUNC_PROJECT]]
883- // CHECK: assign [[NO_ESCAPE]] to [[ACCESS]]
884- // CHECK: end_access [[ACCESS]]
885- // CHECK: } // end sil function '$s16moveonly_closure40testConsumingNoEscapeClosureCaptureInOutyyyyXEn_AA9SingleEltVztF'
886- //
887- // CHECK-LABEL: sil private [ossa] @$s16moveonly_closure40testConsumingNoEscapeClosureCaptureInOutyyyyXEn_AA9SingleEltVztFyyXEfU_ : $@convention(thin) (@inout_aliasable SingleElt) -> () {
888- // CHECK: bb0([[PROJECT:%.*]] : @closureCapture
889- // CHECK: [[MARKED:%.*]] = mark_must_check [consumable_and_assignable] [[PROJECT]]
890- //
891- // CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] [[MARKED]]
892- // CHECK: [[LOADED:%.*]] = load [copy] [[ACCESS]]
893- // CHECK: apply {{%.*}}([[LOADED]])
894- // CHECK: destroy_value [[LOADED]]
895- //
896- // CHECK: [[ACCESS:%.*]] = begin_access [deinit] [unknown] [[MARKED]]
897- // CHECK: [[LOADED:%.*]] = load [take] [[ACCESS]]
898- // CHECK: apply {{%.*}}([[LOADED]])
899- //
900- // CHECK: [[ACCESS:%.*]] = begin_access [deinit] [unknown] [[MARKED]]
901- // CHECK: [[LOADED:%.*]] = load [take] [[ACCESS]]
902- // CHECK: apply {{%.*}}([[LOADED]])
903- //
904- // CHECK: [[READ_ACCESS:%.*]] = begin_access [read] [unknown] [[MARKED]]
905- // CHECK: [[LOADED_READ:%.*]] = load [copy] [[READ_ACCESS]]
906- // CHECK: [[TAKE_ACCESS:%.*]] = begin_access [deinit] [unknown] [[MARKED]]
907- // CHECK: [[LOADED_TAKE:%.*]] = load [take] [[TAKE_ACCESS]]
908- // CHECK: apply {{%.*}}([[LOADED_READ]], [[LOADED_TAKE]])
909- // CHECK: } // end sil function '$s16moveonly_closure40testConsumingNoEscapeClosureCaptureInOutyyyyXEn_AA9SingleEltVztFyyXEfU_'
910- func testConsumingNoEscapeClosureCaptureInOut( _ f: consuming ( ) -> ( ) , _ x: inout SingleElt ) {
911- // expected-error @-1 {{'x' consumed but not reinitialized before end of function}}
912- // expected-error @-2 {{'x' used after consume}}
913- // expected-error @-3 {{'x' consumed more than once}}
914- // expected-error @-4 {{'x' used after consume}}
915- f = { // expected-note {{consuming use here}}
916- borrowVal ( x)
917- consumeVal ( x) // expected-note {{consuming use here}}
918- consumeVal ( x) // expected-note {{consuming use here}}
919- // expected-note @-1 {{consuming use here}}
920- borrowConsumeVal ( x, x)
921- // expected-error @-1 {{overlapping accesses to 'x', but deinitialization requires exclusive access}}
922- // expected-note @-2 {{conflicting access is here}}
923- // expected-note @-3 {{non-consuming use here}}
924- // expected-note @-4 {{non-consuming use here}}
925- // expected-note @-5 {{consuming use here}}
926- }
927- f ( )
928- }
929774
930775// CHECK-LABEL: sil hidden [ossa] @$s16moveonly_closure38testConsumingEscapeClosureCaptureInOutyyyycn_AA9SingleEltVztF : $@convention(thin) (@owned @callee_guaranteed () -> (), @inout SingleElt) -> () {
931776// CHECK: bb0([[FUNC_ARG:%.*]] : @_eagerMove @owned $@callee_guaranteed () -> (), [[PROJECT:%.*]] : $*SingleElt):
@@ -1159,70 +1004,6 @@ func testLocalVarClosureCaptureConsuming(_ x: consuming SingleElt) {
11591004 f ( )
11601005}
11611006
1162- // CHECK-LABEL: sil hidden [ossa] @$s16moveonly_closure035testConsumingNoEscapeClosureCaptureD0yyyyXEn_AA9SingleEltVntF : $@convention(thin) (@owned @noescape @callee_guaranteed () -> (), @owned SingleElt) -> () {
1163- // CHECK: bb0([[F:%.*]] : @_eagerMove @owned $@noescape @callee_guaranteed () -> (),
1164- // CHECK: [[FUNC_BOX:%.*]] = alloc_box ${ var @noescape @callee_guaranteed () -> () }
1165- // CHECK: [[FUNC_PROJECT:%.*]] = project_box [[FUNC_BOX]]
1166- // CHECK: store [[F]] to [init] [[FUNC_PROJECT]]
1167- //
1168- // CHECK: [[BOX:%.*]] = alloc_box ${ var SingleElt }
1169- // CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
1170- // CHECK: [[CLOSURE:%.*]] = function_ref @$s16moveonly_closure035testConsumingNoEscapeClosureCaptureD0yyyyXEn_AA9SingleEltVntFyyXEfU_ : $@convention(thin) (@inout_aliasable SingleElt) -> ()
1171- // CHECK: [[PAI:%.*]] = partial_apply [callee_guaranteed] [[CLOSURE]]([[PROJECT]])
1172- // CHECK: [[NO_ESCAPE:%.*]] = convert_escape_to_noescape [not_guaranteed] [[PAI]]
1173- // CHECK: [[ACCESS:%.*]] = begin_access [modify] [unknown] [[FUNC_PROJECT]]
1174- // CHECK: assign [[NO_ESCAPE]] to [[ACCESS]]
1175- // CHECK: end_access [[ACCESS]]
1176- // CHECK: } // end sil function '$s16moveonly_closure035testConsumingNoEscapeClosureCaptureD0yyyyXEn_AA9SingleEltVntF'
1177- //
1178- // CHECK-LABEL: sil private [ossa] @$s16moveonly_closure035testConsumingNoEscapeClosureCaptureD0yyyyXEn_AA9SingleEltVntFyyXEfU_ : $@convention(thin) (@inout_aliasable SingleElt) -> () {
1179- // CHECK: bb0([[ARG:%.*]] :
1180- // CHECK: [[CHECK:%.*]] = mark_must_check [consumable_and_assignable] [[ARG]]
1181- //
1182- // CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] [[CHECK]]
1183- // CHECK: [[LOADED:%.*]] = load [copy] [[ACCESS]]
1184- // CHECK: apply {{%.*}}([[LOADED]])
1185- // CHECK: destroy_value [[LOADED]]
1186- // CHECK: end_access [[ACCESS]]
1187- //
1188- // CHECK: [[ACCESS:%.*]] = begin_access [deinit] [unknown] [[CHECK]]
1189- // CHECK: [[LOADED:%.*]] = load [take] [[ACCESS]]
1190- // CHECK: apply {{%.*}}([[LOADED]])
1191- // CHECK: end_access [[ACCESS]]
1192- //
1193- // CHECK: [[ACCESS:%.*]] = begin_access [deinit] [unknown] [[CHECK]]
1194- // CHECK: [[LOADED:%.*]] = load [take] [[ACCESS]]
1195- // CHECK: apply {{%.*}}([[LOADED]])
1196- // CHECK: end_access [[ACCESS]]
1197- //
1198- // CHECK: [[READ_ACCESS:%.*]] = begin_access [read] [unknown] [[CHECK]]
1199- // CHECK: [[LOADED_READ:%.*]] = load [copy] [[READ_ACCESS]]
1200- // CHECK: [[DEINIT_ACCESS:%.*]] = begin_access [deinit] [unknown] [[CHECK]]
1201- // CHECK: [[LOADED_TAKE:%.*]] = load [take] [[DEINIT_ACCESS]]
1202- // CHECK: apply {{%.*}}([[LOADED_READ]], [[LOADED_TAKE]])
1203- // CHECK: end_access [[DEINIT_ACCESS]]
1204- // CHECK: destroy_value [[LOADED_READ]]
1205- // CHECK: end_access [[READ_ACCESS]]
1206- // CHECK: } // end sil function '$s16moveonly_closure035testConsumingNoEscapeClosureCaptureD0yyyyXEn_AA9SingleEltVntFyyXEfU_'
1207- func testConsumingNoEscapeClosureCaptureConsuming( _ f: consuming ( ) -> ( ) ,
1208- _ x: consuming SingleElt ) {
1209- // expected-error @-1 {{'x' consumed more than once}}
1210- // expected-error @-2 {{'x' used after consume}}
1211- // expected-error @-3 {{'x' used after consume}}
1212- f = {
1213- borrowVal ( x)
1214- consumeVal ( x) // expected-note {{consuming use here}}
1215- consumeVal ( x) // expected-note {{consuming use here}}
1216- // expected-note @-1 {{consuming use here}}
1217- borrowConsumeVal ( x, x)
1218- // expected-note @-1 {{consuming use here}}
1219- // expected-note @-2 {{consuming use here}}
1220- // expected-note @-3 {{non-consuming use here}}
1221- // expected-error @-4 {{overlapping accesses to 'x', but deinitialization requires exclusive access}}
1222- // expected-note @-5 {{conflicting access is here}}
1223- }
1224- f ( )
1225- }
12261007
12271008// CHECK-LABEL: sil hidden [ossa] @$s16moveonly_closure033testConsumingEscapeClosureCaptureD0yyyycn_AA9SingleEltVntF : $@convention(thin) (@owned @callee_guaranteed () -> (), @owned SingleElt) -> () {
12281009// CHECK: bb0([[ARG:%.*]] : @_eagerMove @owned $@callee_guaranteed () -> (),
@@ -1474,40 +1255,6 @@ func testInOutVarClosureCaptureOwned(_ f: inout () -> (), _ x: __owned SingleElt
14741255 f ( )
14751256}
14761257
1477- // CHECK-LABEL: sil hidden [ossa] @$s16moveonly_closure40testConsumingNoEscapeClosureCaptureOwnedyyyyXEn_AA9SingleEltVntF : $@convention(thin) (@owned @noescape @callee_guaranteed () -> (), @owned SingleElt) -> () {
1478- // CHECK: bb0([[ARG:%.*]] : @_eagerMove @owned $@noescape @callee_guaranteed () -> (),
1479- // CHECK: [[FUNC_BOX:%.*]] = alloc_box ${ var @noescape @callee_guaranteed () -> () }
1480- // CHECK: [[FUNC_PROJECT:%.*]] = project_box [[FUNC_BOX]]
1481- // CHECK: store [[ARG]] to [init] [[FUNC_PROJECT]]
1482- //
1483- // CHECK: [[BOX:%.*]] = alloc_box ${ let SingleElt }
1484- // CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
1485- // CHECK: [[CLOSURE:%.*]] = function_ref @$s16moveonly_closure40testConsumingNoEscapeClosureCaptureOwnedyyyyXEn_AA9SingleEltVntFyyXEfU_ : $@convention(thin) (@guaranteed SingleElt) -> ()
1486- // CHECK: [[MARKED:%.*]] = mark_must_check [assignable_but_not_consumable] [[PROJECT]]
1487- // CHECK: [[LOADED_VALUE:%.*]] = load [copy] [[MARKED]]
1488- // CHECK: [[PAI:%.*]] = partial_apply [callee_guaranteed] [[CLOSURE]]([[LOADED_VALUE]])
1489- // CHECK: [[NO_ESCAPE:%.*]] = convert_escape_to_noescape [not_guaranteed] [[PAI]]
1490- // CHECK: [[ACCESS:%.*]] = begin_access [modify] [unknown] [[FUNC_PROJECT]]
1491- // CHECK: assign [[NO_ESCAPE]] to [[ACCESS]]
1492- // CHECK: end_access [[ACCESS]]
1493- // CHECK: } // end sil function '$s16moveonly_closure40testConsumingNoEscapeClosureCaptureOwnedyyyyXEn_AA9SingleEltVntF'
1494- //
1495- // CHECK-LABEL: sil private [ossa] @$s16moveonly_closure40testConsumingNoEscapeClosureCaptureOwnedyyyyXEn_AA9SingleEltVntFyyXEfU_ : $@convention(thin) (@guaranteed SingleElt) -> () {
1496- // CHECK: bb0([[ARG:%.*]] :
1497- // CHECK: [[ARG_COPY:%.*]] = copy_value [[ARG]]
1498- // CHECK: [[CHECK:%.*]] = mark_must_check [no_consume_or_assign] [[ARG_COPY]]
1499- // CHECK: } // end sil function '$s16moveonly_closure40testConsumingNoEscapeClosureCaptureOwnedyyyyXEn_AA9SingleEltVntFyyXEfU_'
1500- func testConsumingNoEscapeClosureCaptureOwned( _ f: consuming ( ) -> ( ) ,
1501- _ x: __owned SingleElt) {
1502- // expected-error @-1 {{'x' consumed and used at the same time}}
1503- f = {
1504- borrowVal ( x)
1505- consumeVal ( x)
1506- consumeVal ( x)
1507- borrowConsumeVal ( x, x) // expected-note {{consuming and non-consuming uses here}}
1508- }
1509- f ( )
1510- }
15111258
15121259// CHECK-LABEL: sil hidden [ossa] @$s16moveonly_closure38testConsumingEscapeClosureCaptureOwnedyyyycn_AA9SingleEltVntF : $@convention(thin) (@owned @callee_guaranteed () -> (), @owned SingleElt) -> () {
15131260// CHECK: bb0([[ARG:%.*]] : @_eagerMove @owned $@callee_guaranteed () -> (),
0 commit comments