@@ -172,43 +172,73 @@ print(prevPkgData)
172
172
173
173
//--- Lib.swift
174
174
175
- // FIXME: handle struct_element_addr %field in resilient mode; requires non-resilience in SIL verify.
176
- // CHECK-RES-NOT: s3Lib9PubStructV6fooVarSivg
177
- // CHECK-RES-NOT: s3Lib9PkgStructV6fooVarSivg
178
-
179
- // FIXME: handle `struct $PubStruct` in resilient mode; PubStruct is by-address, so fails in IsLodableOrOpaque check.
180
- // CHECK-RES-NOT: s3Lib9PubStructV6fooVarSivs
181
- // CHECK-RES-NOT: s3Lib9PkgStructV6fooVarSivs
182
-
183
175
public struct PubStruct {
176
+ // PubStruct.foovar.getter
177
+ // CHECK-RES-DAG: sil [serialized] [canonical] @$s3Lib9PubStructV6fooVarSivg : $@convention(method) (@in_guaranteed PubStruct) -> Int {
184
178
// CHECK-NONRES-DAG: sil [transparent] [serialized] [canonical] [ossa] @$s3Lib9PubStructV6fooVarSivg : $@convention(method) (PubStruct) -> Int
185
- // CHECK-NONRES-DAG: sil [transparent] [serialized] [canonical] [ossa] @$s3Lib9PubStructV6fooVarSivM : $@yield_once @convention(method) (@inout PubStruct) -> @yields @inout Int {
179
+ // CHECK-RES-DAG: [[FIELD:%.*]] = struct_element_addr %0 : $*PubStruct, #PubStruct.fooVar
180
+ // CHECK-RES-DAG: load [[FIELD]] : $*Int
181
+ // CHECK-NONRES-DAG = struct_extract %0 : $PubStruct, #PubStruct.fooVar
182
+
183
+ // PubStruct.foovar.setter
184
+ // CHECK-RES-DAG: sil [serialized] [canonical] @$s3Lib9PubStructV6fooVarSivs : $@convention(method) (Int, @inout PubStruct) -> () {
186
185
// CHECK-NONRES-DAG: sil [transparent] [serialized] [canonical] [ossa] @$s3Lib9PubStructV6fooVarSivs : $@convention(method) (Int, @inout PubStruct) -> () {
186
+
187
+ /// NOTE: `struct $PubStruct` in [serialized] function is legal only if package serialization is enabled.
188
+ // CHECK-COMMON-DAG: [[FIELD:%.*]] = struct $PubStruct
189
+ // CHECK-RES-DAG: store [[FIELD]] to {{.*}} : $*PubStruct
190
+ // CHECK-NONRES-DAG: store [[FIELD]] to [trivial] {{.*}} : $*PubStruct
191
+
192
+ // PubStruct.foovar.modify
193
+ // CHECK-RES-DAG: sil [serialized] [canonical] @$s3Lib9PubStructV6fooVarSivM : $@yield_once @convention(method) (@inout PubStruct) -> @yields @inout Int {
194
+ // CHECK-NONRES-DAG: sil [transparent] [serialized] [canonical] [ossa] @$s3Lib9PubStructV6fooVarSivM : $@yield_once @convention(method) (@inout PubStruct) -> @yields @inout Int {
195
+ // CHECK-COMMON-DAG: [[FIELD:%.*]] = struct_element_addr %0 : $*PubStruct, #PubStruct.fooVar
196
+ // CHECK-COMMON-DAG: yield [[FIELD]]
187
197
public var fooVar : Int
188
198
189
199
public init ( _ arg: Int ) {
200
+ // CHECK-RES-DAG: sil [serialized] [canonical] @$s3Lib9PubStructVyACSicfC : $@convention(method) (Int, @thin PubStruct.Type) -> @out PubStruct {
190
201
// CHECK-NONRES-DAG: sil [serialized] [canonical] @$s3Lib9PubStructVyACSicfC : $@convention(method) (Int, @thin PubStruct.Type) -> PubStruct {
202
+ // CHECK-COMMON-DAG: [[FIELD:%.*]] = struct $PubStruct
203
+ // CHECK-RES-DAG: store [[FIELD]] to %0 : $*PubStruct
204
+ // CHECK-NONRES-DAG: return [[FIELD]] : $PubStruct
191
205
fooVar = arg
192
206
}
193
207
public func f( ) {
208
+ // CHECK-RES-DAG: sil [serialized] [canonical] @$s3Lib9PubStructV1fyyF : $@convention(method) (@in_guaranteed PubStruct) -> () {
194
209
// CHECK-NONRES-DAG: sil [serialized] [canonical] @$s3Lib9PubStructV1fyyF : $@convention(method) (PubStruct) -> () {
195
210
print ( fooVar)
196
211
}
197
212
}
198
213
199
214
public func runPub( _ arg: PubStruct ) {
215
+ // CHECK-RES-DAG: sil [serialized] [canonical] @$s3Lib6runPubyyAA0C6StructVF : $@convention(thin) (@in_guaranteed PubStruct) -> () {
200
216
// CHECK-NONRES-DAG: sil [serialized] [canonical] @$s3Lib6runPubyyAA0C6StructVF : $@convention(thin) (PubStruct) -> () {
201
217
print ( arg)
202
218
}
203
219
204
220
@frozen
205
221
public struct FrPubStruct {
206
- // CHECK-COMMON-DAG: sil [transparent] [serialized] [canonical] [ossa] @$s3Lib11FrPubStructV6fooVarSivM : $@yield_once @convention(method) (@inout FrPubStruct) -> @yields @inout Int {
222
+ // FrPubStruct.fooVar.getter
207
223
// CHECK-COMMON-DAG: sil [transparent] [serialized] [canonical] [ossa] @$s3Lib11FrPubStructV6fooVarSivg : $@convention(method) (FrPubStruct) -> Int {
224
+ // CHECK-COMMON-DAG: [[FIELD:%.*]] = struct_extract %0 : $FrPubStruct, #FrPubStruct.fooVar
225
+ // CHECK-COMMON-DAG: return [[FIELD]] : $Int
226
+
227
+ // FrPubStruct.fooVar.setter
208
228
// CHECK-COMMON-DAG: sil [transparent] [serialized] [canonical] [ossa] @$s3Lib11FrPubStructV6fooVarSivs : $@convention(method) (Int, @inout FrPubStruct) -> () {
229
+ // CHECK-COMMON-DAG: [[FIELD:%.*]] = struct $FrPubStruct
230
+ // CHECK-COMMON-DAG: store [[FIELD]] to [trivial] {{.*}} : $*FrPubStruct
231
+
232
+ // FrPubStruct.fooVar.modify
233
+ // CHECK-COMMON-DAG: sil [transparent] [serialized] [canonical] [ossa] @$s3Lib11FrPubStructV6fooVarSivM : $@yield_once @convention(method) (@inout FrPubStruct) -> @yields @inout Int {
234
+ // CHECK-COMMON-DAG: [[FIELD:%.*]] = struct_element_addr %0 : $*FrPubStruct, #FrPubStruct.fooVar
235
+ // CHECK-COMMON-DAG: yield [[FIELD]]
209
236
public var fooVar : Int
237
+
210
238
public init ( _ arg: Int ) {
211
239
// CHECK-COMMON-DAG: sil [serialized] [canonical] @$s3Lib11FrPubStructVyACSicfC : $@convention(method) (Int, @thin FrPubStruct.Type) -> FrPubStruct {
240
+ // CHECK-COMMON-DAG: [[FIELD:%.*]] = struct $FrPubStruct
241
+ // CHECK-COMMON-DAG: return [[FIELD]] : $FrPubStruct
212
242
fooVar = arg
213
243
}
214
244
public func f( ) {
@@ -222,25 +252,44 @@ public func runFrPub(_ arg: FrPubStruct) {
222
252
}
223
253
224
254
package struct PkgStruct {
225
- // fooVar.getter
255
+ // PkgStruct.fooVar.getter
256
+ // CHECK-RES-DAG: sil package [serialized] [canonical] @$s3Lib9PkgStructV6fooVarSivg : $@convention(method) (@in_guaranteed PkgStruct) -> Int {
226
257
// CHECK-NONRES-DAG: sil package [transparent] [serialized] [canonical] [ossa] @$s3Lib9PkgStructV6fooVarSivg : $@convention(method) (PkgStruct) -> Int {
227
- // fooVar.modify
228
- // CHECK-NONRES-DAG: sil package [transparent] [serialized] [canonical] [ossa] @$s3Lib9PkgStructV6fooVarSivM : $@yield_once @convention(method) (@inout PkgStruct) -> @yields @inout Int {
229
- // fooVar.setter
258
+ // CHECK-RES-DAG: [[FIELD:%.*]] = struct_element_addr %0 : $*PkgStruct, #PkgStruct.fooVar
259
+ // CHECK-RES-DAG: load [[FIELD]] : $*Int
260
+ // CHECK-NONRES-DAG = struct_extract %0 : $PkgStruct, #PkgStruct.fooVar
261
+
262
+ // PkgStruct.fooVar.setter
263
+ // CHECK-RES-DAG: sil package [serialized] [canonical] @$s3Lib9PkgStructV6fooVarSivs : $@convention(method) (Int, @inout PkgStruct) -> () {
230
264
// CHECK-NONRES-DAG: sil package [transparent] [serialized] [canonical] [ossa] @$s3Lib9PkgStructV6fooVarSivs : $@convention(method) (Int, @inout PkgStruct) -> () {
265
+ // CHECK-COMMON-DAG: [[FIELD:%.*]] = struct $PkgStruct
266
+ // CHECK-RES-DAG: store [[FIELD]] to {{.*}} : $*PkgStruct
267
+ // CHECK-NONRES-DAG: store [[FIELD]] to [trivial] {{.*}} : $*PkgStruct
268
+
269
+ // PkgStruct.fooVar.modify
270
+ // CHECK-RES-DAG: sil package [serialized] [canonical] @$s3Lib9PkgStructV6fooVarSivM : $@yield_once @convention(method) (@inout PkgStruct) -> @yields @inout Int {
271
+ // CHECK-NONRES-DAG: sil package [transparent] [serialized] [canonical] [ossa] @$s3Lib9PkgStructV6fooVarSivM : $@yield_once @convention(method) (@inout PkgStruct) -> @yields @inout Int {
272
+ // CHECK-COMMON-DAG: [[FIELD:%.*]] = struct_element_addr %0 : $*PkgStruct, #PkgStruct.fooVar
273
+ // CHECK-COMMON-DAG: yield [[FIELD]]
231
274
package var fooVar : Int
232
275
233
276
package init ( _ arg: Int ) {
277
+ // CHECK-RES-DAG: sil package [serialized] [canonical] @$s3Lib9PkgStructVyACSicfC : $@convention(method) (Int, @thin PkgStruct.Type) -> @out PkgStruct {
234
278
// CHECK-NONRES-DAG: sil package [serialized] [canonical] @$s3Lib9PkgStructVyACSicfC : $@convention(method) (Int, @thin PkgStruct.Type) -> PkgStruct {
279
+ // CHECK-COMMON-DAG: [[FIELD:%.*]] = struct $PkgStruct
280
+ // CHECK-RES-DAG: store [[FIELD]] to %0 : $*PkgStruct
281
+ // CHECK-NONRES-DAG: return [[FIELD]] : $PkgStruct
235
282
fooVar = arg
236
283
}
237
284
package func f( ) {
285
+ // CHECK-RES-DAG: sil package [serialized] [canonical] @$s3Lib9PkgStructV1fyyF : $@convention(method) (@in_guaranteed PkgStruct) -> () {
238
286
// CHECK-NONRES-DAG: sil package [serialized] [canonical] @$s3Lib9PkgStructV1fyyF : $@convention(method) (PkgStruct) -> () {
239
287
print ( fooVar)
240
288
}
241
289
}
242
290
243
291
package func runPkg( _ arg: PkgStruct ) {
292
+ // CHECK-RES-DAG: sil package [serialized] [canonical] @$s3Lib6runPkgyyAA0C6StructVF : $@convention(thin) (@in_guaranteed PkgStruct) -> () {
244
293
// CHECK-NONRES-DAG: sil package [serialized] [canonical] @$s3Lib6runPkgyyAA0C6StructVF : $@convention(thin) (PkgStruct) -> () {
245
294
print ( arg)
246
295
}
0 commit comments