@@ -545,15 +545,104 @@ right:
545
545
// CHECK-LABEL: begin running test {{.*}} on loopy: liveness_partial_boundary_outside_users with: %o
546
546
// CHECK: end_borrow
547
547
// CHECK-LABEL: end running test {{.*}} on loopy: liveness_partial_boundary_outside_users with: %o
548
+ // CHECK-LABEL: begin running test {{.*}} on loopy: ossa_lifetime_completion
549
+ // CHECK-LABEL: sil [ossa] @loopy : {{.*}} {
550
+ // CHECK: [[O:%[^,]+]] = apply undef
551
+ // CHECK: [[B:%[^,]+]] = begin_borrow [[O]]
552
+ // CHECK: end_borrow [[B]]
553
+ // CHECK: extend_lifetime [[O]]
554
+ // CHECK: br bb1
555
+ // CHECK: bb1:
556
+ // CHECK: br bb1
557
+ // CHECK-LABEL: } // end sil function 'loopy'
558
+ // CHECK-LABEL: end running test {{.*}} on loopy: ossa_lifetime_completion
559
+ // CHECK-LABEL: begin running test {{.*}} on loopy: liveness_partial_boundary_outside_users with: %o
560
+ // CHECK-NEXT: end running test {{.*}} on loopy: liveness_partial_boundary_outside_users with: %o
548
561
sil [ossa] @loopy : $@convention(thin) () -> () {
549
562
%o = apply undef() : $@convention(thin) () -> (@owned C)
550
563
specify_test "liveness_partial_boundary_outside_users %o"
564
+ specify_test "ossa_lifetime_completion %o availability"
565
+ specify_test "liveness_partial_boundary_outside_users %o"
566
+ %b = begin_borrow %o : $C
567
+ end_borrow %b : $C
568
+ br loop
569
+
570
+ loop:
571
+ br loop
572
+ }
573
+
574
+ sil [ossa] @loopyComplete : $@convention(thin) () -> () {
575
+ %o = apply undef() : $@convention(thin) () -> (@owned C)
576
+ specify_test "ossa_lifetime_completion %o availability"
577
+ specify_test "liveness_partial_boundary_outside_users %o"
551
578
%b = begin_borrow %o : $C
552
579
end_borrow %b : $C
580
+ extend_lifetime %o : $C
581
+ br loop
582
+
583
+ loop:
584
+ br loop
585
+ }
586
+
587
+ // When there are no users in the loop, do not extend the lifetime into it.
588
+ // CHECK-LABEL: begin running test {{.*}} on loopy_sometimes: ossa_lifetime_completion with: %c, availability
589
+ // CHECK-LABEL: sil [ossa] @loopy_sometimes : {{.*}} {
590
+ // CHECK-NOT: extend_lifetime
591
+ // CHECK-LABEL: } // end sil function 'loopy_sometimes'
592
+ // CHECK-LABEL: end running test {{.*}} on loopy_sometimes: ossa_lifetime_completion with: %c, availability
593
+ // CHECK-LABEL: begin running test {{.*}} on loopy_sometimes: liveness_partial_boundary_outside_users with: %c
594
+ // CHECK-NEXT: end running test {{.*}} on loopy_sometimes: liveness_partial_boundary_outside_users with: %c
595
+ sil [ossa] @loopy_sometimes : $@convention(thin) (@owned C) -> () {
596
+ entry(%c : @owned $C):
597
+ specify_test "ossa_lifetime_completion %c availability"
598
+ specify_test "liveness_partial_boundary_outside_users %c"
599
+ cond_br undef, header, exit
600
+
601
+ header:
553
602
br loop
554
603
555
604
loop:
556
605
br loop
606
+
607
+ exit:
608
+ destroy_value %c : $C
609
+ %retval = tuple ()
610
+ return %retval : $()
611
+ }
612
+
613
+ // CHECK-LABEL: begin running test {{.*}} on loopy_sometimes_2: ossa_lifetime_completion with: %c, availability
614
+ // CHECK-LABEL: sil [ossa] @loopy_sometimes_2 : {{.*}} {
615
+ // CHECK: bb0([[O:%[^,]+]] :
616
+ // CHECK: cond_br undef, [[HEADER:bb[0-9]+]], [[EXIT:bb[0-9]+]]
617
+ // CHECK: [[HEADER]]:
618
+ // CHECK: br [[LOOP:bb[0-9]+]]
619
+ // CHECK: [[LOOP]]:
620
+ // CHECK: [[B:%[^,]+]] = begin_borrow [[O]]
621
+ // CHECK: end_borrow [[B]]
622
+ // CHECK: extend_lifetime [[O]]
623
+ // CHECK: br [[LOOP]]
624
+ // CHECK: [[EXIT]]:
625
+ // CHECK: destroy_value [[O]]
626
+ // CHECK-LABEL: } // end sil function 'loopy_sometimes_2'
627
+ // CHECK-LABEL: end running test {{.*}} on loopy_sometimes_2: ossa_lifetime_completion with: %c, availability
628
+ sil [ossa] @loopy_sometimes_2 : $@convention(thin) (@owned C) -> () {
629
+ entry(%c : @owned $C):
630
+ specify_test "ossa_lifetime_completion %c availability"
631
+ specify_test "liveness_partial_boundary_outside_users %c"
632
+ cond_br undef, header, exit
633
+
634
+ header:
635
+ br loop
636
+
637
+ loop:
638
+ %b = begin_borrow %c : $C
639
+ end_borrow %b : $C
640
+ br loop
641
+
642
+ exit:
643
+ destroy_value %c : $C
644
+ %retval = tuple ()
645
+ return %retval : $()
557
646
}
558
647
559
648
// CHECK-LABEL: begin running test {{.*}} on type_dependent_operand: liveness_partial_boundary_outside_users
0 commit comments