@@ -337,3 +337,38 @@ bb3:
337
337
return %8 : $()
338
338
}
339
339
340
+ // CHECK-LABEL: sil [ossa] @test_store_borrow_use_in_block_without_alloc_stack_use : {{.*}} {
341
+ // CHECK: [[OWNED:%[^,]+]] = apply
342
+ // CHECK: [[GUARANTEED:%[^,]+]] = begin_borrow [[OWNED]]
343
+ // CHECK: [[LIFETIME:%[^,]+]] = begin_borrow [lexical] [[GUARANTEED]]
344
+ // CHECK: apply undef([[LIFETIME]]) : $@convention(thin) (@guaranteed Klass) -> ()
345
+ // CHECK: br [[MIDDLE:bb[0-9]+]]
346
+ // CHECK: [[MIDDLE]]:
347
+ // CHECK: end_borrow [[LIFETIME]]
348
+ // CHECK: br [[EXIT:bb[0-9]+]]
349
+ // CHECK: [[EXIT]]:
350
+ // CHECK: end_borrow [[GUARANTEED]]
351
+ // CHECK: destroy_value [[OWNED]]
352
+ // CHECK-LABEL: } // end sil function 'test_store_borrow_use_in_block_without_alloc_stack_use'
353
+ sil [ossa] @test_store_borrow_use_in_block_without_alloc_stack_use : $@convention(thin) () -> () {
354
+ bb0:
355
+ %owned = apply undef() : $@convention(thin) () -> (@owned Klass)
356
+ %guaranteed = begin_borrow %owned : $Klass
357
+ %stack = alloc_stack [lexical] $Klass
358
+ %stored = store_borrow %guaranteed to %stack : $*Klass
359
+ %load = load_borrow %stored : $*Klass
360
+ apply undef(%load) : $@convention(thin) (@guaranteed Klass) -> ()
361
+ end_borrow %load : $Klass
362
+ br bb1
363
+
364
+ bb1:
365
+ end_borrow %stored : $*Klass
366
+ br bb3
367
+
368
+ bb3:
369
+ dealloc_stack %stack : $*Klass
370
+ end_borrow %guaranteed : $Klass
371
+ destroy_value %owned : $Klass
372
+ %retval = tuple ()
373
+ return %retval : $()
374
+ }
0 commit comments