@@ -21,6 +21,22 @@ struct UInt64 {
21
21
var value: Builtin.Int64
22
22
}
23
23
24
+ class Klass {
25
+ var id: Int64
26
+ }
27
+
28
+ struct WrapperStruct {
29
+ var val: Klass
30
+ }
31
+
32
+ sil [_semantics "array.check_subscript"] @checkbounds : $@convention(method) (Int64, Bool, @guaranteed Array<Klass>) -> _DependenceToken
33
+
34
+ sil [_semantics "array.get_element"] @getElement : $@convention(method) (Int64, Bool, _DependenceToken, @guaranteed Array<Klass>) -> @owned Klass
35
+
36
+ sil @use_inguaranteed : $@convention(thin) (@in_guaranteed Klass) -> ()
37
+
38
+ sil @get_wrapper_struct : $@convention(thin) (@inout WrapperStruct) -> ()
39
+
24
40
// CHECK-LABEL: sil [ossa] @loop_unroll_1 :
25
41
// CHECK: bb0
26
42
// CHECK: br bb1
@@ -495,14 +511,6 @@ bb4:
495
511
return %8 : $()
496
512
}
497
513
498
- class Klass {
499
- var id: Int64
500
- }
501
-
502
- sil [_semantics "array.check_subscript"] @checkbounds : $@convention(method) (Int64, Bool, @guaranteed Array<Klass>) -> _DependenceToken
503
-
504
- sil [_semantics "array.get_element"] @getElement : $@convention(method) (Int64, Bool, _DependenceToken, @guaranteed Array<Klass>) -> @owned Klass
505
-
506
514
// CHECK-LABEL: sil [ossa] @sumKlassId :
507
515
// CHECK: [[FUNC:%.*]] = function_ref @getElement :
508
516
// CHECK: apply [[FUNC]]
@@ -724,3 +732,64 @@ bb3:
724
732
return %tup : $()
725
733
}
726
734
735
+ // Ensure we don't trigger presence of address phis verification
736
+ sil [ossa] @unroll_with_addr_proj1 : $@convention(thin) (@in_guaranteed WrapperStruct) -> () {
737
+ bb0(%0 : $*WrapperStruct):
738
+ %1 = integer_literal $Builtin.Int64, 1
739
+ %2 = integer_literal $Builtin.Int64, 4
740
+ %3 = integer_literal $Builtin.Int1, -1
741
+ br bb1(%1 : $Builtin.Int64, %2 : $Builtin.Int64)
742
+
743
+ bb1(%5 : $Builtin.Int64, %6 : $Builtin.Int64):
744
+ %7 = builtin "sadd_with_overflow_Int64"(%5 : $Builtin.Int64, %1 : $Builtin.Int64, %3 : $Builtin.Int1) : $(Builtin.Int64, Builtin.Int1)
745
+ %8 = tuple_extract %7 : $(Builtin.Int64, Builtin.Int1), 0
746
+ %9 = builtin "smul_with_overflow_Int64"(%6 : $Builtin.Int64, %2 : $Builtin.Int64, %3 : $Builtin.Int1) : $(Builtin.Int64, Builtin.Int1)
747
+ %10 = tuple_extract %9 : $(Builtin.Int64, Builtin.Int1), 0
748
+ %11 = builtin "cmp_slt_Int64"(%8 : $Builtin.Int64, %2 : $Builtin.Int64) : $Builtin.Int1
749
+ %12 = struct_element_addr %0 : $*WrapperStruct, #WrapperStruct.val
750
+ cond_br %11, bb2, bb3
751
+
752
+ bb2:
753
+ br bb1(%8 : $Builtin.Int64, %10 : $Builtin.Int64)
754
+
755
+ bb3:
756
+ %15 = function_ref @use_inguaranteed : $@convention(thin) (@in_guaranteed Klass) -> ()
757
+ %16 = apply %15(%12) : $@convention(thin) (@in_guaranteed Klass) -> ()
758
+ %17 = tuple ()
759
+ return %17 : $()
760
+ }
761
+
762
+ // Ensure we don't trigger presence of address phis verification
763
+ sil [ossa] @unroll_with_addr_proj2 : $@convention(thin) (@in_guaranteed WrapperStruct) -> () {
764
+ bb0(%0 : $*WrapperStruct):
765
+ %1 = alloc_stack $WrapperStruct
766
+ %2 = integer_literal $Builtin.Int64, 1
767
+ %3 = integer_literal $Builtin.Int64, 4
768
+ %4 = integer_literal $Builtin.Int1, -1
769
+ %5 = load [copy] %0 : $*WrapperStruct
770
+ store %5 to [init] %1 : $*WrapperStruct
771
+ br bb1(%2 : $Builtin.Int64, %3 : $Builtin.Int64)
772
+
773
+ bb1(%8 : $Builtin.Int64, %9 : $Builtin.Int64):
774
+ %10 = builtin "sadd_with_overflow_Int64"(%8 : $Builtin.Int64, %2 : $Builtin.Int64, %4 : $Builtin.Int1) : $(Builtin.Int64, Builtin.Int1)
775
+ %11 = tuple_extract %10 : $(Builtin.Int64, Builtin.Int1), 0
776
+ %12 = builtin "smul_with_overflow_Int64"(%9 : $Builtin.Int64, %3 : $Builtin.Int64, %4 : $Builtin.Int1) : $(Builtin.Int64, Builtin.Int1)
777
+ %13 = tuple_extract %12 : $(Builtin.Int64, Builtin.Int1), 0
778
+ %14 = builtin "cmp_slt_Int64"(%11 : $Builtin.Int64, %3 : $Builtin.Int64) : $Builtin.Int1
779
+ %15 = function_ref @get_wrapper_struct : $@convention(thin) (@inout WrapperStruct) -> ()
780
+ %16 = apply %15(%1) : $@convention(thin) (@inout WrapperStruct) -> ()
781
+ %17 = struct_element_addr %1 : $*WrapperStruct, #WrapperStruct.val
782
+ cond_br %14, bb2, bb3
783
+
784
+ bb2:
785
+ br bb1(%11 : $Builtin.Int64, %13 : $Builtin.Int64)
786
+
787
+ bb3:
788
+ %20 = function_ref @use_inguaranteed : $@convention(thin) (@in_guaranteed Klass) -> ()
789
+ %21 = apply %20(%17) : $@convention(thin) (@in_guaranteed Klass) -> ()
790
+ destroy_addr %1 : $*WrapperStruct
791
+ dealloc_stack %1 : $*WrapperStruct
792
+ %24 = tuple ()
793
+ return %24 : $()
794
+ }
795
+
0 commit comments