1
1
//@ test-mir-pass: MatchBranchSimplification
2
+ //@ compile-flags: -Zunsound-mir-opts
2
3
3
4
#![ feature( repr128) ]
4
5
#![ feature( core_intrinsics) ]
@@ -75,7 +76,9 @@ enum EnumAu8 {
75
76
// EMIT_MIR matches_reduce_branches.match_u8_i16.MatchBranchSimplification.diff
76
77
fn match_u8_i16 ( i : EnumAu8 ) -> i16 {
77
78
// CHECK-LABEL: fn match_u8_i16(
78
- // CHECK: switchInt
79
+ // CHECK-NOT: switchInt
80
+ // CHECK: _0 = _3 as i16 (IntToInt);
81
+ // CHECH: return
79
82
match i {
80
83
EnumAu8 :: A => 1 ,
81
84
EnumAu8 :: B => 2 ,
@@ -144,7 +147,9 @@ enum EnumBu8 {
144
147
// EMIT_MIR matches_reduce_branches.match_u8_u16.MatchBranchSimplification.diff
145
148
fn match_u8_u16 ( i : EnumBu8 ) -> u16 {
146
149
// CHECK-LABEL: fn match_u8_u16(
147
- // CHECK: switchInt
150
+ // CHECK-NOT: switchInt
151
+ // CHECK: _0 = _3 as u16 (IntToInt);
152
+ // CHECH: return
148
153
match i {
149
154
EnumBu8 :: A => 1 ,
150
155
EnumBu8 :: B => 2 ,
@@ -200,7 +205,9 @@ enum EnumAi8 {
200
205
// EMIT_MIR matches_reduce_branches.match_i8_i16.MatchBranchSimplification.diff
201
206
fn match_i8_i16 ( i : EnumAi8 ) -> i16 {
202
207
// CHECK-LABEL: fn match_i8_i16(
203
- // CHECK: switchInt
208
+ // CHECK-NOT: switchInt
209
+ // CHECK: _0 = _3 as i16 (IntToInt);
210
+ // CHECH: return
204
211
match i {
205
212
EnumAi8 :: A => -1 ,
206
213
EnumAi8 :: B => 2 ,
@@ -229,7 +236,9 @@ enum EnumAi16 {
229
236
// EMIT_MIR matches_reduce_branches.match_i16_i8.MatchBranchSimplification.diff
230
237
fn match_i16_i8 ( i : EnumAi16 ) -> i8 {
231
238
// CHECK-LABEL: fn match_i16_i8(
232
- // CHECK: switchInt
239
+ // CHECK-NOT: switchInt
240
+ // CHECK: _0 = _3 as i8 (IntToInt);
241
+ // CHECH: return
233
242
match i {
234
243
EnumAi16 :: A => -1 ,
235
244
EnumAi16 :: B => 2 ,
@@ -248,7 +257,9 @@ enum EnumAi128 {
248
257
// EMIT_MIR matches_reduce_branches.match_i128_u128.MatchBranchSimplification.diff
249
258
fn match_i128_u128 ( i : EnumAi128 ) -> u128 {
250
259
// CHECK-LABEL: fn match_i128_u128(
251
- // CHECK: switchInt
260
+ // CHECK-NOT: switchInt
261
+ // CHECK: _0 = _3 as u128 (IntToInt);
262
+ // CHECH: return
252
263
match i {
253
264
EnumAi128 :: A => 1 ,
254
265
EnumAi128 :: B => 2 ,
0 commit comments