fork/rust

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

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

master
12.6 KiB389 linesraw
1- // MIR for `arithmetic_checked` before GVN
2+ // MIR for `arithmetic_checked` after GVN
3  
4  fn arithmetic_checked(_1: u64) -> () {
5      debug x => _1;
6      let mut _0: ();
7      let _2: ();
8      let mut _3: u64;
9      let mut _4: u64;
10      let mut _5: (u64, bool);
11      let _6: ();
12      let mut _7: u64;
13      let mut _8: u64;
14      let mut _9: (u64, bool);
15      let _10: ();
16      let mut _11: u64;
17      let mut _12: u64;
18      let mut _13: (u64, bool);
19      let _14: ();
20      let mut _15: u64;
21      let mut _16: u64;
22      let mut _17: (u64, bool);
23      let _18: ();
24      let mut _19: u64;
25      let mut _20: u64;
26      let mut _21: bool;
27      let _22: ();
28      let mut _23: u64;
29      let mut _24: u64;
30      let mut _25: bool;
31      let _26: ();
32      let mut _27: u64;
33      let mut _28: u64;
34      let mut _29: bool;
35      let _30: ();
36      let mut _31: u64;
37      let mut _32: u64;
38      let mut _33: bool;
39      let _34: ();
40      let mut _35: u64;
41      let mut _36: u64;
42      let mut _37: bool;
43      let _38: ();
44      let mut _39: u64;
45      let mut _40: u64;
46      let mut _41: bool;
47      let _42: ();
48      let mut _43: u64;
49      let mut _44: u64;
50      let mut _45: bool;
51      let _46: ();
52      let mut _47: u64;
53      let mut _48: u64;
54      let mut _49: bool;
55      let _50: ();
56      let mut _51: u64;
57      let mut _52: u64;
58      let _53: ();
59      let mut _54: u64;
60      let mut _55: u64;
61      let _56: ();
62      let mut _57: u64;
63      let mut _58: u64;
64      let _59: ();
65      let mut _60: u64;
66      let mut _61: u64;
67      let mut _62: u32;
68      let mut _63: bool;
69      let _64: ();
70      let mut _65: u64;
71      let mut _66: u64;
72      let mut _67: u32;
73      let mut _68: bool;
74  
75      bb0: {
76          StorageLive(_2);
77          StorageLive(_3);
78-         StorageLive(_4);
79-         _4 = _1;
80-         _5 = CheckedAdd(_4, const 0_u64);
81-         assert(!move (_5.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, const 0_u64) -> [success: bb1, unwind continue];
82+         _5 = CheckedAdd(_1, const 0_u64);
83+         assert(!move (_5.1: bool), "attempt to compute `{} + {}`, which would overflow", _1, const 0_u64) -> [success: bb1, unwind continue];
84      }
85  
86      bb1: {
87          _3 = move (_5.0: u64);
88-         StorageDead(_4);
89          _2 = opaque::<u64>(move _3) -> [return: bb2, unwind continue];
90      }
91  
92      bb2: {
93          StorageDead(_3);
94          StorageDead(_2);
95          StorageLive(_6);
96          StorageLive(_7);
97-         StorageLive(_8);
98-         _8 = _1;
99-         _9 = CheckedSub(_8, const 0_u64);
100-         assert(!move (_9.1: bool), "attempt to compute `{} - {}`, which would overflow", move _8, const 0_u64) -> [success: bb3, unwind continue];
101+         _9 = CheckedSub(_1, const 0_u64);
102+         assert(!move (_9.1: bool), "attempt to compute `{} - {}`, which would overflow", _1, const 0_u64) -> [success: bb3, unwind continue];
103      }
104  
105      bb3: {
106          _7 = move (_9.0: u64);
107-         StorageDead(_8);
108          _6 = opaque::<u64>(move _7) -> [return: bb4, unwind continue];
109      }
110  
111      bb4: {
112          StorageDead(_7);
113          StorageDead(_6);
114          StorageLive(_10);
115          StorageLive(_11);
116-         StorageLive(_12);
117-         _12 = _1;
118-         _13 = CheckedMul(_12, const 0_u64);
119-         assert(!move (_13.1: bool), "attempt to compute `{} * {}`, which would overflow", move _12, const 0_u64) -> [success: bb5, unwind continue];
120+         _13 = CheckedMul(_1, const 0_u64);
121+         assert(!move (_13.1: bool), "attempt to compute `{} * {}`, which would overflow", _1, const 0_u64) -> [success: bb5, unwind continue];
122      }
123  
124      bb5: {
125          _11 = move (_13.0: u64);
126-         StorageDead(_12);
127          _10 = opaque::<u64>(move _11) -> [return: bb6, unwind continue];
128      }
129  
130      bb6: {
131          StorageDead(_11);
132          StorageDead(_10);
133          StorageLive(_14);
134          StorageLive(_15);
135-         StorageLive(_16);
136-         _16 = _1;
137-         _17 = CheckedMul(_16, const 1_u64);
138-         assert(!move (_17.1: bool), "attempt to compute `{} * {}`, which would overflow", move _16, const 1_u64) -> [success: bb7, unwind continue];
139+         _17 = CheckedMul(_1, const 1_u64);
140+         assert(!move (_17.1: bool), "attempt to compute `{} * {}`, which would overflow", _1, const 1_u64) -> [success: bb7, unwind continue];
141      }
142  
143      bb7: {
144          _15 = move (_17.0: u64);
145-         StorageDead(_16);
146          _14 = opaque::<u64>(move _15) -> [return: bb8, unwind continue];
147      }
148  
149      bb8: {
150          StorageDead(_15);
151          StorageDead(_14);
152          StorageLive(_18);
153          StorageLive(_19);
154-         StorageLive(_20);
155-         _20 = _1;
156          _21 = Eq(const 0_u64, const 0_u64);
157-         assert(!move _21, "attempt to divide `{}` by zero", _20) -> [success: bb9, unwind continue];
158+         assert(!_21, "attempt to divide `{}` by zero", _1) -> [success: bb9, unwind continue];
159      }
160  
161      bb9: {
162-         _19 = Div(move _20, const 0_u64);
163-         StorageDead(_20);
164+         _19 = Div(_1, const 0_u64);
165          _18 = opaque::<u64>(move _19) -> [return: bb10, unwind continue];
166      }
167  
168      bb10: {
169          StorageDead(_19);
170          StorageDead(_18);
171          StorageLive(_22);
172          StorageLive(_23);
173-         StorageLive(_24);
174-         _24 = _1;
175          _25 = Eq(const 1_u64, const 0_u64);
176-         assert(!move _25, "attempt to divide `{}` by zero", _24) -> [success: bb11, unwind continue];
177+         assert(!_25, "attempt to divide `{}` by zero", _1) -> [success: bb11, unwind continue];
178      }
179  
180      bb11: {
181-         _23 = Div(move _24, const 1_u64);
182-         StorageDead(_24);
183+         _23 = Div(_1, const 1_u64);
184          _22 = opaque::<u64>(move _23) -> [return: bb12, unwind continue];
185      }
186  
187      bb12: {
188          StorageDead(_23);
189          StorageDead(_22);
190          StorageLive(_26);
191          StorageLive(_27);
192-         StorageLive(_28);
193-         _28 = _1;
194-         _29 = Eq(_28, const 0_u64);
195-         assert(!move _29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb13, unwind continue];
196+         _29 = Eq(_1, const 0_u64);
197+         assert(!_29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb13, unwind continue];
198      }
199  
200      bb13: {
201-         _27 = Div(const 0_u64, move _28);
202-         StorageDead(_28);
203+         _27 = Div(const 0_u64, _1);
204          _26 = opaque::<u64>(move _27) -> [return: bb14, unwind continue];
205      }
206  
207      bb14: {
208          StorageDead(_27);
209          StorageDead(_26);
210          StorageLive(_30);
211          StorageLive(_31);
212-         StorageLive(_32);
213-         _32 = _1;
214-         _33 = Eq(_32, const 0_u64);
215-         assert(!move _33, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb15, unwind continue];
216+         assert(!_29, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb15, unwind continue];
217      }
218  
219      bb15: {
220-         _31 = Div(const 1_u64, move _32);
221-         StorageDead(_32);
222+         _31 = Div(const 1_u64, _1);
223          _30 = opaque::<u64>(move _31) -> [return: bb16, unwind continue];
224      }
225  
226      bb16: {
227          StorageDead(_31);
228          StorageDead(_30);
229          StorageLive(_34);
230          StorageLive(_35);
231-         StorageLive(_36);
232-         _36 = _1;
233-         _37 = Eq(const 0_u64, const 0_u64);
234-         assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", _36) -> [success: bb17, unwind continue];
235+         assert(!_21, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb17, unwind continue];
236      }
237  
238      bb17: {
239-         _35 = Rem(move _36, const 0_u64);
240-         StorageDead(_36);
241+         _35 = Rem(_1, const 0_u64);
242          _34 = opaque::<u64>(move _35) -> [return: bb18, unwind continue];
243      }
244  
245      bb18: {
246          StorageDead(_35);
247          StorageDead(_34);
248          StorageLive(_38);
249          StorageLive(_39);
250-         StorageLive(_40);
251-         _40 = _1;
252-         _41 = Eq(const 1_u64, const 0_u64);
253-         assert(!move _41, "attempt to calculate the remainder of `{}` with a divisor of zero", _40) -> [success: bb19, unwind continue];
254+         assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb19, unwind continue];
255      }
256  
257      bb19: {
258-         _39 = Rem(move _40, const 1_u64);
259-         StorageDead(_40);
260+         _39 = Rem(_1, const 1_u64);
261          _38 = opaque::<u64>(move _39) -> [return: bb20, unwind continue];
262      }
263  
264      bb20: {
265          StorageDead(_39);
266          StorageDead(_38);
267          StorageLive(_42);
268          StorageLive(_43);
269-         StorageLive(_44);
270-         _44 = _1;
271-         _45 = Eq(_44, const 0_u64);
272-         assert(!move _45, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb21, unwind continue];
273+         assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb21, unwind continue];
274      }
275  
276      bb21: {
277-         _43 = Rem(const 0_u64, move _44);
278-         StorageDead(_44);
279+         _43 = Rem(const 0_u64, _1);
280          _42 = opaque::<u64>(move _43) -> [return: bb22, unwind continue];
281      }
282  
283      bb22: {
284          StorageDead(_43);
285          StorageDead(_42);
286          StorageLive(_46);
287          StorageLive(_47);
288-         StorageLive(_48);
289-         _48 = _1;
290-         _49 = Eq(_48, const 0_u64);
291-         assert(!move _49, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb23, unwind continue];
292+         assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb23, unwind continue];
293      }
294  
295      bb23: {
296-         _47 = Rem(const 1_u64, move _48);
297-         StorageDead(_48);
298+         _47 = Rem(const 1_u64, _1);
299          _46 = opaque::<u64>(move _47) -> [return: bb24, unwind continue];
300      }
301  
302      bb24: {
303          StorageDead(_47);
304          StorageDead(_46);
305          StorageLive(_50);
306          StorageLive(_51);
307-         StorageLive(_52);
308-         _52 = _1;
309-         _51 = BitAnd(move _52, const 0_u64);
310-         StorageDead(_52);
311+         _51 = BitAnd(_1, const 0_u64);
312          _50 = opaque::<u64>(move _51) -> [return: bb25, unwind continue];
313      }
314  
315      bb25: {
316          StorageDead(_51);
317          StorageDead(_50);
318          StorageLive(_53);
319          StorageLive(_54);
320-         StorageLive(_55);
321-         _55 = _1;
322-         _54 = BitOr(move _55, const 0_u64);
323-         StorageDead(_55);
324+         _54 = BitOr(_1, const 0_u64);
325          _53 = opaque::<u64>(move _54) -> [return: bb26, unwind continue];
326      }
327  
328      bb26: {
329          StorageDead(_54);
330          StorageDead(_53);
331          StorageLive(_56);
332          StorageLive(_57);
333-         StorageLive(_58);
334-         _58 = _1;
335-         _57 = BitXor(move _58, const 0_u64);
336-         StorageDead(_58);
337+         _57 = BitXor(_1, const 0_u64);
338          _56 = opaque::<u64>(move _57) -> [return: bb27, unwind continue];
339      }
340  
341      bb27: {
342          StorageDead(_57);
343          StorageDead(_56);
344          StorageLive(_59);
345          StorageLive(_60);
346-         StorageLive(_61);
347-         _61 = _1;
348          _62 = const 0_i32 as u32 (IntToInt);
349-         _63 = Lt(move _62, const 64_u32);
350-         assert(move _63, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb28, unwind continue];
351+         _63 = Lt(_62, const 64_u32);
352+         assert(_63, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb28, unwind continue];
353      }
354  
355      bb28: {
356-         _60 = Shr(move _61, const 0_i32);
357-         StorageDead(_61);
358+         _60 = Shr(_1, const 0_i32);
359          _59 = opaque::<u64>(move _60) -> [return: bb29, unwind continue];
360      }
361  
362      bb29: {
363          StorageDead(_60);
364          StorageDead(_59);
365          StorageLive(_64);
366          StorageLive(_65);
367-         StorageLive(_66);
368-         _66 = _1;
369-         _67 = const 0_i32 as u32 (IntToInt);
370-         _68 = Lt(move _67, const 64_u32);
371-         assert(move _68, "attempt to shift left by `{}`, which would overflow", const 0_i32) -> [success: bb30, unwind continue];
372+         assert(_63, "attempt to shift left by `{}`, which would overflow", const 0_i32) -> [success: bb30, unwind continue];
373      }
374  
375      bb30: {
376-         _65 = Shl(move _66, const 0_i32);
377-         StorageDead(_66);
378+         _65 = Shl(_1, const 0_i32);
379          _64 = opaque::<u64>(move _65) -> [return: bb31, unwind continue];
380      }
381  
382      bb31: {
383          StorageDead(_65);
384          StorageDead(_64);
385          _0 = const ();
386          return;
387      }
388  }
389