1 - // MIR for `main` before ConstProp
2 + // MIR for `main` after ConstProp
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
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
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
20 debug z => _8; // in scope 3 at $DIR/optimizes_into_variable.rs:14:9: 14:10
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
31 - // + val: Value(Scalar(0x00000002))
32 + // + val: Value(Scalar(0x00000004))
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)) }
40 - // + val: Value(Scalar(0x00000002))
42 + // + val: Value(Scalar(0x00))
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
52 + // + val: Value(Scalar(0x00))
54 + // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
55 + // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
58 // + val: Value(Scalar(0x00000002))
60 // + span: $DIR/optimizes_into_variable.rs:12:13: 12:14
61 // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
64 // + val: Value(Scalar(0x00000002))
66 // + span: $DIR/optimizes_into_variable.rs:12:17: 12:18
67 // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
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
75 + // + val: Value(Scalar(0x00000004))
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
84 // + val: Value(Scalar(0x00000000))
86 // + span: $DIR/optimizes_into_variable.rs:13:14: 13:15
87 // + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) }
90 // + val: Value(Scalar(0x00000001))
92 // + span: $DIR/optimizes_into_variable.rs:13:17: 13:18
93 // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
96 // + val: Value(Scalar(0x00000002))
98 // + span: $DIR/optimizes_into_variable.rs:13:20: 13:21
99 // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
102 // + val: Value(Scalar(0x00000003))
104 // + span: $DIR/optimizes_into_variable.rs:13:23: 13:24
105 // + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
108 // + val: Value(Scalar(0x00000004))
110 // + span: $DIR/optimizes_into_variable.rs:13:26: 13:27
111 // + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
114 // + val: Value(Scalar(0x00000005))
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
122 // + val: Value(Scalar(0x0000000000000003))
124 // + span: $DIR/optimizes_into_variable.rs:13:32: 13:33
125 // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000003)) }
126 _6 = const 6_usize; // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
129 // + val: Value(Scalar(0x0000000000000006))
131 // + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
132 // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000006)) }
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
138 + // + val: Value(Scalar(0x01))
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 {}", move _6, _5) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
145 + // + val: Value(Scalar(0x01))
147 + // + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
148 + // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
152 - _3 = _4[_5]; // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
153 + _3 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
156 + // + val: Value(Scalar(0x00000003))
158 + // + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
159 + // + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
160 StorageDead(_5); // scope 1 at $DIR/optimizes_into_variable.rs:13:34: 13:35
161 StorageDead(_4); // scope 1 at $DIR/optimizes_into_variable.rs:13:34: 13:35
162 StorageLive(_8); // scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
163 StorageLive(_9); // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:36
164 _9 = Point { x: const 12_u32, y: const 42_u32 }; // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:36
167 // + val: Value(Scalar(0x0000000c))
169 // + span: $DIR/optimizes_into_variable.rs:14:25: 14:27
170 // + literal: Const { ty: u32, val: Value(Scalar(0x0000000c)) }
173 // + val: Value(Scalar(0x0000002a))
175 // + span: $DIR/optimizes_into_variable.rs:14:32: 14:34
176 // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
177 - _8 = (_9.1: u32); // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
178 + _8 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
181 + // + val: Value(Scalar(0x0000002a))
183 + // + span: $DIR/optimizes_into_variable.rs:14:13: 14:38
184 + // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
185 StorageDead(_9); // scope 2 at $DIR/optimizes_into_variable.rs:14:38: 14:39
186 _0 = const (); // scope 0 at $DIR/optimizes_into_variable.rs:11:11: 15:2
189 // + val: Value(Scalar(<ZST>))
191 // + span: $DIR/optimizes_into_variable.rs:11:11: 15:2
192 // + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
193 StorageDead(_8); // scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2
194 StorageDead(_3); // scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2
195 StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2
196 return; // scope 0 at $DIR/optimizes_into_variable.rs:15:2: 15:2