]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/const_prop/optimizes_into_variable/32bit/rustc.main.ConstProp.diff
const prop into operands
[rust.git] / src / test / mir-opt / const_prop / optimizes_into_variable / 32bit / 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/optimizes_into_variable.rs:11:11: 11:11
6       let _1: i32;                         // in scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
7       let mut _2: (i32, bool);             // in scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
8       let mut _4: [i32; 6];                // in scope 0 at $DIR/optimizes_into_variable.rs:13:13: 13:31
9       let _5: usize;                       // in scope 0 at $DIR/optimizes_into_variable.rs:13:32: 13:33
10       let mut _6: usize;                   // in scope 0 at $DIR/optimizes_into_variable.rs:13:13: 13:34
11       let mut _7: bool;                    // in scope 0 at $DIR/optimizes_into_variable.rs:13:13: 13:34
12       let mut _9: Point;                   // in scope 0 at $DIR/optimizes_into_variable.rs:14:13: 14:36
13       scope 1 {
14           debug x => _1;                   // in scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10
15           let _3: i32;                     // in scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
16           scope 2 {
17               debug y => _3;               // in scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10
18               let _8: u32;                 // in scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
19               scope 3 {
20                   debug z => _8;           // in scope 3 at $DIR/optimizes_into_variable.rs:14:9: 14:10
21               }
22           }
23       }
24   
25       bb0: {
26           StorageLive(_1);                 // scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
27 -         _2 = CheckedAdd(const 2_i32, const 2_i32); // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
28 +         _2 = (const 4_i32, const false); // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
29                                            // ty::Const
30                                            // + ty: i32
31 -                                          // + val: Value(Scalar(0x00000002))
32 +                                          // + val: Value(Scalar(0x00000004))
33                                            // mir::Constant
34 -                                          // + span: $DIR/optimizes_into_variable.rs:12:13: 12:14
35 -                                          // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
36 +                                          // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
37 +                                          // + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
38                                            // ty::Const
39 -                                          // + ty: i32
40 -                                          // + val: Value(Scalar(0x00000002))
41 +                                          // + ty: bool
42 +                                          // + val: Value(Scalar(0x00))
43                                            // mir::Constant
44 -                                          // + span: $DIR/optimizes_into_variable.rs:12:17: 12:18
45 -                                          // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
46 -         assert(!move (_2.1: bool), "attempt to compute `{} + {}` which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
47 +                                          // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
48 +                                          // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
49 +         assert(!const false, "attempt to compute `{} + {}` which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
50                                            // ty::Const
51 +                                          // + ty: bool
52 +                                          // + val: Value(Scalar(0x00))
53 +                                          // mir::Constant
54 +                                          // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
55 +                                          // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
56 +                                          // ty::Const
57                                            // + ty: i32
58                                            // + val: Value(Scalar(0x00000002))
59                                            // mir::Constant
60                                            // + span: $DIR/optimizes_into_variable.rs:12:13: 12:14
61                                            // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
62                                            // ty::Const
63                                            // + ty: i32
64                                            // + val: Value(Scalar(0x00000002))
65                                            // mir::Constant
66                                            // + span: $DIR/optimizes_into_variable.rs:12:17: 12:18
67                                            // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
68       }
69   
70       bb1: {
71 -         _1 = move (_2.0: i32);           // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
72 +         _1 = const 4_i32;                // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
73 +                                          // ty::Const
74 +                                          // + ty: i32
75 +                                          // + val: Value(Scalar(0x00000004))
76 +                                          // mir::Constant
77 +                                          // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
78 +                                          // + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
79           StorageLive(_3);                 // scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
80           StorageLive(_4);                 // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:31
81           _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:31
82                                            // ty::Const
83                                            // + ty: i32
84                                            // + val: Value(Scalar(0x00000000))
85                                            // mir::Constant
86                                            // + span: $DIR/optimizes_into_variable.rs:13:14: 13:15
87                                            // + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) }
88                                            // ty::Const
89                                            // + ty: i32
90                                            // + val: Value(Scalar(0x00000001))
91                                            // mir::Constant
92                                            // + span: $DIR/optimizes_into_variable.rs:13:17: 13:18
93                                            // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
94                                            // ty::Const
95                                            // + ty: i32
96                                            // + val: Value(Scalar(0x00000002))
97                                            // mir::Constant
98                                            // + span: $DIR/optimizes_into_variable.rs:13:20: 13:21
99                                            // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
100                                            // ty::Const
101                                            // + ty: i32
102                                            // + val: Value(Scalar(0x00000003))
103                                            // mir::Constant
104                                            // + span: $DIR/optimizes_into_variable.rs:13:23: 13:24
105                                            // + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
106                                            // ty::Const
107                                            // + ty: i32
108                                            // + val: Value(Scalar(0x00000004))
109                                            // mir::Constant
110                                            // + span: $DIR/optimizes_into_variable.rs:13:26: 13:27
111                                            // + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
112                                            // ty::Const
113                                            // + ty: i32
114                                            // + val: Value(Scalar(0x00000005))
115                                            // mir::Constant
116                                            // + span: $DIR/optimizes_into_variable.rs:13:29: 13:30
117                                            // + literal: Const { ty: i32, val: Value(Scalar(0x00000005)) }
118           StorageLive(_5);                 // scope 1 at $DIR/optimizes_into_variable.rs:13:32: 13:33
119           _5 = const 3_usize;              // scope 1 at $DIR/optimizes_into_variable.rs:13:32: 13:33
120                                            // ty::Const
121                                            // + ty: usize
122                                            // + val: Value(Scalar(0x00000003))
123                                            // mir::Constant
124                                            // + span: $DIR/optimizes_into_variable.rs:13:32: 13:33
125                                            // + literal: Const { ty: usize, val: Value(Scalar(0x00000003)) }
126           _6 = const 6_usize;              // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
127                                            // ty::Const
128                                            // + ty: usize
129                                            // + val: Value(Scalar(0x00000006))
130                                            // mir::Constant
131                                            // + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
132                                            // + literal: Const { ty: usize, val: Value(Scalar(0x00000006)) }
133 -         _7 = Lt(_5, _6);                 // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
134 -         assert(move _7, "index out of bounds: the len is {} but the index is {}", move _6, _5) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
135 +         _7 = const true;                 // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
136 +                                          // ty::Const
137 +                                          // + ty: bool
138 +                                          // + val: Value(Scalar(0x01))
139 +                                          // mir::Constant
140 +                                          // + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
141 +                                          // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
142 +         assert(const true, "index out of bounds: the len is {} but the index is {}", const 6_usize, const 3_usize) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
143 +                                          // ty::Const
144 +                                          // + ty: bool
145 +                                          // + val: Value(Scalar(0x01))
146 +                                          // mir::Constant
147 +                                          // + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
148 +                                          // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
149 +                                          // ty::Const
150 +                                          // + ty: usize
151 +                                          // + val: Value(Scalar(0x00000006))
152 +                                          // mir::Constant
153 +                                          // + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
154 +                                          // + literal: Const { ty: usize, val: Value(Scalar(0x00000006)) }
155 +                                          // ty::Const
156 +                                          // + ty: usize
157 +                                          // + val: Value(Scalar(0x00000003))
158 +                                          // mir::Constant
159 +                                          // + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
160 +                                          // + literal: Const { ty: usize, val: Value(Scalar(0x00000003)) }
161       }
162   
163       bb2: {
164 -         _3 = _4[_5];                     // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
165 +         _3 = const 3_i32;                // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
166 +                                          // ty::Const
167 +                                          // + ty: i32
168 +                                          // + val: Value(Scalar(0x00000003))
169 +                                          // mir::Constant
170 +                                          // + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
171 +                                          // + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
172           StorageDead(_5);                 // scope 1 at $DIR/optimizes_into_variable.rs:13:34: 13:35
173           StorageDead(_4);                 // scope 1 at $DIR/optimizes_into_variable.rs:13:34: 13:35
174           StorageLive(_8);                 // scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
175           StorageLive(_9);                 // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:36
176           _9 = Point { x: const 12_u32, y: const 42_u32 }; // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:36
177                                            // ty::Const
178                                            // + ty: u32
179                                            // + val: Value(Scalar(0x0000000c))
180                                            // mir::Constant
181                                            // + span: $DIR/optimizes_into_variable.rs:14:25: 14:27
182                                            // + literal: Const { ty: u32, val: Value(Scalar(0x0000000c)) }
183                                            // ty::Const
184                                            // + ty: u32
185                                            // + val: Value(Scalar(0x0000002a))
186                                            // mir::Constant
187                                            // + span: $DIR/optimizes_into_variable.rs:14:32: 14:34
188                                            // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
189 -         _8 = (_9.1: u32);                // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
190 +         _8 = const 42_u32;               // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
191 +                                          // ty::Const
192 +                                          // + ty: u32
193 +                                          // + val: Value(Scalar(0x0000002a))
194 +                                          // mir::Constant
195 +                                          // + span: $DIR/optimizes_into_variable.rs:14:13: 14:38
196 +                                          // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
197           StorageDead(_9);                 // scope 2 at $DIR/optimizes_into_variable.rs:14:38: 14:39
198           _0 = const ();                   // scope 0 at $DIR/optimizes_into_variable.rs:11:11: 15:2
199                                            // ty::Const
200                                            // + ty: ()
201                                            // + val: Value(Scalar(<ZST>))
202                                            // mir::Constant
203                                            // + span: $DIR/optimizes_into_variable.rs:11:11: 15:2
204                                            // + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
205           StorageDead(_8);                 // scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2
206           StorageDead(_3);                 // scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2
207           StorageDead(_1);                 // scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2
208           return;                          // scope 0 at $DIR/optimizes_into_variable.rs:15:2: 15:2
209       }
210   }
211