@@ -405,6 +405,12 @@ bb0(%0 : $<τ_0_0> { var τ_0_0 } <Builtin.Int64>):
405
405
return %1 : $()
406
406
}
407
407
408
+ sil @guaranteed_box_throwing_use : $@convention(thin) (@guaranteed <τ_0_0> { var τ_0_0 } <Builtin.Int64>) -> @error Error {
409
+ bb0(%0 : $<τ_0_0> { var τ_0_0 } <Builtin.Int64>):
410
+ %1 = tuple ()
411
+ return %1 : $()
412
+ }
413
+
408
414
// CHECK_LABEL: sil hidden [noinline] @$test_guaranteed_call :
409
415
// CHECK: bb1{{.*}}:
410
416
// CHECK-NOT: strong_retain
@@ -2157,6 +2163,30 @@ bb2(%4 : $Error):
2157
2163
throw %4 : $Error
2158
2164
}
2159
2165
2166
+ // CHECK_LABEL: sil hidden [noinline] @$try_apply_test_3 :
2167
+ // CHECK-NOT: strong_retain
2168
+ // CHECK-NOT: strong_release
2169
+ // CHECK_LABEL: } // end sil function '$try_apply_test_3'
2170
+ sil hidden [noinline] @$try_apply_test_3 : $@convention(thin) () -> @error Error {
2171
+ bb0:
2172
+ %box = alloc_box $<τ_0_0> { var τ_0_0 } <Builtin.Int64>
2173
+ %proj = project_box %box : $<τ_0_0> { var τ_0_0 } <Builtin.Int64>, 0
2174
+ %funcref = function_ref @guaranteed_box_throwing_use : $@convention(thin) (@guaranteed <τ_0_0> { var τ_0_0 } <Builtin.Int64>) -> @error Error
2175
+ br bb1
2176
+
2177
+ bb1:
2178
+ strong_retain %box : $<τ_0_0> { var τ_0_0 } <Builtin.Int64>
2179
+ try_apply %funcref (%box) : $@convention(thin) (@guaranteed <τ_0_0> { var τ_0_0 } <Builtin.Int64>) -> @error Error, normal bbs, error bbe
2180
+
2181
+ bbs(%s : $()):
2182
+ strong_release %box : $<τ_0_0> { var τ_0_0 } <Builtin.Int64>
2183
+ return undef : $()
2184
+
2185
+ bbe(%e : $Error):
2186
+ strong_release %box : $<τ_0_0> { var τ_0_0 } <Builtin.Int64>
2187
+ throw %e : $Error
2188
+ }
2189
+
2160
2190
// In this control flow, ARC runs multiple iterations to get rid of and move the retain and releases.
2161
2191
// In the first iteration, we will try to move id1/id3 towards each other.
2162
2192
// we create new instructions and remove the old ones. However we had a bug to insert these newly created
0 commit comments