@@ -3017,3 +3017,30 @@ bb9(%6 : $Builtin.Int32):
3017
3017
return %6 : $Builtin.Int32
3018
3018
}
3019
3019
3020
+ sil @adder : $@convention(thin) (Builtin.Int32, Builtin.Int32) -> Builtin.Int32
3021
+
3022
+ // CHECK-LABEL: sil @test_noescape
3023
+ // CHECK: [[FN:%.*]] = function_ref @adder
3024
+ // CHECK: [[PA:%.*]] = partial_apply [callee_guaranteed] [[FN]](%0)
3025
+ // CHECK-NOT: try_apply
3026
+ // CHECK: apply [[PA]](%1)
3027
+ // CHECK: return
3028
+ sil @test_noescape : $@convention(thin) (Builtin.Int32, Builtin.Int32) -> Builtin.Int32 {
3029
+ bb0(%0 : $Builtin.Int32, %1 : $Builtin.Int32):
3030
+ %f = function_ref @adder : $@convention(thin) (Builtin.Int32, Builtin.Int32) -> Builtin.Int32
3031
+ %pa = partial_apply [callee_guaranteed] %f(%0) : $@convention(thin) (Builtin.Int32, Builtin.Int32) -> Builtin.Int32
3032
+ %conv = convert_function %pa : $@callee_guaranteed (Builtin.Int32) -> (Builtin.Int32) to $@callee_guaranteed (Builtin.Int32) -> (Builtin.Int32, @error Error)
3033
+ %ne = convert_escape_to_noescape %conv : $@callee_guaranteed (Builtin.Int32) -> (Builtin.Int32, @error Error) to $@noescape @callee_guaranteed (Builtin.Int32) -> (Builtin.Int32, @error Error)
3034
+ try_apply %ne(%1) : $@noescape @callee_guaranteed (Builtin.Int32) -> (Builtin.Int32, @error Error), normal bb1, error bb2
3035
+
3036
+ bb1(%r : $Builtin.Int32):
3037
+ br bb3(%r : $Builtin.Int32)
3038
+
3039
+ bb2(%e : $Error):
3040
+ %r1 = integer_literal $Builtin.Int32, 0
3041
+ br bb3(%r1 : $Builtin.Int32)
3042
+
3043
+ bb3(%res : $Builtin.Int32):
3044
+ release_value %pa : $@callee_guaranteed (Builtin.Int32) -> (Builtin.Int32)
3045
+ return %res : $Builtin.Int32
3046
+ }
0 commit comments