@@ -39,6 +39,9 @@ sil [ossa] @callee_optional_d_guaranteed: $@convention(thin) (@guaranteed Option
39
39
sil [ossa] @synchronization_point : $@convention(thin) () -> ()
40
40
sil [ossa] @modify_s : $@yield_once @convention(thin) () -> @yields @inout S
41
41
sil [ossa] @barrier : $@convention(thin) () -> ()
42
+ sil @use_C : $@convention(thin) (@guaranteed C) -> ()
43
+ sil @use_CDCase : $@convention(thin) (@guaranteed CDCase) -> ()
44
+
42
45
// This function is not a synchronization point.
43
46
sil [ossa] @empty : $@convention(thin) () -> () {
44
47
%retval = tuple ()
@@ -558,6 +561,65 @@ exit:
558
561
return %retval : $()
559
562
}
560
563
564
+ // CHECK-LABEL: sil [ossa] @hoist_guaranteedforwardingphi1 :
565
+ // bb1:
566
+ // end_borrow
567
+ // destroy_value
568
+ // br bb2
569
+ // CHECK-LABEL: } // end sil function 'hoist_guaranteedforwardingphi1'
570
+ sil [ossa] @hoist_guaranteedforwardingphi1 : $@convention(thin) (@owned CDCase) -> () {
571
+ bb0(%instance_c : @owned $CDCase):
572
+ %lifetime_c_0 = begin_borrow %instance_c : $CDCase
573
+ %ex = struct_extract %lifetime_c_0 : $CDCase, #CDCase.c
574
+ br bb1(%ex : $C)
575
+
576
+ bb1(%phi1 : @guaranteed $C):
577
+ %f1 = function_ref @use_C : $@convention(thin) (@guaranteed C) -> ()
578
+ apply %f1(%phi1) : $@convention(thin) (@guaranteed C) -> ()
579
+ br bb2
580
+
581
+ bb2:
582
+ end_borrow %lifetime_c_0 : $CDCase
583
+ destroy_value %instance_c : $CDCase
584
+ %retval = tuple ()
585
+ return %retval : $()
586
+ }
587
+
588
+ // CHECK-LABEL: sil [ossa] @nohoist_guaranteedforwardingphi2 :
589
+ // CHECK: bb3({{.*}}):
590
+ // CHECK: end_borrow
591
+ // CHECK: destroy_value
592
+ // CHECK-LABEL: } // end sil function 'nohoist_guaranteedforwardingphi2'
593
+ sil [ossa] @nohoist_guaranteedforwardingphi2 : $@convention(thin) (@owned CDCase, @owned CDCase) -> () {
594
+ bb0(%instance_c1 : @owned $CDCase, %instance_c2 : @owned $CDCase):
595
+ cond_br undef, bb1, bb2
596
+
597
+ bb1:
598
+ destroy_value %instance_c2 : $CDCase
599
+ %lifetime_c_1 = begin_borrow %instance_c1 : $CDCase
600
+ %ex1 = struct_extract %lifetime_c_1 : $CDCase, #CDCase.c
601
+ br bb3(%ex1 : $C, %lifetime_c_1 : $CDCase, %instance_c1 : $CDCase)
602
+
603
+ bb2:
604
+ destroy_value %instance_c1 : $CDCase
605
+ %lifetime_c_2 = begin_borrow %instance_c2 : $CDCase
606
+ %ex2 = struct_extract %lifetime_c_2 : $CDCase, #CDCase.c
607
+ br bb3(%ex2 : $C, %lifetime_c_2 : $CDCase, %instance_c2 : $CDCase)
608
+
609
+ bb3(%phi1 : @guaranteed $C, %phi2 : @guaranteed $CDCase, %phi3 : @owned $CDCase):
610
+ %f1 = function_ref @use_C : $@convention(thin) (@guaranteed C) -> ()
611
+ apply %f1(%phi1) : $@convention(thin) (@guaranteed C) -> ()
612
+ %f2 = function_ref @empty : $@convention(thin) () -> ()
613
+ apply %f2() : $@convention(thin) () -> ()
614
+ br bb4
615
+
616
+ bb4:
617
+ end_borrow %phi2 : $CDCase
618
+ destroy_value %phi3 : $CDCase
619
+ %retval = tuple ()
620
+ return %retval : $()
621
+ }
622
+
561
623
// =============================================================================
562
624
// access scope tests }}
563
625
// =============================================================================
0 commit comments