@@ -25,6 +25,10 @@ enum MyBool{
25
25
class MyClass {
26
26
}
27
27
28
+ struct MyInt {
29
+ @_hasStorage var _value: Builtin.Int64
30
+ }
31
+
28
32
// CHECK-LABEL: sil @clone_switch_enum_exit :
29
33
// CHECK: bb1:
30
34
// CHECK: [[FUNC1:%.*]] = function_ref @arrayPropertyIsNative
@@ -264,7 +268,7 @@ bb11: // Non-exit dominated by bb1
264
268
}
265
269
266
270
class Klass {
267
- var val: Optional<Int >
271
+ var val: Optional<MyInt >
268
272
}
269
273
270
274
struct WrapperStruct {
@@ -273,6 +277,13 @@ struct WrapperStruct {
273
277
274
278
sil @use_klass : $@convention(thin) (@in_guaranteed Klass) -> ()
275
279
280
+ // Test verifier does not fire for address phis
281
+ // Check if array property opt is kicking in by looking for 2 calls to hoistableIsNativeTypeChecked
282
+ // CHECK-LABEL: sil @test_sink_address_proj :
283
+ // [[FUNC:%.*]] = function_ref @arrayPropertyIsNative : $@convention(method) (@owned MyArray<MyClass>) -> Bool
284
+ // apply [[FUNC]]
285
+ // apply [[FUNC]]
286
+ // CHECK-LABEL: } // end sil function 'test_sink_address_proj'
276
287
sil @test_sink_address_proj : $@convention(thin) (@inout MyArray<MyClass>, @in_guaranteed WrapperStruct) -> () {
277
288
bb0(%0 : $*MyArray<MyClass>, %1 : $*WrapperStruct):
278
289
%3 = load %0 : $*MyArray<MyClass>
@@ -306,10 +317,17 @@ bb6:
306
317
}
307
318
308
319
sil [_semantics "array.props.isNativeTypeChecked"] @hoistableIsNativeTypeChecked : $@convention(method) (@guaranteed Array<Klass>) -> Bool
309
- sil [_semantics "array.get_element"] @getElement : $@convention(method) (Int, Bool, _DependenceToken, @guaranteed Array<Klass>) -> @owned Klass
310
- sil [_semantics "array.get_count"] @getCount : $@convention(method) (@guaranteed Array<Klass>) -> Int
311
-
312
- sil hidden @test_array_prop_opt : $@convention(thin) (@guaranteed Optional<Array<Klass>>) -> Int {
320
+ sil [_semantics "array.get_element"] @getElement : $@convention(method) (MyInt, Bool, _DependenceToken, @guaranteed Array<Klass>) -> @owned Klass
321
+ sil [_semantics "array.get_count"] @getCount : $@convention(method) (@guaranteed Array<Klass>) -> MyInt
322
+
323
+ // Test verifier does not fire for address phis
324
+ // Check if array property opt is kicking in by looking for 2 calls to hoistableIsNativeTypeChecked
325
+ // CHECK-LABEL: sil @test_array_prop_opt :
326
+ // [[FUNC:%.*]] = function_ref @hoistableIsNativeTypeChecked : $@convention(method) (@guaranteed Array<Klass>) -> Bool
327
+ // apply [[FUNC]]
328
+ // apply [[FUNC]]
329
+ // CHECK-LABEL: } // end sil function 'test_array_prop_opt'
330
+ sil @test_array_prop_opt : $@convention(thin) (@guaranteed Optional<Array<Klass>>) -> MyInt {
313
331
bb0(%0 : $Optional<Array<Klass>>):
314
332
%4 = integer_literal $Builtin.Int64, 0
315
333
switch_enum %0 : $Optional<Array<Klass>>, case #Optional.some!enumelt: bb2, case #Optional.none!enumelt: bb1
@@ -318,11 +336,11 @@ bb1:
318
336
br bb12(%4 : $Builtin.Int64)
319
337
320
338
bb2(%12 : $Array<Klass>):
321
- %14 = function_ref @getCount : $@convention(method) (@guaranteed Array<Klass>) -> Int
339
+ %14 = function_ref @getCount : $@convention(method) (@guaranteed Array<Klass>) -> MyInt
322
340
retain_value %0 : $Optional<Array<Klass>>
323
341
retain_value %0 : $Optional<Array<Klass>>
324
- %17 = apply %14(%12) : $@convention(method) (@guaranteed Array<Klass>) -> Int
325
- %18 = struct_extract %17 : $Int , #Int ._value
342
+ %17 = apply %14(%12) : $@convention(method) (@guaranteed Array<Klass>) -> MyInt
343
+ %18 = struct_extract %17 : $MyInt , #MyInt ._value
326
344
%19 = builtin "cmp_eq_Int64"(%18 : $Builtin.Int64, %4 : $Builtin.Int64) : $Builtin.Int1
327
345
cond_br %19, bb3, bb4
328
346
@@ -337,25 +355,25 @@ bb3:
337
355
338
356
bb4:
339
357
%28 = function_ref @hoistableIsNativeTypeChecked : $@convention(method) (@guaranteed Array<Klass>) -> Bool
340
- %29 = function_ref @getElement : $@convention(method) (Int , Bool, _DependenceToken, @guaranteed Array<Klass>) -> @owned Klass
358
+ %29 = function_ref @getElement : $@convention(method) (MyInt , Bool, _DependenceToken, @guaranteed Array<Klass>) -> @owned Klass
341
359
%30 = integer_literal $Builtin.Int64, 1
342
360
%31 = integer_literal $Builtin.Int1, -1
343
361
%32 = struct $_DependenceToken ()
344
362
br bb5(%4 : $Builtin.Int64)
345
363
346
364
bb5(%34 : $Builtin.Int64):
347
- %35 = struct $Int (%34 : $Builtin.Int64)
365
+ %35 = struct $MyInt (%34 : $Builtin.Int64)
348
366
%36 = apply %28(%12) : $@convention(method) (@guaranteed Array<Klass>) -> Bool
349
- %37 = apply %29(%35, %36, %32, %12) : $@convention(method) (Int , Bool, _DependenceToken, @guaranteed Array<Klass>) -> @owned Klass
367
+ %37 = apply %29(%35, %36, %32, %12) : $@convention(method) (MyInt , Bool, _DependenceToken, @guaranteed Array<Klass>) -> @owned Klass
350
368
%38 = builtin "sadd_with_overflow_Int64"(%34 : $Builtin.Int64, %30 : $Builtin.Int64, %31 : $Builtin.Int1) : $(Builtin.Int64, Builtin.Int1)
351
369
%39 = tuple_extract %38 : $(Builtin.Int64, Builtin.Int1), 0
352
370
%40 = tuple_extract %38 : $(Builtin.Int64, Builtin.Int1), 1
353
371
cond_fail %40 : $Builtin.Int1, "arithmetic overflow"
354
372
%43 = ref_element_addr %37 : $Klass, #Klass.val
355
- %44 = begin_access [read] [dynamic] [no_nested_conflict] %43 : $*Optional<Int >
356
- %45 = load %44 : $*Optional<Int >
357
- end_access %44 : $*Optional<Int >
358
- switch_enum %45 : $Optional<Int >, case #Optional.some!enumelt: bb9, case #Optional.none!enumelt: bb6
373
+ %44 = begin_access [read] [dynamic] [no_nested_conflict] %43 : $*Optional<MyInt >
374
+ %45 = load %44 : $*Optional<MyInt >
375
+ end_access %44 : $*Optional<MyInt >
376
+ switch_enum %45 : $Optional<MyInt >, case #Optional.some!enumelt: bb9, case #Optional.none!enumelt: bb6
359
377
360
378
bb6:
361
379
strong_release %37 : $Klass
@@ -372,22 +390,22 @@ bb8:
372
390
373
391
bb9:
374
392
release_value %0 : $Optional<Array<Klass>>
375
- %57 = begin_access [read] [dynamic] [no_nested_conflict] %43 : $*Optional<Int >
376
- %58 = load %57 : $*Optional<Int >
377
- end_access %57 : $*Optional<Int >
378
- switch_enum %58 : $Optional<Int >, case #Optional.some!enumelt: bb11, case #Optional.none!enumelt: bb10
393
+ %57 = begin_access [read] [dynamic] [no_nested_conflict] %43 : $*Optional<MyInt >
394
+ %58 = load %57 : $*Optional<MyInt >
395
+ end_access %57 : $*Optional<MyInt >
396
+ switch_enum %58 : $Optional<MyInt >, case #Optional.some!enumelt: bb11, case #Optional.none!enumelt: bb10
379
397
380
398
bb10:
381
399
cond_fail %31 : $Builtin.Int1, "Unexpectedly found nil while unwrapping an Optional value"
382
400
unreachable
383
401
384
- bb11(%63 : $Int ):
402
+ bb11(%63 : $MyInt ):
385
403
release_value %0 : $Optional<Array<Klass>>
386
404
strong_release %37 : $Klass
387
- %66 = struct_extract %63 : $Int , #Int ._value
405
+ %66 = struct_extract %63 : $MyInt , #MyInt ._value
388
406
br bb12(%66 : $Builtin.Int64)
389
407
390
408
bb12(%69 : $Builtin.Int64):
391
- %70 = struct $Int (%69 : $Builtin.Int64)
392
- return %70 : $Int
409
+ %70 = struct $MyInt (%69 : $Builtin.Int64)
410
+ return %70 : $MyInt
393
411
}
0 commit comments