@@ -34,14 +34,17 @@ sil [ossa] [transparent] @partial_apply_on_stack_nesting_violator : $@convention
3434
3535// Verify that when inlining partial_apply_on_stack_nesting_violator, the stack
3636// nesting of the on_stack closures is fixed.
37- // CHECK-LABEL: sil [no_locks] [perf_constraint] @test_inline_stack_violating_ossa_func : {{.*}} {
37+ //
38+ // NON_OSSA: stack nesting is not fixed until after OSSA lowering. These tests only run mandatory optimization.
39+ //
40+ // CHECK-LABEL: sil [no_locks] [perf_constraint] [ossa] @test_inline_stack_violating_ossa_func : {{.*}} {
3841// CHECK: [[PAABLE:%[^,]+]] = function_ref @paable
3942// CHECK: [[FIRST:%[^,]+]] = partial_apply [callee_guaranteed] [on_stack] [[PAABLE]]
4043// CHECK: [[SECOND:%[^,]+]] = partial_apply [callee_guaranteed] [on_stack] [[PAABLE]]
41- // CHECK: dealloc_stack [[SECOND]]
42- // CHECK: dealloc_stack [[FIRST]]
44+ // NON_OSSA: dealloc_stack [[SECOND]]
45+ // NON_OSSA: dealloc_stack [[FIRST]]
4346// CHECK-LABEL: } // end sil function 'test_inline_stack_violating_ossa_func'
44- sil [no_locks] @test_inline_stack_violating_ossa_func : $@convention(thin) () -> () {
47+ sil [no_locks] [ossa] @test_inline_stack_violating_ossa_func : $@convention(thin) () -> () {
4548 %callee = function_ref @partial_apply_on_stack_nesting_violator : $@convention(thin) <T> () -> ()
4649 apply %callee<Builtin.Int64>() : $@convention(thin) <T> () -> ()
4750 %retval = tuple ()
6972 return %retval : $Builtin.Int64
7073}
7174
72- // CHECK-LABEL: sil [no_allocation] [perf_constraint] @deserialize_and_inline_after_devirtualize
75+ // CHECK-LABEL: sil [no_allocation] [perf_constraint] [ossa] @deserialize_and_inline_after_devirtualize
7376// CHECK-NOT: apply
7477// CHECK: } // end sil function 'deserialize_and_inline_after_devirtualize'
75- sil [no_allocation] @deserialize_and_inline_after_devirtualize : $@convention(thin) (@in Int) -> () {
78+ sil [no_allocation] [ossa] @deserialize_and_inline_after_devirtualize : $@convention(thin) (@in Int) -> () {
7679bb0(%0 : $*Int):
7780 %1 = metatype $@thick Int.Type
7881 %2 = witness_method $Int, #Comparable."<" : <Self where Self : Comparable> (Self.Type) -> (Self, Self) -> Bool : $@convention(witness_method: Comparable) <τ_0_0 where τ_0_0 : Comparable> (@in_guaranteed τ_0_0, @in_guaranteed τ_0_0, @thick τ_0_0.Type) -> Bool
@@ -95,25 +98,11 @@ bb0(%0 : $Builtin.Int32):
9598 return %2 : $Builtin.Int32
9699}
97100
98- // CHECK-LABEL: sil [no_allocation] [perf_constraint] @dont_do_dead_alloc_elimination_on_non_ossa
99- // CHECK: alloc_stack
100- // CHECK-NOT: load
101- // CHECK: return %0
102- // CHECK: } // end sil function 'dont_do_dead_alloc_elimination_on_non_ossa'
103- sil [no_allocation] @dont_do_dead_alloc_elimination_on_non_ossa : $@convention(thin) (Builtin.Int32) -> Builtin.Int32 {
104- bb0(%0 : $Builtin.Int32):
105- %1 = alloc_stack $Builtin.Int32
106- store %0 to %1 : $*Builtin.Int32
107- %2 = load %1 : $*Builtin.Int32
108- dealloc_stack %1 : $*Builtin.Int32
109- return %2 : $Builtin.Int32
110- }
111-
112- // CHECK-LABEL: sil [no_allocation] [perf_constraint] @dead_metatype :
101+ // CHECK-LABEL: sil [no_allocation] [perf_constraint] [ossa] @dead_metatype :
113102// CHECK-NOT: metatype
114103// CHECK-NOT: debug_value
115104// CHECK: } // end sil function 'dead_metatype'
116- sil [no_allocation] @dead_metatype : $@convention(thin) () -> () {
105+ sil [no_allocation] [ossa] @dead_metatype : $@convention(thin) () -> () {
117106bb0:
118107 %0 = metatype $@thick Int.Type
119108 debug_value %0 : $@thick Int.Type
@@ -132,47 +121,47 @@ sil_witness_table public_external [serialized] Int: Comparable module Swift {
132121 method #Comparable."<": <Self where Self : Comparable> (Self.Type) -> (Self, Self) -> Bool : @$sSiSLsSL1loiySbx_xtFZTW
133122}
134123
135- sil @get_int_value : $@convention(thin) () -> Int32 {
124+ sil [ossa] @get_int_value : $@convention(thin) () -> Int32 {
136125bb0:
137126 %0 = integer_literal $Builtin.Int32, 10
138127 %1 = struct $Int32 (%0 : $Builtin.Int32)
139128 return %1 : $Int32
140129}
141130
142- // CHECK-LABEL: sil [global_init_once_fn] [no_locks] [perf_constraint] @globalinit_inline_into_init :
131+ // CHECK-LABEL: sil [global_init_once_fn] [no_locks] [perf_constraint] [ossa] @globalinit_inline_into_init :
143132// CHECK-NOT: apply
144133// CHECK: } // end sil function 'globalinit_inline_into_init'
145- sil [global_init_once_fn] [no_locks] @globalinit_inline_into_init : $@convention(c) () -> () {
134+ sil [global_init_once_fn] [no_locks] [ossa] @globalinit_inline_into_init : $@convention(c) () -> () {
146135bb0:
147136 alloc_global @g1
148137 %1 = global_addr @g1 : $*Int32
149138 %2 = function_ref @get_int_value : $@convention(thin) () -> Int32
150139 %3 = apply %2() : $@convention(thin) () -> Int32
151- store %3 to %1 : $*Int32
140+ store %3 to [trivial] %1 : $*Int32
152141 %6 = tuple ()
153142 return %6 : $()
154143}
155144
156- // CHECK-LABEL: sil [serialized] [global_init_once_fn] [no_locks] [perf_constraint] @globalinit_dont_inline_non_inlinable_into_inlinable :
145+ // CHECK-LABEL: sil [serialized] [global_init_once_fn] [no_locks] [perf_constraint] [ossa] @globalinit_dont_inline_non_inlinable_into_inlinable :
157146// CHECK: apply
158147// CHECK: } // end sil function 'globalinit_dont_inline_non_inlinable_into_inlinable'
159- sil [serialized] [global_init_once_fn] [no_locks] @globalinit_dont_inline_non_inlinable_into_inlinable : $@convention(c) () -> () {
148+ sil [serialized] [global_init_once_fn] [no_locks] [ossa] @globalinit_dont_inline_non_inlinable_into_inlinable : $@convention(c) () -> () {
160149bb0:
161150 alloc_global @g2
162151 %1 = global_addr @g2 : $*Int32
163152 %2 = function_ref @get_int_value : $@convention(thin) () -> Int32
164153 %3 = apply %2() : $@convention(thin) () -> Int32
165- store %3 to %1 : $*Int32
154+ store %3 to [trivial] %1 : $*Int32
166155 %6 = tuple ()
167156 return %6 : $()
168157}
169158
170159// Check that we don't crash on global init-once declarations.
171160
172161// CHECK-LABEL: sil [global_init_once_fn] [no_locks] @external_global_init_once : $@convention(c) () -> ()
173- sil [global_init_once_fn] [no_locks] @external_global_init_once : $@convention(c) () -> ()
162+ sil [global_init_once_fn] [no_locks] [ossa] @external_global_init_once : $@convention(c) () -> ()
174163
175- sil @yield_int_value : $@convention(thin) @yield_once () -> (@yields Int32) {
164+ sil [ossa] @yield_int_value : $@convention(thin) @yield_once () -> (@yields Int32) {
176165bb0:
177166 %0 = integer_literal $Builtin.Int32, 10
178167 %1 = struct $Int32 (%0 : $Builtin.Int32)
@@ -184,21 +173,21 @@ bb2:
184173 unwind
185174}
186175
187- // CHECK-LABEL: sil [no_locks] [perf_constraint] @inline_begin_apply :
176+ // CHECK-LABEL: sil [no_locks] [perf_constraint] [ossa] @inline_begin_apply :
188177// CHECK-NOT: begin_apply
189178// CHECK: } // end sil function 'inline_begin_apply'
190- sil [no_locks] @inline_begin_apply : $@convention(thin) () -> Int32 {
179+ sil [no_locks] [ossa] @inline_begin_apply : $@convention(thin) () -> Int32 {
191180bb0:
192181 %0 = function_ref @yield_int_value : $@convention(thin) @yield_once () -> (@yields Int32)
193182 (%1, %2) = begin_apply %0() : $@convention(thin) @yield_once () -> (@yields Int32)
194183 end_apply %2 as $()
195184 return %1 : $Int32
196185}
197186
198- // CHECK-LABEL: sil [no_locks] [perf_constraint] @dont_inline_begin_apply :
187+ // CHECK-LABEL: sil [no_locks] [perf_constraint] [ossa] @dont_inline_begin_apply :
199188// CHECK: begin_apply
200189// CHECK: } // end sil function 'dont_inline_begin_apply'
201- sil [no_locks] @dont_inline_begin_apply : $@convention(thin) () -> Int32 {
190+ sil [no_locks] [ossa] @dont_inline_begin_apply : $@convention(thin) () -> Int32 {
202191bb0:
203192 %0 = function_ref @yield_int_value : $@convention(thin) @yield_once () -> (@yields Int32)
204193 (%1, %2) = begin_apply %0() : $@convention(thin) @yield_once () -> (@yields Int32)
0 commit comments