@@ -33,7 +33,7 @@ struct DepStruct {
3333 private var depField2: [X]
3434}
3535
36- // CHECK-LABEL: sil @test_alloc_stack
36+ // CHECK-LABEL: sil @test_alloc_stack :
3737// CHECK: [[I:%[0-9]+]] = integer_literal $Builtin.Int1, -1
3838// CHECK: [[R:%[0-9]+]] = struct $Bool ([[I]] : $Builtin.Int1)
3939// CHECK: return [[R]]
5454 return %10 : $Bool
5555}
5656
57- // CHECK-LABEL: sil @test_alloc_stack_escapes
57+ // CHECK-LABEL: sil [ossa] @test_alloc_stack_ossa :
58+ // CHECK: [[I:%[0-9]+]] = integer_literal $Builtin.Int1, -1
59+ // CHECK: [[R:%[0-9]+]] = struct $Bool ([[I]] : $Builtin.Int1)
60+ // CHECK: return [[R]]
61+ sil [ossa] @test_alloc_stack_ossa : $@convention(thin) () -> Bool {
62+ bb0:
63+ %1 = alloc_stack $Array<X>
64+ %3 = function_ref @_array_X_init : $@convention(thin) () -> @owned Array<X>
65+ %4 = apply %3() : $@convention(thin) () -> @owned Array<X>
66+ store %4 to [init] %1 : $*Array<X>
67+
68+ %m1 = function_ref @_array_X_mutate : $@convention(method) (@inout Array<X>) -> ()
69+ %m2 = apply %m1(%1) : $@convention(method) (@inout Array<X>) -> ()
70+
71+ %5 = load_borrow %1 : $*Array<X>
72+ %6 = function_ref @_is_native_X_no_type_check : $@convention(method) (@guaranteed Array<X>) -> Bool
73+ %10 = apply %6(%5) : $@convention(method) (@guaranteed Array<X>) -> Bool
74+ end_borrow %5
75+ destroy_addr %1
76+ dealloc_stack %1 : $*Array<X>
77+ return %10 : $Bool
78+ }
79+
80+ // CHECK-LABEL: sil @test_alloc_stack_escapes :
5881// CHECK: [[F:%[0-9]+]] = function_ref @_is_native_X_no_type_check
5982// CHECK: [[R:%[0-9]+]] = apply [[F]]
6083// CHECK: return [[R]]
7598 return %10 : $Bool
7699}
77100
101+ // CHECK-LABEL: sil [ossa] @test_alloc_stack_escapes_ossa :
102+ // CHECK: [[F:%[0-9]+]] = function_ref @_is_native_X_no_type_check
103+ // CHECK: [[R:%[0-9]+]] = apply [[F]]
104+ // CHECK: return [[R]]
105+ sil [ossa] @test_alloc_stack_escapes_ossa : $@convention(thin) () -> Bool {
106+ bb0:
107+ %1 = alloc_stack $Array<X>
108+ %3 = function_ref @_array_X_init : $@convention(thin) () -> @owned Array<X>
109+ %4 = apply %3() : $@convention(thin) () -> @owned Array<X>
110+ store %4 to [init] %1 : $*Array<X>
111+
112+ %m1 = function_ref @_take_array_addr : $@convention(method) (@inout Array<X>) -> ()
113+ %m2 = apply %m1(%1) : $@convention(method) (@inout Array<X>) -> ()
114+
115+ %5 = load_borrow %1 : $*Array<X>
116+ %6 = function_ref @_is_native_X_no_type_check : $@convention(method) (@guaranteed Array<X>) -> Bool
117+ %10 = apply %6(%5) : $@convention(method) (@guaranteed Array<X>) -> Bool
118+ end_borrow %5
119+ destroy_addr %1
120+ dealloc_stack %1 : $*Array<X>
121+ return %10 : $Bool
122+ }
123+
78124// CHECK-LABEL: sil @test_alloc_write_unknown
79125// CHECK: [[F:%[0-9]+]] = function_ref @_is_native_X_no_type_check
80126// CHECK: [[R:%[0-9]+]] = apply [[F]]
0 commit comments