@@ -975,3 +975,42 @@ bb0:
975
975
return %r : $()
976
976
}
977
977
978
+ sil @consume_and_borrow : $@convention(thin) (@owned Klass, @guaranteed Klass) -> ()
979
+ sil @borrow : $@convention(thin) (@guaranteed Klass) -> ()
980
+ sil @consume : $@convention(thin) (@owned Klass) -> ()
981
+ sil @get_klass : $@convention(thin) () -> @owned Klass
982
+
983
+ // CHECK-LABEL: sil hidden [ossa] @borrow_and_consume_copyable_test1 :
984
+ // CHECK-NOT: copy_value
985
+ // CHECK-LABEL: } // end sil function 'borrow_and_consume_copyable_test1'
986
+ sil hidden [ossa] @borrow_and_consume_copyable_test1 : $@convention(thin) () -> () {
987
+ bb0:
988
+ %0 = function_ref @get_klass : $@convention(thin) () -> @owned Klass
989
+ %1 = apply %0() : $@convention(thin) () -> @owned Klass
990
+ %2 = move_value [var_decl] %1
991
+ %3 = copy_value %2
992
+ %4 = function_ref @borrow : $@convention(thin) (@guaranteed Klass) -> ()
993
+ %5 = apply %4(%2) : $@convention(thin) (@guaranteed Klass) -> ()
994
+ %6 = function_ref @consume : $@convention(thin) (@owned Klass) -> ()
995
+ %7 = apply %6(%3) : $@convention(thin) (@owned Klass) -> ()
996
+ destroy_value %2
997
+ %9 = tuple ()
998
+ return %9
999
+ }
1000
+
1001
+ // CHECK-LABEL: sil hidden [ossa] @borrow_and_consume_copyable_test2 :
1002
+ // CHECK: copy_value
1003
+ // CHECK-LABEL: } // end sil function 'borrow_and_consume_copyable_test2'
1004
+ sil hidden [ossa] @borrow_and_consume_copyable_test2 : $@convention(thin) () -> () {
1005
+ bb0:
1006
+ %0 = function_ref @get_klass : $@convention(thin) () -> @owned Klass
1007
+ %1 = apply %0() : $@convention(thin) () -> @owned Klass
1008
+ %2 = move_value [var_decl] %1
1009
+ %3 = copy_value %2
1010
+ %4 = function_ref @consume_and_borrow : $@convention(thin) (@owned Klass, @guaranteed Klass) -> ()
1011
+ %5 = apply %4(%3, %2) : $@convention(thin) (@owned Klass, @guaranteed Klass) -> ()
1012
+ destroy_value %2
1013
+ %7 = tuple ()
1014
+ return %7
1015
+ }
1016
+
0 commit comments