@@ -395,6 +395,53 @@ bb0(%0 : $*Builtin.Int32):
395
395
return %4: $()
396
396
}
397
397
398
+ struct Int {
399
+ var value : Builtin.Int64
400
+ }
401
+
402
+ sil @guaranteed_call : $@convention(thin) (@guaranteed <τ_0_0> { var τ_0_0 } <Builtin.Int64>) -> () {
403
+ bb0(%0 : $<τ_0_0> { var τ_0_0 } <Builtin.Int64>):
404
+ %1 = tuple ()
405
+ return %1 : $()
406
+ }
407
+
408
+ // CHECK_LABEL: sil hidden [noinline] @$test_guaranteed_call :
409
+ // CHECK: bb1{{.*}}:
410
+ // CHECK-NOT: strong_retain
411
+ // CHECK: apply
412
+ // CHECK-NOT: strong_release
413
+ // CHECK: bb2:
414
+ // CHECK_LABEL: } // end sil function '$test_guaranteed_call'
415
+ sil hidden [noinline] @$test_guaranteed_call : $@convention(thin) () -> () {
416
+ bb0:
417
+ %box = alloc_box $<τ_0_0> { var τ_0_0 } <Builtin.Int64>
418
+ %proj = project_box %box : $<τ_0_0> { var τ_0_0 } <Builtin.Int64>, 0
419
+ %0 = integer_literal $Builtin.Int64, 1
420
+ %1 = integer_literal $Builtin.Int64, 100
421
+ %funcref = function_ref @guaranteed_call : $@convention(thin) (@guaranteed <τ_0_0> { var τ_0_0 } <Builtin.Int64>) -> ()
422
+ %3 = struct $Int (%0 : $Builtin.Int64)
423
+ %6 = integer_literal $Builtin.Int1, -1
424
+ br bb1(%0 : $Builtin.Int64)
425
+
426
+ bb1(%8 : $Builtin.Int64):
427
+ %9 = builtin "sadd_with_overflow_Int64"(%8 : $Builtin.Int64, %0 : $Builtin.Int64, %6 : $Builtin.Int1) : $(Builtin.Int64, Builtin.Int1)
428
+ %10 = tuple_extract %9 : $(Builtin.Int64, Builtin.Int1), 0
429
+ %11 = struct $Int (%10 : $Builtin.Int64)
430
+ %12 = builtin "cmp_eq_Int64"(%10 : $Builtin.Int64, %1 : $Builtin.Int64) : $Builtin.Int1
431
+ strong_retain %box : $<τ_0_0> { var τ_0_0 } <Builtin.Int64>
432
+ apply %funcref (%box) : $@convention(thin) (@guaranteed <τ_0_0> { var τ_0_0 } <Builtin.Int64>) -> ()
433
+ strong_release %box : $<τ_0_0> { var τ_0_0 } <Builtin.Int64>
434
+ cond_br %12, bb3, bb2
435
+
436
+ bb2:
437
+ br bb1(%10 : $Builtin.Int64)
438
+
439
+ bb3:
440
+ strong_release %box : $<τ_0_0> { var τ_0_0 } <Builtin.Int64>
441
+ %17 = tuple ()
442
+ return %17 : $()
443
+ }
444
+
398
445
// CHECK-LABEL: sil @silargument_retain_iterated : $@convention(thin) (@owned <τ_0_0> { var τ_0_0 } <Builtin.Int32>) -> ()
399
446
// CHECK: bb0
400
447
// CHECK-NEXT: function_ref user
0 commit comments