@@ -24,6 +24,7 @@ sil [ossa] @takeOwnedC : $@convention(thin) (@owned C) -> ()
24
24
sil [ossa] @takeOwnedCTwice : $@convention(thin) (@owned C, @owned C) -> ()
25
25
sil [ossa] @takeGuaranteedC : $@convention(thin) (@guaranteed C) -> ()
26
26
sil [ossa] @accessRawP : $@convention(method) (Builtin.RawPointer) -> ()
27
+ sil [ossa] @synchronization_point : $@convention(thin) () -> ()
27
28
28
29
struct NativeObjectPair {
29
30
var obj1 : Builtin.NativeObject
@@ -329,7 +330,8 @@ bb0(%0 : @owned $C):
329
330
%copy3 = copy_value %borrow : $C
330
331
%copy4 = copy_value %borrow : $C
331
332
// Force the borrow not to be eliminated early.
332
- %call0 = apply %fguaranteed(%borrow) : $@convention(thin) (@guaranteed C) -> ()
333
+ %synchronization_point = function_ref @synchronization_point : $@convention(thin) () -> ()
334
+ %synchronized = apply %synchronization_point() : $@convention(thin) () -> ()
333
335
end_borrow %borrow : $C
334
336
cond_br undef, bb1, bb2
335
337
bb1:
421
423
//
422
424
// CHECK-LABEL: sil [ossa] @testInterleavedBorrowCrossBlock : $@convention(thin) () -> @owned C {
423
425
// CHECK: [[ALLOC:%.*]] = alloc_ref $C
424
- // CHECK: apply %{{.*}}([[ALLOC]]) : $@convention(thin) (@guaranteed C) -> ()
426
+ // CHECK: [[B1:%.*]] = begin_borrow [[ALLOC]]
427
+ // CHECK: apply %{{.*}}([[B1]]) : $@convention(thin) (@guaranteed C) -> ()
428
+ // CHECK-NEXT: end_borrow [[B1]] : $C
425
429
// CHECK-NEXT: cond_br undef, bb1, bb2
426
430
// CHECK: bb1:
427
431
// CHECK: apply %{{.*}}([[ALLOC]]) : $@convention(thin) (@guaranteed C) -> ()
507
511
// CHECK-LABEL: sil [ossa] @testEscapingForward : $@convention(method) (@guaranteed HasObject) -> () {
508
512
// CHECK: begin_borrow %0 : $HasObject
509
513
// CHECK: copy_value
510
- // CHECK: end_borrow
511
514
// CHECK: destructure_struct
515
+ // CHECK: end_borrow
512
516
// CHECK: ref_to_unmanaged
513
517
// CHECK: destroy_value
514
518
// CHECK-LABEL: } // end sil function 'testEscapingForward'
@@ -748,15 +752,18 @@ bb3(%borrow3 : @guaranteed $C, %copy3 : @owned $C):
748
752
749
753
// Test conversion from struct_extract to destructure.
750
754
//
755
+ // TODO: The redundant borrow scope should be removed by a SemanticARC pass.
756
+ //
751
757
// CHECK-LABEL: sil [ossa] @testDestructureConversion : $@convention(thin) (@owned Wrapper) -> () {
752
758
// CHECK: bb0(%0 : @owned $Wrapper):
753
759
// CHECK-NOT: copy
754
- // CHECK: [[SPLIT:%.*]] = destructure_struct %0 : $Wrapper
760
+ // CHECK: [[BORROW:%.*]] = begin_borrow %0 : $Wrapper
761
+ // CHECK: [[SPLIT:%.*]] = destructure_struct [[BORROW]] : $Wrapper
755
762
// CHECK: [[BORROWINNER:%.*]] = begin_borrow [[SPLIT]] : $HasObjectAndInt
756
763
// CHECK: debug_value [[BORROWINNER]] : $HasObjectAndInt, let, name "self", argno 1
757
764
// CHECK: struct_extract [[BORROWINNER]] : $HasObjectAndInt, #HasObjectAndInt.value
758
765
// CHECK: end_borrow [[BORROWINNER]] : $HasObjectAndInt
759
- // CHECK: destroy_value [[SPLIT]] : $HasObjectAndInt
766
+ // CHECK: destroy_value %0 : $Wrapper
760
767
// CHECK-LABEL: } // end sil function 'testDestructureConversion'
761
768
sil [ossa] @testDestructureConversion : $@convention(thin) (@owned Wrapper) -> () {
762
769
bb0(%0 : @owned $Wrapper):
@@ -950,13 +957,17 @@ bb0(%0 : @owned $HasObjectAndInt):
950
957
951
958
// Test removing copies within an outer borrow scope with no outer uses.
952
959
//
960
+ // TODO: The redundant borrow scope should be removed by a SemanticARC pass.
961
+ //
953
962
// CHECK-LABEL: sil [ossa] @testBorrowCopy : $@convention(thin) (@guaranteed C) -> Int64 {
954
963
// CHECK: bb0(%0 : @guaranteed $C):
955
964
// CHECK-NEXT: %1 = begin_borrow %0 : $C
956
- // CHECK-NEXT: %2 = ref_element_addr %1 : $C, #C.a
957
- // CHECK-NEXT: %3 = load [trivial] %2 : $*Int64
965
+ // CHECK-NEXT: %2 = begin_borrow %1 : $C
966
+ // CHECK-NEXT: %3 = ref_element_addr %2 : $C, #C.a
967
+ // CHECK-NEXT: %4 = load [trivial] %3 : $*Int64
968
+ // CHECK-NEXT: end_borrow %2 : $C
958
969
// CHECK-NEXT: end_borrow %1 : $C
959
- // CHECK-NEXT: return %3 : $Int64
970
+ // CHECK-NEXT: return %4 : $Int64
960
971
// CHECK-LABEL: } // end sil function 'testBorrowCopy'
961
972
sil [ossa] @testBorrowCopy : $@convention(thin) (@guaranteed C) -> Int64 {
962
973
bb0(%0 : @guaranteed $C):
0 commit comments