]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/const_prop/indirect/rustc.main.ConstProp.diff
const prop into operands
[rust.git] / src / test / mir-opt / const_prop / indirect / rustc.main.ConstProp.diff
1 - // MIR for `main` before ConstProp
2 + // MIR for `main` after ConstProp
3   
4   fn main() -> () {
5       let mut _0: ();                      // return place in scope 0 at $DIR/indirect.rs:4:11: 4:11
6       let _1: u8;                          // in scope 0 at $DIR/indirect.rs:5:9: 5:10
7       let mut _2: u8;                      // in scope 0 at $DIR/indirect.rs:5:13: 5:25
8       let mut _3: (u8, bool);              // in scope 0 at $DIR/indirect.rs:5:13: 5:29
9       scope 1 {
10           debug x => _1;                   // in scope 1 at $DIR/indirect.rs:5:9: 5:10
11       }
12   
13       bb0: {
14           StorageLive(_1);                 // scope 0 at $DIR/indirect.rs:5:9: 5:10
15           StorageLive(_2);                 // scope 0 at $DIR/indirect.rs:5:13: 5:25
16 -         _2 = const 2_u32 as u8 (Misc);   // scope 0 at $DIR/indirect.rs:5:13: 5:25
17 +         _2 = const 2_u8;                 // scope 0 at $DIR/indirect.rs:5:13: 5:25
18                                            // ty::Const
19 -                                          // + ty: u32
20 -                                          // + val: Value(Scalar(0x00000002))
21 +                                          // + ty: u8
22 +                                          // + val: Value(Scalar(0x02))
23                                            // mir::Constant
24 -                                          // + span: $DIR/indirect.rs:5:14: 5:18
25 -                                          // + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) }
26 -         _3 = CheckedAdd(_2, const 1_u8); // scope 0 at $DIR/indirect.rs:5:13: 5:29
27 +                                          // + span: $DIR/indirect.rs:5:13: 5:25
28 +                                          // + literal: Const { ty: u8, val: Value(Scalar(0x02)) }
29 +         _3 = (const 3_u8, const false);  // scope 0 at $DIR/indirect.rs:5:13: 5:29
30                                            // ty::Const
31                                            // + ty: u8
32 -                                          // + val: Value(Scalar(0x01))
33 +                                          // + val: Value(Scalar(0x03))
34                                            // mir::Constant
35 -                                          // + span: $DIR/indirect.rs:5:28: 5:29
36 -                                          // + literal: Const { ty: u8, val: Value(Scalar(0x01)) }
37 -         assert(!move (_3.1: bool), "attempt to compute `{} + {}` which would overflow", move _2, const 1_u8) -> bb1; // scope 0 at $DIR/indirect.rs:5:13: 5:29
38 +                                          // + span: $DIR/indirect.rs:5:13: 5:29
39 +                                          // + literal: Const { ty: u8, val: Value(Scalar(0x03)) }
40                                            // ty::Const
41 +                                          // + ty: bool
42 +                                          // + val: Value(Scalar(0x00))
43 +                                          // mir::Constant
44 +                                          // + span: $DIR/indirect.rs:5:13: 5:29
45 +                                          // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
46 +         assert(!const false, "attempt to compute `{} + {}` which would overflow", const 2_u8, const 1_u8) -> bb1; // scope 0 at $DIR/indirect.rs:5:13: 5:29
47 +                                          // ty::Const
48 +                                          // + ty: bool
49 +                                          // + val: Value(Scalar(0x00))
50 +                                          // mir::Constant
51 +                                          // + span: $DIR/indirect.rs:5:13: 5:29
52 +                                          // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
53 +                                          // ty::Const
54                                            // + ty: u8
55 +                                          // + val: Value(Scalar(0x02))
56 +                                          // mir::Constant
57 +                                          // + span: $DIR/indirect.rs:5:13: 5:29
58 +                                          // + literal: Const { ty: u8, val: Value(Scalar(0x02)) }
59 +                                          // ty::Const
60 +                                          // + ty: u8
61                                            // + val: Value(Scalar(0x01))
62                                            // mir::Constant
63                                            // + span: $DIR/indirect.rs:5:28: 5:29
64                                            // + literal: Const { ty: u8, val: Value(Scalar(0x01)) }
65       }
66   
67       bb1: {
68 -         _1 = move (_3.0: u8);            // scope 0 at $DIR/indirect.rs:5:13: 5:29
69 +         _1 = const 3_u8;                 // scope 0 at $DIR/indirect.rs:5:13: 5:29
70 +                                          // ty::Const
71 +                                          // + ty: u8
72 +                                          // + val: Value(Scalar(0x03))
73 +                                          // mir::Constant
74 +                                          // + span: $DIR/indirect.rs:5:13: 5:29
75 +                                          // + literal: Const { ty: u8, val: Value(Scalar(0x03)) }
76           StorageDead(_2);                 // scope 0 at $DIR/indirect.rs:5:28: 5:29
77           _0 = const ();                   // scope 0 at $DIR/indirect.rs:4:11: 6:2
78                                            // ty::Const
79                                            // + ty: ()
80                                            // + val: Value(Scalar(<ZST>))
81                                            // mir::Constant
82                                            // + span: $DIR/indirect.rs:4:11: 6:2
83                                            // + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
84           StorageDead(_1);                 // scope 0 at $DIR/indirect.rs:6:1: 6:2
85           return;                          // scope 0 at $DIR/indirect.rs:6:2: 6:2
86       }
87   }
88