@@ -103,7 +103,7 @@ public func testboxescapes() -> (() -> ()) {
103
103
}
104
104
105
105
// CHECK-LABEL: sil [noinline] @$s26allocboxtostack_localapply9testrecurSiyF :
106
- // CHECK: alloc_box ${ var Int } , var, name "x"
106
+ // CHECK: alloc_stack [var_decl] $Int , var, name "x"
107
107
// CHECK-LABEL: } // end sil function '$s26allocboxtostack_localapply9testrecurSiyF'
108
108
@inline ( never)
109
109
public func testrecur( ) -> Int {
@@ -146,14 +146,9 @@ public func testdfs1() -> Int {
146
146
return common ( )
147
147
}
148
148
149
- // Test to make sure we don't optimize the case when we have an inner common function call for multiple boxes.
150
- // We don't optimize this case now, because we don't have additional logic to correctly construct AppliesToSpecialize
151
- // Order of function calls constructed in PromotedOperands: bar innercommon local1 bas innercommon local2
152
- // AppliesToSpecialize should have the order: bar bas innercommon local1 local2
153
- // Since we don't maintain any tree like data structure with more info on the call tree, this is not possible to construct today
154
149
// CHECK-LABEL: sil [noinline] @$s26allocboxtostack_localapply8testdfs2SiyF :
155
- // CHECK: alloc_box ${ var Int } , var, name "x"
156
- // CHECK: alloc_box ${ var Int } , var, name "y"
150
+ // CHECK: alloc_stack [var_decl] $Int , var, name "x"
151
+ // CHECK: alloc_stack [var_decl] $Int , var, name "y"
157
152
// CHECK-LABEL:} // end sil function '$s26allocboxtostack_localapply8testdfs2SiyF'
158
153
@inline ( never)
159
154
public func testdfs2( ) -> Int {
@@ -182,3 +177,20 @@ public func testdfs2() -> Int {
182
177
return local1 ( ) + local2( )
183
178
}
184
179
180
+ // CHECK-LABEL: sil @$s26allocboxtostack_localapply15call2localfuncsSiyF :
181
+ // CHECK-NOT: alloc_box
182
+ // CHECK-LABEL:} // end sil function '$s26allocboxtostack_localapply15call2localfuncsSiyF'
183
+ public func call2localfuncs( ) -> Int {
184
+ var a1 = 1
185
+
186
+ @inline ( never)
187
+ func innerFunction( ) {
188
+ a1 += 1
189
+ }
190
+
191
+ innerFunction ( )
192
+ innerFunction ( )
193
+
194
+ return a1
195
+ }
196
+
0 commit comments