|
8 | 8 | // RUN: | %FileCheck %s
|
9 | 9 |
|
10 | 10 | import Builtin
|
| 11 | +import Swift |
11 | 12 |
|
12 | 13 | @_moveOnly
|
13 | 14 | struct M {
|
@@ -203,3 +204,36 @@ bb0(%s_addr : $*S):
|
203 | 204 | %retval = tuple ()
|
204 | 205 | return %retval : $()
|
205 | 206 | }
|
| 207 | + |
| 208 | +sil @getter : $@convention(thin) (@guaranteed M) -> @owned String |
| 209 | +sil @die : $@convention(thin) (@guaranteed @noescape @callee_guaranteed () -> @owned String) -> Never |
| 210 | + |
| 211 | +// CHECK-LABEL: sil [ossa] @partial_apply_of_borrow_of_deinitless_empty_struct : {{.*}} { |
| 212 | +// CHECK: bb0([[M_IN:%[^,]+]] : |
| 213 | +// CHECK: [[STACK:%[^,]+]] = alloc_stack $M |
| 214 | +// CHECK: store [[M_IN]] to [init] [[STACK]] |
| 215 | +// CHECK: [[ADDR:%[^,]+]] = drop_deinit [[STACK]] |
| 216 | +// CHECK: [[MB:%[^,]+]] = load_borrow [[ADDR]] |
| 217 | +// CHECK: [[GETTER:%[^,]+]] = function_ref @getter |
| 218 | +// CHECK: [[PA:%[^,]+]] = partial_apply [callee_guaranteed] [on_stack] [[GETTER]]([[MB]]) |
| 219 | +// CHECK: [[DIE:%[^,]+]] = function_ref @die |
| 220 | +// CHECK: apply [[DIE]]([[PA]]) |
| 221 | +// CHECK: destroy_value [[PA]] |
| 222 | +// CHECK: end_borrow [[MB]] |
| 223 | +// CHECK: unreachable |
| 224 | +// CHECK-LABEL: } // end sil function 'partial_apply_of_borrow_of_deinitless_empty_struct' |
| 225 | +sil [ossa] @partial_apply_of_borrow_of_deinitless_empty_struct : $@convention(method) (@owned M) -> () { |
| 226 | +bb0(%m_in : @owned $M): |
| 227 | + %stack = alloc_stack $M |
| 228 | + %addr1 = mark_unresolved_non_copyable_value [consumable_and_assignable] %stack : $*M |
| 229 | + store %m_in to [init] %addr1 : $*M |
| 230 | + %nodeinit = drop_deinit %addr1 : $*M |
| 231 | + %addr = mark_unresolved_non_copyable_value [no_consume_or_assign] %nodeinit : $*M |
| 232 | + %m = load [copy] %addr : $*M |
| 233 | + %mb = begin_borrow %m : $M |
| 234 | + %getter = function_ref @getter : $@convention(thin) (@guaranteed M) -> @owned String |
| 235 | + %pa = partial_apply [callee_guaranteed] [on_stack] %getter(%mb) : $@convention(thin) (@guaranteed M) -> @owned String |
| 236 | + %die = function_ref @die : $@convention(thin) (@guaranteed @noescape @callee_guaranteed () -> @owned String) -> Never |
| 237 | + apply %die(%pa) : $@convention(thin) (@guaranteed @noescape @callee_guaranteed () -> @owned String) -> Never |
| 238 | + unreachable |
| 239 | +} |
0 commit comments