]> git.lizzy.rs Git - rust.git/blob - tests/mir-opt/issue_62289.test.ElaborateDrops.before.mir
Delete `SimplifyArmIdentity` and `SimplifyBranchSame` mir opts
[rust.git] / tests / mir-opt / issue_62289.test.ElaborateDrops.before.mir
1 // MIR for `test` before ElaborateDrops
2
3 fn test() -> Option<Box<u32>> {
4     let mut _0: std::option::Option<std::boxed::Box<u32>>; // return place in scope 0 at $DIR/issue_62289.rs:+0:14: +0:30
5     let mut _1: std::boxed::Box<u32>;    // in scope 0 at $DIR/issue_62289.rs:+1:10: +1:21
6     let mut _2: usize;                   // in scope 0 at $DIR/issue_62289.rs:+1:10: +1:21
7     let mut _3: usize;                   // in scope 0 at $DIR/issue_62289.rs:+1:10: +1:21
8     let mut _4: *mut u8;                 // in scope 0 at $DIR/issue_62289.rs:+1:10: +1:21
9     let mut _5: std::boxed::Box<u32>;    // in scope 0 at $DIR/issue_62289.rs:+1:10: +1:21
10     let mut _6: std::ops::ControlFlow<std::option::Option<std::convert::Infallible>, u32>; // in scope 0 at $DIR/issue_62289.rs:+1:15: +1:20
11     let mut _7: std::option::Option<u32>; // in scope 0 at $DIR/issue_62289.rs:+1:15: +1:19
12     let mut _8: isize;                   // in scope 0 at $DIR/issue_62289.rs:+1:19: +1:20
13     let _9: std::option::Option<std::convert::Infallible>; // in scope 0 at $DIR/issue_62289.rs:+1:19: +1:20
14     let mut _10: !;                      // in scope 0 at $DIR/issue_62289.rs:+1:19: +1:20
15     let mut _11: std::option::Option<std::convert::Infallible>; // in scope 0 at $DIR/issue_62289.rs:+1:19: +1:20
16     let _12: u32;                        // in scope 0 at $DIR/issue_62289.rs:+1:15: +1:20
17     scope 1 {
18     }
19     scope 2 {
20         debug residual => _9;            // in scope 2 at $DIR/issue_62289.rs:+1:19: +1:20
21         scope 3 {
22         }
23     }
24     scope 4 {
25         debug val => _12;                // in scope 4 at $DIR/issue_62289.rs:+1:15: +1:20
26         scope 5 {
27         }
28     }
29
30     bb0: {
31         StorageLive(_1);                 // scope 0 at $DIR/issue_62289.rs:+1:10: +1:21
32         _2 = SizeOf(u32);                // scope 1 at $DIR/issue_62289.rs:+1:10: +1:21
33         _3 = AlignOf(u32);               // scope 1 at $DIR/issue_62289.rs:+1:10: +1:21
34         _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> bb1; // scope 1 at $DIR/issue_62289.rs:+1:10: +1:21
35                                          // mir::Constant
36                                          // + span: $DIR/issue_62289.rs:9:10: 9:21
37                                          // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(<ZST>) }
38     }
39
40     bb1: {
41         StorageLive(_5);                 // scope 0 at $DIR/issue_62289.rs:+1:10: +1:21
42         _5 = ShallowInitBox(move _4, u32); // scope 0 at $DIR/issue_62289.rs:+1:10: +1:21
43         StorageLive(_6);                 // scope 0 at $DIR/issue_62289.rs:+1:15: +1:20
44         StorageLive(_7);                 // scope 0 at $DIR/issue_62289.rs:+1:15: +1:19
45         _7 = Option::<u32>::None;        // scope 0 at $DIR/issue_62289.rs:+1:15: +1:19
46         _6 = <Option<u32> as Try>::branch(move _7) -> [return: bb2, unwind: bb12]; // scope 0 at $DIR/issue_62289.rs:+1:15: +1:20
47                                          // mir::Constant
48                                          // + span: $DIR/issue_62289.rs:9:15: 9:20
49                                          // + literal: Const { ty: fn(Option<u32>) -> ControlFlow<<Option<u32> as Try>::Residual, <Option<u32> as Try>::Output> {<Option<u32> as Try>::branch}, val: Value(<ZST>) }
50     }
51
52     bb2: {
53         StorageDead(_7);                 // scope 0 at $DIR/issue_62289.rs:+1:19: +1:20
54         _8 = discriminant(_6);           // scope 0 at $DIR/issue_62289.rs:+1:15: +1:20
55         switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb4]; // scope 0 at $DIR/issue_62289.rs:+1:15: +1:20
56     }
57
58     bb3: {
59         StorageLive(_12);                // scope 0 at $DIR/issue_62289.rs:+1:15: +1:20
60         _12 = ((_6 as Continue).0: u32); // scope 0 at $DIR/issue_62289.rs:+1:15: +1:20
61         (*_5) = _12;                     // scope 5 at $DIR/issue_62289.rs:+1:15: +1:20
62         StorageDead(_12);                // scope 0 at $DIR/issue_62289.rs:+1:19: +1:20
63         _1 = move _5;                    // scope 0 at $DIR/issue_62289.rs:+1:10: +1:21
64         drop(_5) -> [return: bb7, unwind: bb11]; // scope 0 at $DIR/issue_62289.rs:+1:20: +1:21
65     }
66
67     bb4: {
68         unreachable;                     // scope 0 at $DIR/issue_62289.rs:+1:15: +1:20
69     }
70
71     bb5: {
72         StorageLive(_9);                 // scope 0 at $DIR/issue_62289.rs:+1:19: +1:20
73         _9 = ((_6 as Break).0: std::option::Option<std::convert::Infallible>); // scope 0 at $DIR/issue_62289.rs:+1:19: +1:20
74         StorageLive(_11);                // scope 3 at $DIR/issue_62289.rs:+1:19: +1:20
75         _11 = _9;                        // scope 3 at $DIR/issue_62289.rs:+1:19: +1:20
76         _0 = <Option<Box<u32>> as FromResidual<Option<Infallible>>>::from_residual(move _11) -> [return: bb6, unwind: bb12]; // scope 3 at $DIR/issue_62289.rs:+1:15: +1:20
77                                          // mir::Constant
78                                          // + span: $DIR/issue_62289.rs:9:19: 9:20
79                                          // + literal: Const { ty: fn(Option<Infallible>) -> Option<Box<u32>> {<Option<Box<u32>> as FromResidual<Option<Infallible>>>::from_residual}, val: Value(<ZST>) }
80     }
81
82     bb6: {
83         StorageDead(_11);                // scope 3 at $DIR/issue_62289.rs:+1:19: +1:20
84         StorageDead(_9);                 // scope 0 at $DIR/issue_62289.rs:+1:19: +1:20
85         drop(_5) -> bb9;                 // scope 0 at $DIR/issue_62289.rs:+1:20: +1:21
86     }
87
88     bb7: {
89         StorageDead(_5);                 // scope 0 at $DIR/issue_62289.rs:+1:20: +1:21
90         _0 = Option::<Box<u32>>::Some(move _1); // scope 0 at $DIR/issue_62289.rs:+1:5: +1:22
91         drop(_1) -> bb8;                 // scope 0 at $DIR/issue_62289.rs:+1:21: +1:22
92     }
93
94     bb8: {
95         StorageDead(_1);                 // scope 0 at $DIR/issue_62289.rs:+1:21: +1:22
96         StorageDead(_6);                 // scope 0 at $DIR/issue_62289.rs:+2:1: +2:2
97         goto -> bb10;                    // scope 0 at $DIR/issue_62289.rs:+2:2: +2:2
98     }
99
100     bb9: {
101         StorageDead(_5);                 // scope 0 at $DIR/issue_62289.rs:+1:20: +1:21
102         StorageDead(_1);                 // scope 0 at $DIR/issue_62289.rs:+1:21: +1:22
103         StorageDead(_6);                 // scope 0 at $DIR/issue_62289.rs:+2:1: +2:2
104         goto -> bb10;                    // scope 0 at $DIR/issue_62289.rs:+2:2: +2:2
105     }
106
107     bb10: {
108         return;                          // scope 0 at $DIR/issue_62289.rs:+2:2: +2:2
109     }
110
111     bb11 (cleanup): {
112         drop(_1) -> bb13;                // scope 0 at $DIR/issue_62289.rs:+1:21: +1:22
113     }
114
115     bb12 (cleanup): {
116         drop(_5) -> bb13;                // scope 0 at $DIR/issue_62289.rs:+1:20: +1:21
117     }
118
119     bb13 (cleanup): {
120         resume;                          // scope 0 at $DIR/issue_62289.rs:+0:1: +2:2
121     }
122 }