1
- // RUN: %target-swift-frontend %s -O -wmo -emit-sil -Xllvm -sil-disable-pass=DeadFunctionElimination -enforce-exclusivity=unchecked | %FileCheck %s
1
+ // RUN: %target-swift-frontend %s -O -wmo -emit-sil -Xllvm -sil-disable-pass=DeadFunctionElimination | %FileCheck %s
2
2
3
3
// case 1: class protocol -- should optimize
4
4
internal protocol SomeProtocol : class {
@@ -237,14 +237,24 @@ internal class OtherClass {
237
237
// CHECK-LABEL: sil hidden [noinline] @$s25sil_combine_protocol_conf10OtherClassC12doWorkStructSiyF : $@convention(method) (@guaranteed OtherClass) -> Int {
238
238
// CHECK: bb0([[ARG:%.*]] :
239
239
// CHECK: debug_value
240
+ // CHECK: [[STACK1:%.*]] = alloc_stack $PropProtocol
240
241
// CHECK: [[R1:%.*]] = ref_element_addr [[ARG]] : $OtherClass, #OtherClass.arg1
241
- // CHECK: [[O1:%.*]] = open_existential_addr immutable_access [[R1]] : $*PropProtocol to $*@opened("{{.*}}") PropProtocol
242
+ // CHECK: [[ACC1:%.*]] = begin_access [read] [dynamic] [no_nested_conflict] [[R1]]
243
+
244
+ // TODO: this copy_addr should be eliminated: rdar://problem/59345115
245
+ // CHECK: copy_addr [[ACC1]] to [initialization] [[STACK1]]
246
+ // CHECK: [[O1:%.*]] = open_existential_addr immutable_access [[STACK1]] : $*PropProtocol to $*@opened("{{.*}}") PropProtocol
242
247
// CHECK: [[U1:%.*]] = unchecked_addr_cast [[O1]] : $*@opened("{{.*}}") PropProtocol to $*PropClass
243
248
// CHECK: [[S1:%.*]] = struct_element_addr [[U1]] : $*PropClass, #PropClass.val
244
249
// CHECK: [[S11:%.*]] = struct_element_addr [[S1]] : $*Int, #Int._value
245
250
// CHECK: load [[S11]]
251
+ // CHECK: [[STACK2:%.*]] = alloc_stack $GenericPropProtocol
246
252
// CHECK: [[R2:%.*]] = ref_element_addr [[ARG]] : $OtherClass, #OtherClass.arg2
247
- // CHECK: [[O2:%.*]] = open_existential_addr immutable_access [[R2]] : $*GenericPropProtocol to $*@opened("{{.*}}") GenericPropProtocol
253
+ // CHECK: [[ACC2:%.*]] = begin_access [read] [dynamic] [no_nested_conflict] [[R2]]
254
+
255
+ // TODO: this copy_addr should be eliminated: rdar://problem/59345115
256
+ // CHECK: copy_addr [[ACC2]] to [initialization] [[STACK2]]
257
+ // CHECK: [[O2:%.*]] = open_existential_addr immutable_access [[STACK2]] : $*GenericPropProtocol to $*@opened("{{.*}}") GenericPropProtocol
248
258
// CHECK: [[W2:%.*]] = witness_method $@opened("{{.*}}") GenericPropProtocol, #GenericPropProtocol.val!getter.1 : <Self where Self : GenericPropProtocol> (Self) -> () -> Int, [[O2]] : $*@opened("{{.*}}") GenericPropProtocol : $@convention(witness_method: GenericPropProtocol) <τ_0_0 where τ_0_0 : GenericPropProtocol> (@in_guaranteed τ_0_0) -> Int
249
259
// CHECK: apply [[W2]]<@opened("{{.*}}") GenericPropProtocol>([[O2]]) : $@convention(witness_method: GenericPropProtocol) <τ_0_0 where τ_0_0 : GenericPropProtocol> (@in_guaranteed τ_0_0) -> Int
250
260
// CHECK: struct_extract
@@ -253,8 +263,13 @@ internal class OtherClass {
253
263
// CHECK: tuple_extract
254
264
// CHECK: tuple_extract
255
265
// CHECK: cond_fail
266
+ // CHECK: [[STACK4:%.*]] = alloc_stack $NestedPropProtocol
256
267
// CHECK: [[R4:%.*]] = ref_element_addr [[ARG]] : $OtherClass, #OtherClass.arg3
257
- // CHECK: [[O4:%.*]] = open_existential_addr immutable_access [[R4]] : $*NestedPropProtocol to $*@opened("{{.*}}") NestedPropProtocol
268
+ // CHECK: [[ACC4:%.*]] = begin_access [read] [dynamic] [no_nested_conflict] [[R4]]
269
+
270
+ // TODO: this copy_addr should be eliminated: rdar://problem/59345115
271
+ // CHECK: copy_addr [[ACC4]] to [initialization] [[STACK4]]
272
+ // CHECK: [[O4:%.*]] = open_existential_addr immutable_access [[STACK4]] : $*NestedPropProtocol to $*@opened("{{.*}}") NestedPropProtocol
258
273
// CHECK: [[U4:%.*]] = unchecked_addr_cast [[O4]] : $*@opened("{{.*}}") NestedPropProtocol to $*Outer.Inner
259
274
// CHECK: [[S4:%.*]] = struct_element_addr [[U4]] : $*Outer.Inner, #Outer.Inner.val
260
275
// CHECK: [[S41:%.*]] = struct_element_addr [[S4]] : $*Int, #Int._value
@@ -263,8 +278,13 @@ internal class OtherClass {
263
278
// CHECK: tuple_extract
264
279
// CHECK: tuple_extract
265
280
// CHECK: cond_fail
281
+ // CHECK: [[STACK5:%.*]] = alloc_stack $GenericNestedPropProtocol
266
282
// CHECK: [[R5:%.*]] = ref_element_addr [[ARG]] : $OtherClass, #OtherClass.arg4
267
- // CHECK: [[O5:%.*]] = open_existential_addr immutable_access [[R5]] : $*GenericNestedPropProtocol to $*@opened("{{.*}}") GenericNestedPropProtocol
283
+ // CHECK: [[ACC5:%.*]] = begin_access [read] [dynamic] [no_nested_conflict] [[R5]]
284
+
285
+ // TODO: this copy_addr should be eliminated: rdar://problem/59345115
286
+ // CHECK: copy_addr [[ACC5]] to [initialization] [[STACK5]]
287
+ // CHECK: [[O5:%.*]] = open_existential_addr immutable_access [[STACK5]] : $*GenericNestedPropProtocol to $*@opened("{{.*}}") GenericNestedPropProtocol
268
288
// CHECK: [[W5:%.*]] = witness_method $@opened("{{.*}}") GenericNestedPropProtocol, #GenericNestedPropProtocol.val!getter.1 : <Self where Self : GenericNestedPropProtocol> (Self) -> () -> Int, [[O5:%.*]] : $*@opened("{{.*}}") GenericNestedPropProtocol : $@convention(witness_method: GenericNestedPropProtocol) <τ_0_0 where τ_0_0 : GenericNestedPropProtocol> (@in_guaranteed τ_0_0) -> Int
269
289
// CHECK: apply [[W5]]<@opened("{{.*}}") GenericNestedPropProtocol>([[O5]]) : $@convention(witness_method: GenericNestedPropProtocol) <τ_0_0 where τ_0_0 : GenericNestedPropProtocol> (@in_guaranteed τ_0_0) -> Int
270
290
// CHECK: struct_extract
@@ -331,8 +351,13 @@ internal class OtherKlass {
331
351
// CHECK: bb0([[ARG:%.*]] :
332
352
// CHECK: debug_value
333
353
// CHECK: integer_literal
354
+ // CHECK: [[STACK1:%.*]] = alloc_stack $AGenericProtocol
334
355
// CHECK: [[R1:%.*]] = ref_element_addr [[ARG]] : $OtherKlass, #OtherKlass.arg2
335
- // CHECK: [[O1:%.*]] = open_existential_addr immutable_access [[R1]] : $*AGenericProtocol to $*@opened("{{.*}}") AGenericProtocol
356
+ // CHECK: [[ACC1:%.*]] = begin_access [read] [dynamic] [no_nested_conflict] [[R1]]
357
+
358
+ // TODO: this copy_addr should be eliminated: rdar://problem/59345115
359
+ // CHECK: copy_addr [[ACC1]] to [initialization] [[STACK1]]
360
+ // CHECK: [[O1:%.*]] = open_existential_addr immutable_access [[STACK1]] : $*AGenericProtocol to $*@opened("{{.*}}") AGenericProtocol
336
361
// CHECK: [[W1:%.*]] = witness_method $@opened("{{.*}}") AGenericProtocol, #AGenericProtocol.val!getter.1 : <Self where Self : AGenericProtocol> (Self) -> () -> Int, [[O1]] : $*@opened("{{.*}}") AGenericProtocol : $@convention(witness_method: AGenericProtocol) <τ_0_0 where τ_0_0 : AGenericProtocol> (@in_guaranteed τ_0_0) -> Int
337
362
// CHECK: apply [[W1]]<@opened("{{.*}}") AGenericProtocol>([[O1]]) : $@convention(witness_method: AGenericProtocol) <τ_0_0 where τ_0_0 : AGenericProtocol> (@in_guaranteed τ_0_0) -> Int
338
363
// CHECK: struct_extract
0 commit comments