fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
8.7 KiB209 linesraw
1- // MIR for `main` before Inline
2+ // MIR for `main` after Inline
3  
4  fn main() -> () {
5      let mut _0: ();
6      let _1: std::boxed::Box<std::vec::Vec<u32>>;
7      let mut _2: std::vec::Vec<u32>;
8      scope 1 {
9          debug _x => _1;
10      }
11+     scope 2 (inlined Vec::<u32>::new) {
12+         let mut _3: alloc::raw_vec::RawVec<u32>;
13+     }
14+     scope 3 (inlined Box::<Vec<u32>>::new) {
15+         debug x => _2;
16+         let mut _4: usize;
17+         let mut _5: usize;
18+         let mut _6: *mut u8;
19+         let mut _7: *const std::vec::Vec<u32>;
20+         scope 4 {
21+             scope 5 (inlined alloc::alloc::exchange_malloc) {
22+                 debug size => _4;
23+                 debug align => _5;
24+                 let _8: std::alloc::Layout;
25+                 let mut _9: std::result::Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError>;
26+                 let mut _10: isize;
27+                 let mut _12: !;
28+                 scope 6 {
29+                     debug layout => _8;
30+                     let _11: std::ptr::NonNull<[u8]>;
31+                     let mut _13: &std::alloc::Global;
32+                     scope 8 {
33+                         debug ptr => _11;
34+                         scope 18 (inlined NonNull::<[u8]>::as_mut_ptr) {
35+                             debug self => _11;
36+                             let mut _15: std::ptr::NonNull<u8>;
37+                             scope 19 (inlined NonNull::<[u8]>::as_non_null_ptr) {
38+                                 debug self => _11;
39+                                 let mut _16: *mut u8;
40+                                 let mut _17: *mut [u8];
41+                                 scope 20 {
42+                                     scope 21 (inlined NonNull::<[u8]>::as_ptr) {
43+                                         debug self => _11;
44+                                         let mut _18: *const [u8];
45+                                     }
46+                                     scope 22 (inlined ptr::mut_ptr::<impl *mut [u8]>::as_mut_ptr) {
47+                                         debug self => _17;
48+                                     }
49+                                     scope 23 (inlined NonNull::<u8>::new_unchecked) {
50+                                         debug ptr => _16;
51+                                         let mut _19: *const u8;
52+                                         scope 24 {
53+                                             scope 25 (inlined NonNull::<T>::new_unchecked::runtime::<u8>) {
54+                                                 debug ptr => _16;
55+                                                 scope 26 (inlined ptr::mut_ptr::<impl *mut u8>::is_null) {
56+                                                     debug self => _16;
57+                                                     let mut _20: *mut u8;
58+                                                     scope 27 {
59+                                                         scope 28 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
60+                                                             debug ptr => _20;
61+                                                             scope 29 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
62+                                                                 debug self => _20;
63+                                                                 scope 30 {
64+                                                                     scope 31 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
65+                                                                         debug self => _20;
66+                                                                     }
67+                                                                 }
68+                                                             }
69+                                                         }
70+                                                     }
71+                                                 }
72+                                             }
73+                                         }
74+                                     }
75+                                 }
76+                             }
77+                             scope 32 (inlined NonNull::<u8>::as_ptr) {
78+                                 debug self => _15;
79+                                 let mut _21: *const u8;
80+                             }
81+                         }
82+                     }
83+                     scope 17 (inlined <std::alloc::Global as Allocator>::allocate) {
84+                         debug self => const _;
85+                         debug layout => _8;
86+                     }
87+                 }
88+                 scope 7 {
89+                     scope 9 (inlined Layout::from_size_align_unchecked) {
90+                         debug size => _4;
91+                         debug align => _5;
92+                         let mut _14: std::ptr::Alignment;
93+                         scope 10 {
94+                             scope 11 (inlined std::ptr::Alignment::new_unchecked) {
95+                                 debug align => _5;
96+                                 scope 12 {
97+                                     scope 14 (inlined std::ptr::Alignment::new_unchecked::runtime) {
98+                                         debug align => _5;
99+                                         scope 15 (inlined core::num::<impl usize>::is_power_of_two) {
100+                                             debug self => _5;
101+                                             scope 16 (inlined core::num::<impl usize>::count_ones) {
102+                                                 debug self => _5;
103+                                             }
104+                                         }
105+                                     }
106+                                 }
107+                                 scope 13 {
108+                                 }
109+                             }
110+                         }
111+                     }
112+                 }
113+             }
114+         }
115+     }
116  
117      bb0: {
118          StorageLive(_1);
119          StorageLive(_2);
120-         _2 = Vec::<u32>::new() -> [return: bb1, unwind unreachable];
121+         StorageLive(_3);
122+         _3 = const _;
123+         _2 = Vec::<u32> { buf: move _3, len: const 0_usize };
124+         StorageDead(_3);
125+         StorageLive(_4);
126+         StorageLive(_5);
127+         StorageLive(_6);
128+         StorageLive(_7);
129+         _4 = SizeOf(std::vec::Vec<u32>);
130+         _5 = AlignOf(std::vec::Vec<u32>);
131+         StorageLive(_8);
132+         StorageLive(_10);
133+         StorageLive(_11);
134+         StorageLive(_12);
135+         StorageLive(_13);
136+         StorageLive(_14);
137+         _14 = _5 as std::ptr::Alignment (Transmute);
138+         _8 = Layout { size: _4, align: move _14 };
139+         StorageDead(_14);
140+         StorageLive(_9);
141+         _13 = const _;
142+         _9 = std::alloc::Global::alloc_impl(move _13, _8, const false) -> [return: bb5, unwind unreachable];
143      }
144  
145      bb1: {
146-         _1 = Box::<Vec<u32>>::new(move _2) -> [return: bb2, unwind unreachable];
147+         StorageDead(_1);
148+         return;
149      }
150  
151      bb2: {
152+         _12 = handle_alloc_error(move _8) -> unwind unreachable;
153+     }
154+ 
155+     bb3: {
156+         unreachable;
157+     }
158+ 
159+     bb4: {
160+         _11 = ((_9 as Ok).0: std::ptr::NonNull<[u8]>);
161+         StorageLive(_15);
162+         StorageLive(_16);
163+         StorageLive(_17);
164+         StorageLive(_18);
165+         _18 = (_11.0: *const [u8]);
166+         _17 = move _18 as *mut [u8] (PtrToPtr);
167+         StorageDead(_18);
168+         _16 = _17 as *mut u8 (PtrToPtr);
169+         StorageDead(_17);
170+         StorageLive(_19);
171+         StorageLive(_20);
172+         _19 = _16 as *const u8 (PointerCoercion(MutToConstPointer));
173+         _15 = NonNull::<u8> { pointer: _19 };
174+         StorageDead(_20);
175+         StorageDead(_19);
176+         StorageDead(_16);
177+         StorageLive(_21);
178+         _21 = (_15.0: *const u8);
179+         _6 = move _21 as *mut u8 (PtrToPtr);
180+         StorageDead(_21);
181+         StorageDead(_15);
182+         StorageDead(_9);
183+         StorageDead(_13);
184+         StorageDead(_12);
185+         StorageDead(_11);
186+         StorageDead(_10);
187+         StorageDead(_8);
188+         _1 = ShallowInitBox(move _6, std::vec::Vec<u32>);
189+         _7 = (((_1.0: std::ptr::Unique<std::vec::Vec<u32>>).0: std::ptr::NonNull<std::vec::Vec<u32>>).0: *const std::vec::Vec<u32>);
190+         (*_7) = move _2;
191+         StorageDead(_7);
192+         StorageDead(_6);
193+         StorageDead(_5);
194+         StorageDead(_4);
195          StorageDead(_2);
196          _0 = const ();
197-         drop(_1) -> [return: bb3, unwind unreachable];
198+         drop(_1) -> [return: bb1, unwind unreachable];
199      }
200  
201-     bb3: {
202-         StorageDead(_1);
203-         return;
204+     bb5: {
205+         _10 = discriminant(_9);
206+         switchInt(move _10) -> [0: bb4, 1: bb2, otherwise: bb3];
207      }
208  }
209