@@ -17,6 +17,8 @@ private class C2 {
17
17
18
18
class Klass {}
19
19
20
+ class AnotherKlass {}
21
+
20
22
sil [transparent] [ossa] @calleeWithGuaranteed : $@convention(thin) (@guaranteed C) -> Builtin.Int64 {
21
23
bb(%0 : @guaranteed $C):
22
24
%1 = ref_element_addr %0 : $C, #C.i
@@ -270,6 +272,23 @@ bb3:
270
272
return %9999 : $()
271
273
}
272
274
275
+ sil [transparent] [ossa] @term_ossa_checked_cast_addr_br_takealways_callee2 : $@convention(thin) (@in @thick Klass.Type) -> () {
276
+ bb0(%0 : $*@thick Klass.Type):
277
+ %2 = alloc_stack $AnotherKlass
278
+ checked_cast_addr_br take_always Klass in %0 : $*@thick Klass.Type to Klass in %2 : $*AnotherKlass, bb1, bb2
279
+
280
+ bb1:
281
+ destroy_addr %2 : $*AnotherKlass
282
+ br bb3
283
+
284
+ bb2:
285
+ br bb3
286
+
287
+ bb3:
288
+ dealloc_stack %2 : $*AnotherKlass
289
+ %9999 = tuple()
290
+ return %9999 : $()
291
+ }
273
292
274
293
// CHECK-LABEL: sil [ossa] @term_nonossa_checked_cast_addr_br_takealways_caller : $@convention(thin) (@owned Builtin.NativeObject) -> () {
275
294
// CHECK: bb0([[ARG:%.*]] :
@@ -305,6 +324,25 @@ bb0(%0 : @owned $Builtin.NativeObject):
305
324
return %9999 : $()
306
325
}
307
326
327
+ sil [ossa] @get_klass_type : $@convention(thin) () -> @out @thick Klass.Type
328
+
329
+ // CHECK-LABEL: sil [ossa] @term_nonossa_checked_cast_addr_br_takealways_caller2 :
330
+ // CHECK: checked_cast_br {{.*}} : $@thick Klass.Type to Klass, [[SUCCESS_BB:bb[0-9]+]], [[FAILURE_BB:bb[0-9]+]], forwarding: @owned
331
+ // CHECK: [[SUCCESS_BB]]({{.*}}@owned $AnotherKlass):
332
+ // CHECK: [[FAILURE_BB]]([[FAILURE_ARG:%.*]] :
333
+ // CHECK: } // end sil function 'term_nonossa_checked_cast_addr_br_takealways_caller2'
334
+ sil [ossa] @term_nonossa_checked_cast_addr_br_takealways_caller2 : $@convention(thin) () -> () {
335
+ bb0:
336
+ %res = alloc_stack $@thick Klass.Type
337
+ %2 = function_ref @get_klass_type : $@convention(thin) () -> @out @thick Klass.Type
338
+ apply %2(%res) : $@convention(thin) () -> @out @thick Klass.Type
339
+ %3 = function_ref @term_ossa_checked_cast_addr_br_takealways_callee2 : $@convention(thin) (@in @thick Klass.Type) -> ()
340
+ apply %3(%res) : $@convention(thin) (@in @thick Klass.Type) -> ()
341
+ dealloc_stack %res : $*@thick Klass.Type
342
+ %9999 = tuple()
343
+ return %9999 : $()
344
+ }
345
+
308
346
sil [transparent] [ossa] @term_ossa_checked_cast_addr_br_takeonsuccess_callee : $@convention(thin) (@owned Builtin.NativeObject) -> () {
309
347
bb0(%0 : @owned $Builtin.NativeObject):
310
348
%1 = alloc_stack $Builtin.NativeObject
0 commit comments