@@ -1881,6 +1881,49 @@ entry(%addr : $*T):
1881
1881
return %retval : $()
1882
1882
}
1883
1883
1884
+ // CHECK-LABEL: sil [ossa] @testCopyValue2StoreCopyAfterDestroy : {{.*}} {
1885
+ // CHECK: {{bb[0-9]+}}([[ADDR:%[^,]+]] :
1886
+ // CHECK: [[INSTANCE_ADDR:%[^,]+]] = alloc_stack $T
1887
+ // CHECK: [[COPY_ADDR:%[^,]+]] = alloc_stack $T
1888
+ // CHECK: apply undef<T>([[INSTANCE_ADDR]])
1889
+ // CHECK: copy_addr [[INSTANCE_ADDR]] to [init] [[COPY_ADDR]]
1890
+ // CHECK: destroy_addr [[INSTANCE_ADDR]]
1891
+ // CHECK: copy_addr [take] [[COPY_ADDR]] to [[ADDR]]
1892
+ // CHECK-LABEL: } // end sil function 'testCopyValue2StoreCopyAfterDestroy'
1893
+ sil [ossa] @testCopyValue2StoreCopyAfterDestroy : $@convention(thin) <T> (@inout T) -> () {
1894
+ entry(%addr : $*T):
1895
+ %instance = apply undef<T>() : $@convention(thin) <Tee> () -> @out Tee
1896
+ %copy = copy_value %instance : $T
1897
+ destroy_value %instance : $T
1898
+ store %copy to [assign] %addr : $*T
1899
+ %retval = tuple ()
1900
+ return %retval : $()
1901
+ }
1902
+
1903
+ // CHECK-LABEL: sil [ossa] @testCopyValue3StoreTupleDestructureFieldAfterDestroy : $@convention(thin) <T> (@inout T) -> () {
1904
+ // CHECK: {{bb[0-9]+}}([[ADDR:%[^,]+]] :
1905
+ // CHECK: [[INSTANCE_ADDR:%[^,]+]] = alloc_stack $(T, T)
1906
+ // CHECK: [[COPY_ADDR:%[^,]+]] = alloc_stack $T
1907
+ // CHECK: apply undef<T>([[INSTANCE_ADDR]]) : $@convention(thin) <τ_0_0> () -> @out (τ_0_0, τ_0_0)
1908
+ // CHECK: [[ONE_ADDR:%[^,]+]] = tuple_element_addr [[INSTANCE_ADDR]]{{.*}}, 0
1909
+ // CHECK: [[TWO_ADDR:%[^,]+]] = tuple_element_addr [[INSTANCE_ADDR]]{{.*}}, 1
1910
+ // CHECK: copy_addr [[ONE_ADDR]] to [init] [[COPY_ADDR]]
1911
+ // CHECK: destroy_addr [[ONE_ADDR]]
1912
+ // CHECK: destroy_addr [[TWO_ADDR]]
1913
+ // CHECK: copy_addr [take] [[COPY_ADDR]] to [[ADDR]]
1914
+ // CHECK-LABEL: } // end sil function 'testCopyValue3StoreTupleDestructureFieldAfterDestroy'
1915
+ sil [ossa] @testCopyValue3StoreTupleDestructureFieldAfterDestroy : $@convention(thin) <T> (@inout T) -> () {
1916
+ entry(%addr : $*T):
1917
+ %instance = apply undef<T>() : $@convention(thin) <Tee> () -> @out (Tee, Tee)
1918
+ (%one, %two) = destructure_tuple %instance : $(T, T)
1919
+ %copy = copy_value %one : $T
1920
+ destroy_value %one : $T
1921
+ destroy_value %two : $T
1922
+ store %copy to [assign] %addr : $*T
1923
+ %retval = tuple ()
1924
+ return %retval : $()
1925
+ }
1926
+
1884
1927
// CHECK-LABEL: sil hidden [ossa] @testOpaqueYield :
1885
1928
// CHECK: bb0(%0 : @guaranteed $TestGeneric<T>):
1886
1929
// CHECK: [[REF:%.*]] = ref_element_addr %0 : $TestGeneric<T>, #TestGeneric.borrowedGeneric
0 commit comments