Skip to content

Commit a9f4a38

Browse files
committed
[Test] Backport SIL test to 6.1.
On main type annotations are not always required but on 6.1 they are.
1 parent 7544e6c commit a9f4a38

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

test/SILOptimizer/sil_combine_apply_unit.sil

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,20 @@ entry(%input : $*Input):
5252
// CHECK: bb0([[C:%[^,]+]] :
5353
// CHECK: [[BORROW_MAYBE_C:%[^,]+]] = function_ref @borrowMaybeC
5454
// CHECK: [[B:%[^,]+]] = begin_borrow [[C]]
55-
// CHECK: [[MAYBE_B:%[^,]+]] = unchecked_ref_cast [[B]] to $Optional<C>
55+
// CHECK: [[MAYBE_B:%[^,]+]] = unchecked_ref_cast [[B]] : $C to $Optional<C>
5656
// CHECK: apply [[BORROW_MAYBE_C]]([[MAYBE_B]])
5757
// CHECK: end_borrow [[B]]
5858
// CHECK: destroy_value [[C]]
5959
// CHECK-LABEL: } // end sil function 'convert_function__to_optional__owned_as_guaranteed__1'
6060
sil [ossa] @convert_function__to_optional__owned_as_guaranteed__1 : $@convention(thin) (@owned C) -> () {
6161
entry(%c : @owned $C):
6262
%borrowMaybeC = function_ref @borrowMaybeC : $@convention(thin) (@guaranteed Optional<C>) -> ()
63-
%borrowC = convert_function %borrowMaybeC to $@convention(thin) (@guaranteed C) -> ()
63+
%borrowC = convert_function %borrowMaybeC : $@convention(thin) (@guaranteed Optional<C>) -> () to $@convention(thin) (@guaranteed C) -> ()
6464
%void = apply %borrowC(%c) : $@convention(thin) (@guaranteed C) -> ()
6565
specify_test "sil_combine_instruction %void"
66-
destroy_value %c
66+
destroy_value %c : $C
6767
%retval = tuple ()
68-
return %retval
68+
return %retval : $()
6969
}
7070

7171
// CHECK-LABEL: sil [ossa] @convert_function__to_optional__owned_as_guaranteed__2 : {{.*}} {
@@ -75,9 +75,9 @@ entry(%c : @owned $C):
7575
// CHECK-SAME: ):
7676
// CHECK: [[BORROW_MAYBE_C2:%[^,]+]] = function_ref @borrowMaybeC2
7777
// CHECK: [[B:%[^,]+]] = begin_borrow [[C]]
78-
// CHECK: [[MAYBE_B:%[^,]+]] = unchecked_ref_cast [[B]] to $Optional<C>
78+
// CHECK: [[MAYBE_B:%[^,]+]] = unchecked_ref_cast [[B]] : $C to $Optional<C>
7979
// CHECK: [[B2:%[^,]+]] = begin_borrow [[C2]]
80-
// CHECK: [[MAYBE_B2:%[^,]+]] = unchecked_ref_cast [[B2]] to $Optional<C>
80+
// CHECK: [[MAYBE_B2:%[^,]+]] = unchecked_ref_cast [[B2]] : $C to $Optional<C>
8181
// CHECK: apply [[BORROW_MAYBE_C2]]([[MAYBE_B]], [[MAYBE_B2]])
8282
// CHECK: end_borrow [[B]]
8383
// CHECK: end_borrow [[B2]]
@@ -87,20 +87,20 @@ entry(%c : @owned $C):
8787
sil [ossa] @convert_function__to_optional__owned_as_guaranteed__2 : $@convention(thin) (@owned C, @owned C) -> () {
8888
entry(%c : @owned $C, %c2 : @owned $C):
8989
%borrowMaybeC2 = function_ref @borrowMaybeC2 : $@convention(thin) (@guaranteed Optional<C>, @guaranteed Optional<C>) -> ()
90-
%borrowC2 = convert_function %borrowMaybeC2 to $@convention(thin) (@guaranteed C, @guaranteed C) -> ()
90+
%borrowC2 = convert_function %borrowMaybeC2 : $@convention(thin) (@guaranteed Optional<C>, @guaranteed Optional<C>) -> () to $@convention(thin) (@guaranteed C, @guaranteed C) -> ()
9191
%void = apply %borrowC2(%c, %c2) : $@convention(thin) (@guaranteed C, @guaranteed C) -> ()
9292
specify_test "sil_combine_instruction %void"
93-
destroy_value %c
94-
destroy_value %c2
93+
destroy_value %c : $C
94+
destroy_value %c2 : $C
9595
%retval = tuple ()
96-
return %retval
96+
return %retval : $()
9797
}
9898

