@@ -107,6 +107,8 @@ sil [ossa] @takeGuaranteedObject : $@convention(thin) (@guaranteed AnyObject) ->
107
107
sil [ossa] @takeIndirectClass : $@convention(thin) (@in_guaranteed C) -> ()
108
108
sil [ossa] @takeTuple : $@convention(thin) <τ_0_0> (@in_guaranteed (τ_0_0, C)) -> ()
109
109
110
+ sil [ossa] @eraseToAny : $@convention(thin) <T> (@in_guaranteed T) -> @out Any
111
+ sil [ossa] @produceInt : $@convention(thin) () -> Int
110
112
111
113
sil [ossa] @takeIn : $@convention(thin) <T> (@in T) -> ()
112
114
sil [ossa] @takeInGuaranteed : $@convention(thin) <T> (@in_guaranteed T) -> ()
@@ -2555,6 +2557,32 @@ bb0:
2555
2557
return %retval : $()
2556
2558
}
2557
2559
2560
+ // Verify that ignored_use of an address-only type gets lowered correctly.
2561
+ // CHECK-LABEL: sil [ossa] @test_ignored_use : $@convention(thin) () -> () {
2562
+ // CHECK: [[RETVAL_ADDR:%[^,]+]] = alloc_stack $Any
2563
+ // CHECK: [[MAKE_INT:%[^,]+]] = function_ref @produceInt : $@convention(thin) () -> Builtin.Int64
2564
+ // CHECK: [[INT:%[^,]+]] = apply [[MAKE_INT]]()
2565
+ // CHECK: [[ERASE_FN:%[^,]+]] = function_ref @eraseToAny : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> @out Any
2566
+ // CHECK: [[ARG_ADDR:%[^,]+]] = alloc_stack $Builtin.Int64
2567
+ // CHECK: store [[INT]] to [trivial] [[ARG_ADDR]] : $*Builtin.Int64
2568
+ // CHECK: = apply [[ERASE_FN]]<Builtin.Int64>([[RETVAL_ADDR]], [[ARG_ADDR]]) : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> @out Any
2569
+ // CHECK: dealloc_stack [[ARG_ADDR]] : $*Builtin.Int64
2570
+ // CHECK: ignored_use [[RETVAL_ADDR]] : $*Any
2571
+ // CHECK: destroy_addr [[RETVAL_ADDR]] : $*Any
2572
+ // CHECK: dealloc_stack [[RETVAL_ADDR]] : $*Any
2573
+ // CHECK: } // end sil function 'test_ignored_use'
2574
+ sil [ossa] @test_ignored_use : $@convention(thin) () -> () {
2575
+ bb0:
2576
+ %1 = function_ref @produceInt : $@convention(thin) () -> Int
2577
+ %2 = apply %1() : $@convention(thin) () -> Int
2578
+ %3 = function_ref @eraseToAny : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> @out Any
2579
+ %4 = apply %3<Int>(%2) : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> @out Any
2580
+ ignored_use %4
2581
+ destroy_value %4
2582
+ %5 = tuple ()
2583
+ return %5
2584
+ }
2585
+
2558
2586
// CHECK-LABEL: sil [ossa] @test_mark_unresolved_non_copyable_value_1_consumable_and_assignable : {{.*}} {
2559
2587
// CHECK: bb0([[T:%[^,]+]] :
2560
2588
// CHECK: [[TP:%[^,]+]] = mark_unresolved_non_copyable_value [consumable_and_assignable] [[T]]
0 commit comments