Skip to content

Commit 6f67905

Browse files
authored
Merge pull request #64270 from meg-gupta/addtest
Add test for #64258
2 parents 2567804 + 2d55a8b commit 6f67905

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/SILOptimizer/sil_combine_enum_addr.sil

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,3 +250,32 @@ bb22:
250250
inject_enum_addr %3 : $*Optional<CustomStringConvertible>, #Optional.none!enumelt
251251
br bb2
252252
}
253+
254+
sil @no_init : $@convention(thin) () -> (@out ())
255+
256+
// CHECK-LABEL: sil @test_empty_tuple_uninintialized : $@convention(thin) () -> () {
257+
// CHECK: init_enum_data_addr
258+
// CHECK: inject_enum_addr
259+
// CHECK-LABEL: } // end sil function 'test_empty_tuple_uninintialized'
260+
sil @test_empty_tuple_uninintialized : $@convention(thin) () -> () {
261+
bb0:
262+
%0 = alloc_stack $Optional<()>
263+
%1 = init_enum_data_addr %0 : $*Optional<()>, #Optional.some!enumelt
264+
%f = function_ref @no_init : $@convention(thin) () -> (@out ())
265+
apply %f(%1) : $@convention(thin) () -> (@out ())
266+
inject_enum_addr %0 : $*Optional<()>, #Optional.some!enumelt
267+
%2 = load %0 : $*Optional<()>
268+
switch_enum %2 : $Optional<()>, case #Optional.some!enumelt: bb1, case #Optional.none!enumelt: bb2
269+
270+
bb1(%4 : $()):
271+
br bb3
272+
273+
bb2:
274+
br bb3
275+
276+
bb3:
277+
dealloc_stack %0 : $*Optional<()>
278+
%8 = tuple ()
279+
return %8 : $()
280+
}
281+

0 commit comments

Comments
 (0)