@@ -42,36 +42,36 @@ ArchetypeToArchetype(t: b, t2: f)
42
42
// CHECK-NOT: unconditional_checked_cast archetype_to_archetype
43
43
44
44
// x -> x where x is a class.
45
- // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast011ArchetypeToE0{{[_0-9a-zA-Z]*}}FAA1CC{{.*}}Tg5 : $@convention(thin) (@in_guaranteed C, @in_guaranteed C) -> @owned C {
45
+ // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast011ArchetypeToE0{{[_0-9a-zA-Z]*}}FAA1CC{{.*}}Tg5 : $@convention(thin) (@guaranteed C, @guaranteed C) -> @owned C {
46
46
// CHECK-NOT: unconditional_checked_cast archetype_to_archetype
47
47
48
48
// x -> y where x is not a class but y is.
49
- // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast011ArchetypeToE0{{[_0-9a-zA-Z]*}}FAA8NotUInt8V_AA1CCTg5 : $@convention(thin) (NotUInt8, @in_guaranteed C) -> @owned C {
49
+ // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast011ArchetypeToE0{{[_0-9a-zA-Z]*}}FAA8NotUInt8V_AA1CCTg5 : $@convention(thin) (NotUInt8, @guaranteed C) -> @owned C {
50
50
// CHECK-NOT: unconditional_checked_cast_addr
51
51
// CHECK-NOT: unconditional_checked_cast_addr
52
52
// CHECK: builtin "int_trap"
53
53
// CHECK-NOT: unconditional_checked_cast_addr
54
54
55
55
// y -> x where x is not a class but y is.
56
- // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast011ArchetypeToE0{{[_0-9a-zA-Z]*}}FAA1CC_AA8NotUInt8VTg5 : $@convention(thin) (@in_guaranteed C, NotUInt8) -> NotUInt8 {
56
+ // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast011ArchetypeToE0{{[_0-9a-zA-Z]*}}FAA1CC_AA8NotUInt8VTg5 : $@convention(thin) (@guaranteed C, NotUInt8) -> NotUInt8 {
57
57
// CHECK-NOT: unconditional_checked_cast archetype_to_archetype
58
58
// CHECK: builtin "int_trap"
59
59
// CHECK-NOT: unconditional_checked_cast archetype_to_archetype
60
60
61
61
// x -> y where x is a super class of y.
62
- // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast011ArchetypeToE0{{[_0-9a-zA-Z]*}}FAA1CC_AA1DCTg5 : $@convention(thin) (@in_guaranteed C, @in_guaranteed D) -> @owned D {
62
+ // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast011ArchetypeToE0{{[_0-9a-zA-Z]*}}FAA1CC_AA1DCTg5 : $@convention(thin) (@guaranteed C, @guaranteed D) -> @owned D {
63
63
// CHECK: [[STACK:%[0-9]+]] = alloc_stack $C
64
64
// TODO: This should be optimized to an unconditional_checked_cast without the need of alloc_stack: rdar://problem/24775038
65
65
// CHECK: unconditional_checked_cast_addr C in [[STACK]] : $*C to D in
66
66
67
67
// y -> x where x is a super class of y.
68
- // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast011ArchetypeToE0{{[_0-9a-zA-Z]*}}FAA1DC_AA1CCTg5 : $@convention(thin) (@in_guaranteed D, @in_guaranteed C) -> @owned C {
68
+ // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast011ArchetypeToE0{{[_0-9a-zA-Z]*}}FAA1DC_AA1CCTg5 : $@convention(thin) (@guaranteed D, @guaranteed C) -> @owned C {
69
69
// CHECK-NOT: unconditional_checked_cast archetype_to_archetype
70
70
// CHECK: upcast {{%[0-9]+}} : $D to $C
71
71
// CHECK-NOT: unconditional_checked_cast archetype_to_archetype
72
72
73
73
// x -> y where x and y are unrelated classes.
74
- // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast011ArchetypeToE0{{[_0-9a-zA-Z]*}}FAA1CC_AA1ECTg5 : $@convention(thin) (@in_guaranteed C, @in_guaranteed E) -> @owned E {
74
+ // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast011ArchetypeToE0{{[_0-9a-zA-Z]*}}FAA1CC_AA1ECTg5 : $@convention(thin) (@guaranteed C, @guaranteed E) -> @owned E {
75
75
// CHECK-NOT: unconditional_checked_cast archetype_to_archetype
76
76
// CHECK: builtin "int_trap"
77
77
// CHECK-NOT: unconditional_checked_cast archetype_to_archetype
@@ -117,11 +117,12 @@ ArchetypeToConcreteConvertUInt8(t: f)
117
117
// CHECK-NEXT: }
118
118
119
119
// x -> x where x is a class.
120
- // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast27ArchetypeToConcreteConvertC{{[_0-9a-zA-Z]*}}Tg5 : $@convention(thin) (@in_guaranteed C) -> @owned C {
121
- // CHECK: bb0
122
- // CHECK-NEXT: debug_value_addr %0
123
- // CHECK-NEXT: %2 = load %0 : $*C
124
- // CHECK: return %2
120
+ // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast27ArchetypeToConcreteConvertC{{[_0-9a-zA-Z]*}}Tg5 : $@convention(thin) (@guaranteed C) -> @owned C {
121
+ // CHECK: bb0([[ARG:%.*]] : $C)
122
+ // CHECK-NEXT: debug_value [[ARG]]
123
+ // CHECK-NEXT: debug_value [[ARG]]
124
+ // CHECK-NEXT: strong_retain [[ARG]]
125
+ // CHECK-NEXT: return [[ARG]]
125
126
126
127
// x -> y where x is a class but y is not.
127
128
// CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast27ArchetypeToConcreteConvertC{{[_0-9a-zA-Z]*}}FAA8NotUInt8V_Tg5
@@ -131,12 +132,12 @@ ArchetypeToConcreteConvertUInt8(t: f)
131
132
// CHECK-NEXT: }
132
133
133
134
// x -> y where x,y are classes and x is a super class of y.
134
- // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast27ArchetypeToConcreteConvertC{{[_0-9a-zA-Z]*}}FAA1DC_Tg5 : $@convention(thin) (@in_guaranteed D) -> @owned C {
135
- // CHECK: bb0
136
- // CHECK-NEXT: debug_value_addr %0
137
- // CHECK-NEXT: %2 = load %0 : $*D
138
- // CHECK: [[UC:%[0-9]+]] = upcast %2
139
- // CHECK: return [[UC]]
135
+ // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast27ArchetypeToConcreteConvertC{{[_0-9a-zA-Z]*}}FAA1DC_Tg5 : $@convention(thin) (@guaranteed D) -> @owned C {
136
+ // CHECK: bb0([[ARG:%.*]] : $D):
137
+ // CHECK: [[UPCAST:%.*]] = upcast [[ARG]] : $D to $C
138
+ // CHECK: strong_retain [[ARG]]
139
+ // CHECK: return [[UPCAST]]
140
+ // CHECK: } // end sil function '$S37specialize_unconditional_checked_cast27ArchetypeToConcreteConvertC{{[_0-9a-zA-Z]*}}FAA1DC_Tg5'
140
141
141
142
// x -> y where x,y are classes, but x is unrelated to y.
142
143
// CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast27ArchetypeToConcreteConvertC{{[_0-9a-zA-Z]*}}FAA1EC_Tg5
@@ -163,8 +164,8 @@ public func ArchetypeToConcreteConvertD<T>(t t: T) -> D {
163
164
ArchetypeToConcreteConvertD ( t: c)
164
165
165
166
// x -> y where x,y are classes and x is a sub class of y.
166
- // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast27ArchetypeToConcreteConvertD{{[_0-9a-zA-Z]*}}FAA1CC_Tg5 : $@convention(thin) (@in_guaranteed C) -> @owned D {
167
- // CHECK: bb0(%0 : $* C):
167
+ // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast27ArchetypeToConcreteConvertD{{[_0-9a-zA-Z]*}}FAA1CC_Tg5 : $@convention(thin) (@guaranteed C) -> @owned D {
168
+ // CHECK: bb0(%0 : $C):
168
169
// CHECK-DAG: [[STACK_C:%[0-9]+]] = alloc_stack $C
169
170
// CHECK-DAG: store {{.*}} to [[STACK_C]]
170
171
// CHECK-DAG: [[STACK_D:%[0-9]+]] = alloc_stack $D
@@ -210,7 +211,7 @@ ConcreteToArchetypeConvertUInt8(t: b, t2: f)
210
211
// CHECK-NEXT: return %0
211
212
212
213
// x -> y where x is not a class but y is a class.
213
- // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast31ConcreteToArchetypeConvertUInt8{{[_0-9a-zA-Z]*}}FAA1CC_Tg5 : $@convention(thin) (NotUInt8, @in_guaranteed C) -> @owned C {
214
+ // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast31ConcreteToArchetypeConvertUInt8{{[_0-9a-zA-Z]*}}FAA1CC_Tg5 : $@convention(thin) (NotUInt8, @guaranteed C) -> @owned C {
214
215
// CHECK: bb0
215
216
// CHECK: builtin "int_trap"
216
217
// CHECK: unreachable
@@ -235,8 +236,8 @@ ConcreteToArchetypeConvertC(t: c, t2: e)
235
236
236
237
237
238
// x -> x where x is a class.
238
- // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast27ConcreteToArchetypeConvertC{{[_0-9a-zA-Z]*}}Tg5 : $@convention(thin) (@guaranteed C, @in_guaranteed C) -> @owned C {
239
- // CHECK: bb0(%0 : $C, %1 : $* C):
239
+ // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast27ConcreteToArchetypeConvertC{{[_0-9a-zA-Z]*}}Tg5 : $@convention(thin) (@guaranteed C, @guaranteed C) -> @owned C {
240
+ // CHECK: bb0(%0 : $C, %1 : $C):
240
241
// CHECK: return %0
241
242
242
243
// x -> y where x is a class but y is not.
@@ -247,8 +248,8 @@ ConcreteToArchetypeConvertC(t: c, t2: e)
247
248
// CHECK-NEXT: }
248
249
249
250
// x -> y where x is a super class of y.
250
- // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast27ConcreteToArchetypeConvertC{{[_0-9a-zA-Z]*}}FAA1DC_Tg5 : $@convention(thin) (@guaranteed C, @in_guaranteed D) -> @owned D {
251
- // CHECK: bb0(%0 : $C, %1 : $* D):
251
+ // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast27ConcreteToArchetypeConvertC{{[_0-9a-zA-Z]*}}FAA1DC_Tg5 : $@convention(thin) (@guaranteed C, @guaranteed D) -> @owned D {
252
+ // CHECK: bb0(%0 : $C, %1 : $D):
252
253
// CHECK-DAG: [[STACK_C:%[0-9]+]] = alloc_stack $C
253
254
// CHECK-DAG: store %0 to [[STACK_C]]
254
255
// CHECK-DAG: [[STACK_D:%[0-9]+]] = alloc_stack $D
@@ -258,8 +259,8 @@ ConcreteToArchetypeConvertC(t: c, t2: e)
258
259
// CHECK: return [[LOAD]]
259
260
260
261
// x -> y where x and y are unrelated classes.
261
- // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast27ConcreteToArchetypeConvertC{{[_0-9a-zA-Z]*}}FAA1EC_Tg5 : $@convention(thin) (@guaranteed C, @in_guaranteed E) -> @owned E {
262
- // CHECK: bb0(%0 : $C, %1 : $* E):
262
+ // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast27ConcreteToArchetypeConvertC{{[_0-9a-zA-Z]*}}FAA1EC_Tg5 : $@convention(thin) (@guaranteed C, @guaranteed E) -> @owned E {
263
+ // CHECK: bb0(%0 : $C, %1 : $E):
263
264
// CHECK-NEXT: builtin "int_trap"
264
265
// CHECK-NEXT: unreachable
265
266
// CHECK-NEXT: }
@@ -272,8 +273,8 @@ public func ConcreteToArchetypeConvertD<T>(t t: D, t2: T) -> T {
272
273
ConcreteToArchetypeConvertD ( t: d, t2: c)
273
274
274
275
// x -> y where x is a subclass of y.
275
- // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast27ConcreteToArchetypeConvertD{{[_0-9a-zA-Z]*}}FAA1CC_Tg5 : $@convention(thin) (@guaranteed D, @in_guaranteed C) -> @owned C {
276
- // CHECK: bb0(%0 : $D, %1 : $* C):
276
+ // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast27ConcreteToArchetypeConvertD{{[_0-9a-zA-Z]*}}FAA1CC_Tg5 : $@convention(thin) (@guaranteed D, @guaranteed C) -> @owned C {
277
+ // CHECK: bb0(%0 : $D, %1 : $C):
277
278
// CHECK-DAG: [[UC:%[0-9]+]] = upcast %0
278
279
// CHECK: return [[UC]]
279
280
@@ -293,12 +294,12 @@ SuperToArchetypeC(c: c, t: b)
293
294
294
295
295
296
// x -> x where x is a class.
296
- // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast17SuperToArchetypeC{{[_0-9a-zA-Z]*}}Tg5 : $@convention(thin) (@guaranteed C, @in_guaranteed C) -> @owned C {
297
- // CHECK: bb0(%0 : $C, %1 : $* C):
297
+ // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast17SuperToArchetypeC{{[_0-9a-zA-Z]*}}Tg5 : $@convention(thin) (@guaranteed C, @guaranteed C) -> @owned C {
298
+ // CHECK: bb0(%0 : $C, %1 : $C):
298
299
// CHECK: return %0
299
300
300
301
// x -> y where x is a super class of y.
301
- // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast17SuperToArchetypeC{{[_0-9a-zA-Z]*}}FAA1DC_Tg5 : $@convention(thin) (@guaranteed C, @in_guaranteed D) -> @owned D {
302
+ // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast17SuperToArchetypeC{{[_0-9a-zA-Z]*}}FAA1DC_Tg5 : $@convention(thin) (@guaranteed C, @guaranteed D) -> @owned D {
302
303
// CHECK: bb0
303
304
// CHECK: unconditional_checked_cast_addr C in
304
305
@@ -319,13 +320,13 @@ SuperToArchetypeD(d: d, t: d)
319
320
320
321
// *NOTE* The frontend is smart enough to turn this into an upcast. When this
321
322
// test is converted to SIL, this should be fixed appropriately.
322
- // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast17SuperToArchetypeD{{[_0-9a-zA-Z]*}}FAA1CC_Tg5 : $@convention(thin) (@guaranteed D, @in_guaranteed C) -> @owned C {
323
+ // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast17SuperToArchetypeD{{[_0-9a-zA-Z]*}}FAA1CC_Tg5 : $@convention(thin) (@guaranteed D, @guaranteed C) -> @owned C {
323
324
// CHECK-NOT: unconditional_checked_cast super_to_archetype
324
325
// CHECK: upcast
325
326
// CHECK-NOT: unconditional_checked_cast super_to_archetype
326
327
327
- // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast17SuperToArchetypeD{{[_0-9a-zA-Z]*}}Tg5 : $@convention(thin) (@guaranteed D, @in_guaranteed D) -> @owned D {
328
- // CHECK: bb0(%0 : $D, %1 : $* D):
328
+ // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast17SuperToArchetypeD{{[_0-9a-zA-Z]*}}Tg5 : $@convention(thin) (@guaranteed D, @guaranteed D) -> @owned D {
329
+ // CHECK: bb0(%0 : $D, %1 : $D):
329
330
// CHECK: return %0
330
331
331
332
//////////////////////////////
@@ -338,7 +339,7 @@ public func ExistentialToArchetype<T>(o o : AnyObject, t : T) -> T {
338
339
}
339
340
340
341
// AnyObject -> Class.
341
- // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast22ExistentialToArchetype{{[_0-9a-zA-Z]*}}FAA1CC_Tg5 : $@convention(thin) (@guaranteed AnyObject, @in_guaranteed C) -> @owned C {
342
+ // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast22ExistentialToArchetype{{[_0-9a-zA-Z]*}}FAA1CC_Tg5 : $@convention(thin) (@guaranteed AnyObject, @guaranteed C) -> @owned C {
342
343
// CHECK: unconditional_checked_cast_addr AnyObject in {{%.*}} : $*AnyObject to C
343
344
344
345
// AnyObject -> Non Class (should always fail)
@@ -348,8 +349,8 @@ public func ExistentialToArchetype<T>(o o : AnyObject, t : T) -> T {
348
349
// CHECK: return
349
350
350
351
// AnyObject -> AnyObject
351
- // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast22ExistentialToArchetype{{[_0-9a-zA-Z]*}}yXl{{.*}}Tg5 : $@convention(thin) (@guaranteed AnyObject, @in_guaranteed AnyObject) -> @owned AnyObject {
352
- // CHECK: bb0(%0 : $AnyObject, %1 : $* AnyObject):
352
+ // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast22ExistentialToArchetype{{[_0-9a-zA-Z]*}}yXl{{.*}}Tg5 : $@convention(thin) (@guaranteed AnyObject, @guaranteed AnyObject) -> @owned AnyObject {
353
+ // CHECK: bb0(%0 : $AnyObject, %1 : $AnyObject):
353
354
// CHECK: return %0
354
355
355
356
ExistentialToArchetype ( o: o, t: c)
@@ -360,12 +361,12 @@ ExistentialToArchetype(o: o, t: o)
360
361
// value cast. We could do the promotion, but the optimizer would need
361
362
// to insert the Optional unwrapping logic before the cast.
362
363
//
363
- // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast15genericDownCastyq_x_q_mtr0_lFAA1CCSg_AA1DCTg5 : $@convention(thin) (@in_guaranteed Optional<C>, @thick D.Type) -> @owned D {
364
- // CHECK: bb0(%0 : $* Optional<C>, %1 : $@thick D.Type):
364
+ // CHECK-LABEL: sil shared [noinline] @$S37specialize_unconditional_checked_cast15genericDownCastyq_x_q_mtr0_lFAA1CCSg_AA1DCTg5 : $@convention(thin) (@guaranteed Optional<C>, @thick D.Type) -> @owned D {
365
+ // CHECK: bb0(%0 : $Optional<C>, %1 : $@thick D.Type):
365
366
// CHECK-DAG: [[STACK_D:%[0-9]+]] = alloc_stack $D
366
367
// CHECK-DAG: [[STACK_C:%[0-9]+]] = alloc_stack $Optional<C>
367
- // CHECK-DAG: %5 = load %0 : $*Optional<C>
368
- // CHECK-DAG: store %5 to [[STACK_C ]]
368
+ // CHECK-DAG: store [[ARG]] to [[STACK_C]]
369
+ // CHECK-DAG: retain_value [[ARG ]]
369
370
// TODO: This should be optimized to an unconditional_checked_cast without the need of alloc_stack: rdar://problem/24775038
370
371
// CHECK-DAG: unconditional_checked_cast_addr Optional<C> in [[STACK_C]] : $*Optional<C> to D in [[STACK_D]] : $*D
371
372
// CHECK-DAG: [[LOAD:%[0-9]+]] = load [[STACK_D]]
0 commit comments