]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff
rustc_mir: properly map scope parent chains into the caller when inlining.
[rust.git] / src / test / mir-opt / issue_73223.main.PreCodegen.64bit.diff
1 - // MIR for `main` before PreCodegen
2 + // MIR for `main` after PreCodegen
3   
4   fn main() -> () {
5       let mut _0: ();                      // return place in scope 0 at $DIR/issue-73223.rs:1:11: 1:11
6       let _1: i32;                         // in scope 0 at $DIR/issue-73223.rs:2:9: 2:14
7       let mut _2: std::option::Option<i32>; // in scope 0 at $DIR/issue-73223.rs:2:23: 2:30
8       let _3: i32;                         // in scope 0 at $DIR/issue-73223.rs:3:14: 3:15
9       let mut _5: (&i32, &i32);            // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
10       let mut _6: &i32;                    // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
11       let mut _9: bool;                    // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
12       let mut _10: bool;                   // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
13       let mut _11: i32;                    // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
14       let mut _12: &std::fmt::Arguments;   // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
15       let _13: std::fmt::Arguments;        // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
16       let mut _14: &[&str; 3];             // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
17       let mut _15: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
18       let _16: [std::fmt::ArgumentV1; 2];  // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
19       let mut _17: (&&i32, &&i32);         // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
20       let _18: &i32;                       // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
21       let mut _19: &&i32;                  // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
22       let _20: &i32;                       // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
23       let mut _21: std::fmt::ArgumentV1;   // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
24       let mut _22: std::fmt::ArgumentV1;   // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
25       scope 1 {
26           debug split => _1;               // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14
27           let _4: std::option::Option<i32>; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14
28           scope 3 {
29               debug _prev => _4;           // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14
30               let _7: &i32;                // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
31               let _8: &i32;                // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
32               scope 4 {
33                   debug left_val => _7;    // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
34                   debug right_val => _8;   // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
35                   scope 5 {
36                       debug arg0 => _25;   // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
37                       debug arg1 => _28;   // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
38                       scope 6 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/std/src/macros.rs:LL:COL
39                           debug x => _25;  // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
40                           debug f => _24;  // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
41                           let mut _23: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL
42                           let mut _24: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL
43                           let mut _25: &&i32; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL
44                           scope 7 {
45                           }
46                       }
47                       scope 8 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/std/src/macros.rs:LL:COL
48                           debug x => _28;  // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
49                           debug f => _27;  // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
50                           let mut _26: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL
51                           let mut _27: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL
52                           let mut _28: &&i32; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL
53                           scope 9 {
54                           }
55                       }
56                   }
57                   scope 10 (inlined Arguments::new_v1) { // at $SRC_DIR/std/src/macros.rs:LL:COL
58                       debug pieces => _29; // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
59                       debug args => _31;   // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
60                       let mut _29: &[&str]; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL
61                       let mut _30: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL
62                       let mut _31: &[std::fmt::ArgumentV1]; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL
63                   }
64               }
65           }
66       }
67       scope 2 {
68           debug v => _3;                   // in scope 2 at $DIR/issue-73223.rs:3:14: 3:15
69       }
70   
71       bb0: {
72           StorageLive(_1);                 // scope 0 at $DIR/issue-73223.rs:2:9: 2:14
73           StorageLive(_2);                 // scope 0 at $DIR/issue-73223.rs:2:23: 2:30
74           ((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30
75           discriminant(_2) = 1;            // scope 0 at $DIR/issue-73223.rs:2:23: 2:30
76           StorageLive(_3);                 // scope 0 at $DIR/issue-73223.rs:3:14: 3:15
77           _3 = ((_2 as Some).0: i32);      // scope 0 at $DIR/issue-73223.rs:3:14: 3:15
78           _1 = _3;                         // scope 2 at $DIR/issue-73223.rs:3:20: 3:21
79           StorageDead(_3);                 // scope 0 at $DIR/issue-73223.rs:3:20: 3:21
80           StorageDead(_2);                 // scope 0 at $DIR/issue-73223.rs:5:6: 5:7
81           ((_4 as Some).0: i32) = _1;      // scope 1 at $DIR/issue-73223.rs:7:22: 7:27
82           discriminant(_4) = 1;            // scope 1 at $DIR/issue-73223.rs:7:17: 7:28
83           (_5.0: &i32) = &_1;              // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
84           _6 = const main::promoted[1];    // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
85                                            // ty::Const
86                                            // + ty: &i32
87                                            // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[1]))
88                                            // mir::Constant
89                                            // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
90                                            // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[1])) }
91           (_5.1: &i32) = move _6;          // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
92           StorageLive(_7);                 // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
93           _7 = (_5.0: &i32);               // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
94           StorageLive(_8);                 // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
95           _8 = (_5.1: &i32);               // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
96           StorageLive(_9);                 // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
97           StorageLive(_10);                // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
98           StorageLive(_11);                // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
99           _11 = (*_7);                     // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
100           _10 = Eq(move _11, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
101           StorageDead(_11);                // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
102           _9 = Not(move _10);              // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
103           StorageDead(_10);                // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
104           switchInt(_9) -> [false: bb1, otherwise: bb2]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
105       }
106   
107       bb1: {
108           StorageDead(_9);                 // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
109           StorageDead(_8);                 // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
110           StorageDead(_7);                 // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
111           _0 = const ();                   // scope 0 at $DIR/issue-73223.rs:1:11: 9:2
112           StorageDead(_1);                 // scope 0 at $DIR/issue-73223.rs:9:1: 9:2
113           return;                          // scope 0 at $DIR/issue-73223.rs:9:2: 9:2
114       }
115   
116       bb2: {
117           StorageLive(_13);                // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
118           _14 = const main::promoted[0];   // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
119                                            // ty::Const
120                                            // + ty: &[&str; 3]
121                                            // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0]))
122                                            // mir::Constant
123                                            // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
124                                            // + literal: Const { ty: &[&str; 3], val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) }
125           _29 = move _14 as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
126           StorageLive(_16);                // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
127           StorageLive(_18);                // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
128           _18 = _7;                        // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
129           (_17.0: &&i32) = &_18;           // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
130           StorageLive(_19);                // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
131           StorageLive(_20);                // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
132           _20 = _8;                        // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
133           _19 = &_20;                      // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
134           (_17.1: &&i32) = move _19;       // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
135           StorageDead(_19);                // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
136           _25 = (_17.0: &&i32);            // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
137           _28 = (_17.1: &&i32);            // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
138           _24 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
139                                            // mir::Constant
140                                            // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
141                                            // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar(<ZST>)) }
142           StorageLive(_23);                // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
143           _23 = transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _24) -> bb3; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
144                                            // mir::Constant
145                                            // + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
146                                            // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar(<ZST>)) }
147       }
148   
149       bb3: {
150           (_21.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _25) -> bb4; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
151                                            // mir::Constant
152                                            // + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
153                                            // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar(<ZST>)) }
154       }
155   
156       bb4: {
157           (_21.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _23; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
158           StorageDead(_23);                // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
159           _27 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
160                                            // mir::Constant
161                                            // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
162                                            // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar(<ZST>)) }
163           StorageLive(_26);                // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
164           _26 = transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _27) -> bb5; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
165                                            // mir::Constant
166                                            // + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
167                                            // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar(<ZST>)) }
168       }
169   
170       bb5: {
171           (_22.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _28) -> bb6; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
172                                            // mir::Constant
173                                            // + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
174                                            // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar(<ZST>)) }
175       }
176   
177       bb6: {
178           (_22.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _26; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
179           StorageDead(_26);                // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
180           _16 = [move _21, move _22];      // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL
181           _15 = &_16;                      // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
182           _31 = move _15 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
183           StorageLive(_30);                // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
184           discriminant(_30) = 0;           // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
185           (_13.0: &[&str]) = move _29;     // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
186           (_13.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _30; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
187           (_13.2: &[std::fmt::ArgumentV1]) = move _31; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
188           StorageDead(_30);                // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
189           _12 = &_13;                      // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
190           begin_panic_fmt(move _12);       // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
191                                            // mir::Constant
192                                            // + span: $SRC_DIR/std/src/macros.rs:LL:COL
193                                            // + literal: Const { ty: for<'r, 's> fn(&'r std::fmt::Arguments<'s>) -> ! {std::rt::begin_panic_fmt}, val: Value(Scalar(<ZST>)) }
194       }
195   }
196