@@ -22,6 +22,12 @@ struct LargeCodesizeStruct {
2222 var s5: SmallCodesizeStruct
2323}
2424
25+ class C {}
26+
27+ struct S {
28+ var field: C
29+ }
30+
2531///////////
2632// Tests //
2733///////////
@@ -538,3 +544,67 @@ bb7:
538544 return %r : $()
539545}
540546
547+ // CHECK-LABEL: sil [ossa] @debug_value_of_store_borrow_addr_multi_block : {{.*}} {
548+ // CHECK: {{bb[0-9]+}}([[INSTANCE:%[^,]+]] :
549+ // CHECK: [[LIFETIME:%[^,]+]] = begin_borrow [[INSTANCE]]
550+ // CHECK: debug_value [[LIFETIME]]
551+ // CHECK-LABEL: } // end sil function 'debug_value_of_store_borrow_addr_multi_block'
552+ sil [ossa] @debug_value_of_store_borrow_addr_multi_block : $@convention(thin) (@owned S) -> () {
553+ entry(%instance : @owned $S):
554+ br header
555+
556+ header:
557+ %lifetime = begin_borrow %instance : $S
558+ %stack = alloc_stack $S
559+ %stack_borrow = store_borrow %lifetime to %stack : $*S
560+ debug_value %stack_borrow : $*S
561+ br body
562+
563+ body:
564+ %field_addr = struct_element_addr %stack_borrow : $*S, #S.field
565+ %field = load [copy] %field_addr : $*C
566+ end_borrow %stack_borrow : $*S
567+ dealloc_stack %stack : $*S
568+ end_borrow %lifetime : $S
569+ destroy_value %field : $C
570+ cond_br undef, backedge, exit
571+
572+ backedge:
573+ br header
574+
575+ exit:
576+ destroy_value %instance : $S
577+ %retval = tuple ()
578+ return %retval : $()
579+ }
580+
581+ // CHECK-LABEL: sil [ossa] @debug_value_of_store_borrow_addr_single_block : {{.*}} {
582+ // CHECK: {{bb[0-9]+}}([[INSTANCE:%[^,]+]] :
583+ // CHECK: [[LIFETIME:%[^,]+]] = begin_borrow [[INSTANCE]]
584+ // CHECK: debug_value [[LIFETIME]]
585+ // CHECK-LABEL: } // end sil function 'debug_value_of_store_borrow_addr_single_block'
586+ sil [ossa] @debug_value_of_store_borrow_addr_single_block : $@convention(thin) (@owned S) -> () {
587+ entry(%instance : @owned $S):
588+ br header
589+
590+ header:
591+ %lifetime = begin_borrow %instance : $S
592+ %stack = alloc_stack $S
593+ %stack_borrow = store_borrow %lifetime to %stack : $*S
594+ debug_value %stack_borrow : $*S
595+ %field_addr = struct_element_addr %stack_borrow : $*S, #S.field
596+ %field = load [copy] %field_addr : $*C
597+ end_borrow %stack_borrow : $*S
598+ dealloc_stack %stack : $*S
599+ end_borrow %lifetime : $S
600+ destroy_value %field : $C
601+ cond_br undef, backedge, exit
602+
603+ backedge:
604+ br header
605+
606+ exit:
607+ destroy_value %instance : $S
608+ %retval = tuple ()
609+ return %retval : $()
610+ }
0 commit comments