@@ -50,6 +50,7 @@ sil @unknown : $@convention(thin) () -> ()
5050sil [ossa] @guaranteed_user : $@convention(thin) (@guaranteed Klass) -> ()
5151sil [ossa] @guaranteed_user_with_result : $@convention(thin) (@guaranteed Klass) -> @out Klass
5252sil [ossa] @inguaranteed_user_without_result_NTS : $@convention(thin) (@in_guaranteed NonTrivialStruct) -> ()
53+ sil [ossa] @inguaranteed_user_without_result_MOS : $@convention(thin) (@in_guaranteed MOS) -> ()
5354
5455sil [ossa] @inguaranteed_user_without_result : $@convention(thin) (@in_guaranteed Klass) -> () {
5556bb0(%0 : $*Klass):
@@ -1686,6 +1687,34 @@ entry(%out : $*Klass):
16861687 return %retval : $()
16871688}
16881689
1690+ // CHECK-LABEL: sil [ossa] @take_from_original_copy_addr__final_use_apply__move_only : {{.*}} {
1691+ // CHECK: [[GET:%[^,]+]] = function_ref @getMOS
1692+ // CHECK: [[USER:%[^,]+]] = function_ref @inguaranteed_user_without_result_MOS
1693+ // CHECK: [[INSTANCE:%[^,]+]] = apply [[GET]]()
1694+ // CHECK: [[SRC:%[^,]+]] = alloc_stack $MOS
1695+ // CHECK: store [[INSTANCE]] to [init] [[SRC]]
1696+ // CHECK: apply [[USER]]([[SRC]])
1697+ // CHECK: apply [[USER]]([[SRC]])
1698+ // CHECK: destroy_addr [[SRC]]
1699+ // CHECK: dealloc_stack [[SRC]]
1700+ // CHECK-LABEL: } // end sil function 'take_from_original_copy_addr__final_use_apply__move_only'
1701+ sil [ossa] @take_from_original_copy_addr__final_use_apply__move_only : $() -> () {
1702+ %getMOS = function_ref @getMOS : $@convention(thin) () -> @owned MOS
1703+ %user = function_ref @inguaranteed_user_without_result_MOS : $@convention(thin) (@in_guaranteed MOS) -> ()
1704+ %instance_1 = apply %getMOS() : $@convention(thin) () -> @owned MOS
1705+ %src = alloc_stack $MOS
1706+ store %instance_1 to [init] %src : $*MOS
1707+ apply %user(%src) : $@convention(thin) (@in_guaranteed MOS) -> ()
1708+ %tmp = alloc_stack $MOS
1709+ copy_addr [take] %src to [init] %tmp : $*MOS
1710+ apply %user(%tmp) : $@convention(thin) (@in_guaranteed MOS) -> ()
1711+ destroy_addr %tmp : $*MOS
1712+ dealloc_stack %tmp : $*MOS
1713+ dealloc_stack %src : $*MOS
1714+ %tuple = tuple ()
1715+ return %tuple : $()
1716+ }
1717+
16891718// This does not get optimized correctly because of the conservative treatment of load_borrow/end_borrow in MemBehavior
16901719// CHECK-LABEL: sil [ossa] @test_temprvoborrowboundary1 :
16911720// CHECK: copy_addr
0 commit comments