@@ -806,6 +806,28 @@ bb0(%0 : @owned $(AnyObject, T)):
806
806
return %tuple : $(AnyObject, T)
807
807
}
808
808
809
+ // CHECK-LABEL: sil [ossa] @f126_testDestructureAndBorrow : $@convention(method) <Element> (@in (SI<Element>, I)) -> (@out Element, @out I) {
810
+ // CHECK: bb0(%0 : $*Element, %1 : $*I, %2 : $*(SI<Element>, I)):
811
+ // CHECK: [[SI:%.*]] = tuple_element_addr %2 : $*(SI<Element>, I), 0
812
+ // CHECK: [[I:%.*]] = tuple_element_addr %2 : $*(SI<Element>, I), 1
813
+ // CHECK: [[LD:%.*]] = load [trivial] [[I]] : $*I
814
+ // CHECK: [[E:%.*]] = struct_element_addr [[SI]] : $*SI<Element>, #SI.element
815
+ // CHECK: copy_addr [[E]] to [initialization] %0 : $*Element
816
+ // CHECK: destroy_addr [[SI]] : $*SI<Element>
817
+ // CHECK: store [[LD]] to [trivial] %1 : $*I
818
+ // CHECK-LABEL: } // end sil function 'f126_testDestructureAndBorrow'
819
+ sil [ossa] @f126_testDestructureAndBorrow : $@convention(method) <Element> (@in (SI<Element>, I)) -> (@out Element, @out I) {
820
+ bb0(%0 : @owned $(SI<Element>, I)):
821
+ (%si, %i) = destructure_tuple %0 : $(SI<Element>, I)
822
+ %borrow = begin_borrow %si : $SI<Element>
823
+ %element = struct_extract %borrow : $SI<Element>, #SI.element
824
+ %copy = copy_value %element : $Element
825
+ end_borrow %borrow : $SI<Element>
826
+ destroy_value %si : $SI<Element>
827
+ %tuple = tuple(%copy : $Element, %i : $I)
828
+ return %tuple : $(Element, I)
829
+ }
830
+
809
831
// CHECK-LABEL: sil [ossa] @f130_testReleaseValue : $@convention(thin) <T> (@in T) -> () {
810
832
// CHECK: bb0(%0 : $*T):
811
833
// CHECK: destroy_addr %0 : $*T
0 commit comments