@@ -40,6 +40,12 @@ struct LargeCodesizeStruct {
4040 var s5: SmallCodesizeStruct
4141}
4242
43+ class C {}
44+
45+ struct S {
46+ var field: C
47+ }
48+
4349///////////
4450// Tests //
4551///////////
@@ -657,3 +663,68 @@ bb16:
657663 %retval = tuple ()
658664 return %retval : $()
659665}
666+
667+ // CHECK-LABEL: sil [ossa] @debug_value_of_store_borrow_addr_multi_block : {{.*}} {
668+ // CHECK: {{bb[0-9]+}}([[INSTANCE:%[^,]+]] :
669+ // CHECK: [[LIFETIME:%[^,]+]] = begin_borrow [[INSTANCE]]
670+ // CHECK: debug_value [[LIFETIME]]
671+ // CHECK-LABEL: } // end sil function 'debug_value_of_store_borrow_addr_multi_block'
672+ sil [ossa] @debug_value_of_store_borrow_addr_multi_block : $@convention(thin) (@owned S) -> () {
673+ entry(%instance : @owned $S):
674+ br header
675+
676+ header:
677+ %lifetime = begin_borrow %instance : $S
678+ %stack = alloc_stack $S
679+ %stack_borrow = store_borrow %lifetime to %stack : $*S
680+ debug_value %stack_borrow : $*S
681+ br body
682+
683+ body:
684+ %field_addr = struct_element_addr %stack_borrow : $*S, #S.field
685+ %field = load [copy] %field_addr : $*C
686+ end_borrow %stack_borrow : $*S
687+ dealloc_stack %stack : $*S
688+ end_borrow %lifetime : $S
689+ destroy_value %field : $C
690+ cond_br undef, backedge, exit
691+
692+ backedge:
693+ br header
694+
695+ exit:
696+ destroy_value %instance : $S
697+ %retval = tuple ()
698+ return %retval : $()
699+ }
700+
701+ // CHECK-LABEL: sil [ossa] @debug_value_of_store_borrow_addr_single_block : {{.*}} {
702+ // CHECK: {{bb[0-9]+}}([[INSTANCE:%[^,]+]] :
703+ // CHECK: [[LIFETIME:%[^,]+]] = begin_borrow [[INSTANCE]]
704+ // CHECK: debug_value [[LIFETIME]]
705+ // CHECK-LABEL: } // end sil function 'debug_value_of_store_borrow_addr_single_block'
706+ sil [ossa] @debug_value_of_store_borrow_addr_single_block : $@convention(thin) (@owned S) -> () {
707+ entry(%instance : @owned $S):
708+ br header
709+
710+ header:
711+ %lifetime = begin_borrow %instance : $S
712+ %stack = alloc_stack $S
713+ %stack_borrow = store_borrow %lifetime to %stack : $*S
714+ debug_value %stack_borrow : $*S
715+ %field_addr = struct_element_addr %stack_borrow : $*S, #S.field
716+ %field = load [copy] %field_addr : $*C
717+ end_borrow %stack_borrow : $*S
718+ dealloc_stack %stack : $*S
719+ end_borrow %lifetime : $S
720+ destroy_value %field : $C
721+ cond_br undef, backedge, exit
722+
723+ backedge:
724+ br header
725+
726+ exit:
727+ destroy_value %instance : $S
728+ %retval = tuple ()
729+ return %retval : $()
730+ }
0 commit comments