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