]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/exponential-or.rs
Auto merge of #69265 - ehuss:update-cargo, r=Dylan-DPC
[rust.git] / src / test / mir-opt / exponential-or.rs
1 // Test that simple or-patterns don't get expanded to exponentially large CFGs
2
3 // ignore-tidy-linelength
4
5 #![feature(or_patterns)]
6
7 fn match_tuple(x: (u32, bool, Option<i32>, u32)) -> u32 {
8     match x {
9         (y @ (1 | 4), true | false, Some(1 | 8) | None, z @ (6..=9 | 13..=16)) => y ^ z,
10         _ => 0,
11     }
12 }
13
14 fn main() {}
15
16 // END RUST SOURCE
17
18 // START rustc.match_tuple.SimplifyCfg-initial.after.mir
19 // scope 1 {
20 //     debug y => _7;
21 //     debug z => _8;
22 // }
23 // bb0: {
24 //     FakeRead(ForMatchedPlace, _1);
25 //     switchInt((_1.0: u32)) -> [1u32: bb2, 4u32: bb2, otherwise: bb1];
26 // }
27 // bb1: {
28 //     _0 = const 0u32;
29 //     goto -> bb10;
30 // }
31 // bb2: {
32 //     _2 = discriminant((_1.2: std::option::Option<i32>));
33 //     switchInt(move _2) -> [0isize: bb4, 1isize: bb3, otherwise: bb1];
34 // }
35 // bb3: {
36 //     switchInt((((_1.2: std::option::Option<i32>) as Some).0: i32)) -> [1i32: bb4, 8i32: bb4, otherwise: bb1];
37 // }
38 // bb4: {
39 //     _5 = Le(const 6u32, (_1.3: u32));
40 //     switchInt(move _5) -> [false: bb6, otherwise: bb5];
41 // }
42 // bb5: {
43 //     _6 = Le((_1.3: u32), const 9u32);
44 //     switchInt(move _6) -> [false: bb6, otherwise: bb8];
45 // }
46 // bb6: {
47 //     _3 = Le(const 13u32, (_1.3: u32));
48 //     switchInt(move _3) -> [false: bb1, otherwise: bb7];
49 // }
50 // bb7: {
51 //     _4 = Le((_1.3: u32), const 16u32);
52 //     switchInt(move _4) -> [false: bb1, otherwise: bb8];
53 // }
54 // bb8: {
55 //     falseEdges -> [real: bb9, imaginary: bb1];
56 // }
57 // bb9: {
58 //     StorageLive(_7);
59 //     _7 = (_1.0: u32);
60 //     StorageLive(_8);
61 //     _8 = (_1.3: u32);
62 //     StorageLive(_9);
63 //     _9 = _7;
64 //     StorageLive(_10);
65 //     _10 = _8;
66 //     _0 = BitXor(move _9, move _10);
67 //     StorageDead(_10);
68 //     StorageDead(_9);
69 //     StorageDead(_8);
70 //     StorageDead(_7);
71 //     goto -> bb10;
72 // }
73 // bb10: {
74 //     return;
75 // }
76 // END rustc.match_tuple.SimplifyCfg-initial.after.mir