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