9999
// CHECK-LABEL: sil [ossa] @convert_function__to_optional__owned_as_guaranteed__3 : {{.*}} {
100100
// CHECK: bb0([[C:%[^,]+]] :
101101
// CHECK: [[BORROW_MAYBE_C:%[^,]+]] = function_ref @borrowMaybeCThrowing
102102
// CHECK: [[B:%[^,]+]] = begin_borrow [[C]]
103-
// CHECK: [[MAYBE_B:%[^,]+]] = unchecked_ref_cast [[B]] to $Optional<C>
103+
// CHECK: [[MAYBE_B:%[^,]+]] = unchecked_ref_cast [[B]] : $C to $Optional<C>
104104
// CHECK: try_apply [[BORROW_MAYBE_C]]([[MAYBE_B]])
105105
// CHECK: normal [[SUCCESS:bb[0-9]+]]
106106
// CHECK: error [[FAILURE:bb[0-9]+]]
@@ -115,20 +115,20 @@ entry(%c : @owned $C, %c2 : @owned $C):
115115
sil [ossa] @convert_function__to_optional__owned_as_guaranteed__3 : $@convention(thin) (@owned C) -> (@error Error) {
116116
entry(%c : @owned $C):
117117
%borrowMaybeC = function_ref @borrowMaybeCThrowing : $@convention(thin) (@guaranteed Optional<C>) -> (@error Error)
118-
%borrowC = convert_function %borrowMaybeC to $@convention(thin) (@guaranteed C) -> (@error Error)
118+
%borrowC = convert_function %borrowMaybeC : $@convention(thin) (@guaranteed Optional<C>) -> (@error Error) to $@convention(thin) (@guaranteed C) -> (@error Error)
119119
specify_test "sil_combine_instruction @instruction"
120120
try_apply %borrowC(%c) : $@convention(thin) (@guaranteed C) -> (@error Error),
121121
normal success,
122122
error failure
123123

124124
success(%void : $()):
125-
destroy_value %c
125+
destroy_value %c : $C
126126
%retval = tuple ()
127-
return %retval
127+
return %retval : $()
128128

129129
failure(%error : @owned $Error):
130-
destroy_value %c
131-
throw %error
130+
destroy_value %c : $C
131+
throw %error : $Error
132132
}
133133

134134
// CHECK-LABEL: sil [ossa] @convert_function__to_optional__owned_as_guaranteed__4 : {{.*}} {
@@ -138,9 +138,9 @@ failure(%error : @owned $Error):
138138
// CHECK-SAME: ):
139139
// CHECK: [[BORROW_MAYBE_C2:%[^,]+]] = function_ref @borrowMaybeC2Throwing
140140
// CHECK: [[B:%[^,]+]] = begin_borrow [[C]]
141-
// CHECK: [[MAYBE_B:%[^,]+]] = unchecked_ref_cast [[B]] to $Optional<C>
141+
// CHECK: [[MAYBE_B:%[^,]+]] = unchecked_ref_cast [[B]] : $C to $Optional<C>
142142
// CHECK: [[B2:%[^,]+]] = begin_borrow [[C2]]
143-
// CHECK: [[MAYBE_B2:%[^,]+]] = unchecked_ref_cast [[B2]] to $Optional<C>
143+
// CHECK: [[MAYBE_B2:%[^,]+]] = unchecked_ref_cast [[B2]] : $C to $Optional<C>
144144
// CHECK: try_apply [[BORROW_MAYBE_C2]]([[MAYBE_B]], [[MAYBE_B2]])
145145
// CHECK: normal [[SUCCESS:bb[0-9]+]]
146146
// CHECK: error [[FAILURE:bb[0-9]+]]
@@ -159,20 +159,20 @@ failure(%error : @owned $Error):
159159
sil [ossa] @convert_function__to_optional__owned_as_guaranteed__4 : $@convention(thin) (@owned C, @owned C) -> (@error Error) {
160160
entry(%c : @owned $C, %c2 : @owned $C):
161161
%borrowMaybeC2 = function_ref @borrowMaybeC2Throwing : $@convention(thin) (@guaranteed Optional<C>, @guaranteed Optional<C>) -> (@error Error)
162-
%borrowC2 = convert_function %borrowMaybeC2 to $@convention(thin) (@guaranteed C, @guaranteed C) -> (@error Error)
162+
%borrowC2 = convert_function %borrowMaybeC2 : $@convention(thin) (@guaranteed Optional<C>, @guaranteed Optional<C>) -> (@error Error) to $@convention(thin) (@guaranteed C, @guaranteed C) -> (@error Error)
163163
specify_test "sil_combine_instruction @instruction"
164164
try_apply %borrowC2(%c, %c2) : $@convention(thin) (@guaranteed C, @guaranteed C) -> (@error Error),
165165
normal success,
166166
error failure
167167

168168
success(%void : $()):
169-
destroy_value %c
170-
destroy_value %c2
169+
destroy_value %c : $C
170+
destroy_value %c2 : $C
171171
%retval = tuple ()
172-
return %retval
172+
return %retval : $()
173173

174174
failure(%error : @owned $Error):
175-
destroy_value %c
176-
destroy_value %c2
177-
throw %error
175+
destroy_value %c : $C
176+
destroy_value %c2 : $C
177+
throw %error : $Error
178178
}

0 commit comments

Comments
 (0)