提交 e0bb75ef 编写于 作者: A Ana-Maria Mihalache

Add EMIT_MIR_FOR_EACH_BIT_WIDTH to tests that need it.

上级 688a4ddd
...@@ -7,6 +7,7 @@ unsafe fn foo(z: *mut usize) -> u32 { ...@@ -7,6 +7,7 @@ unsafe fn foo(z: *mut usize) -> u32 {
99 99
} }
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR rustc.main.SimplifyCfg-elaborate-drops.after.mir // EMIT_MIR rustc.main.SimplifyCfg-elaborate-drops.after.mir
fn main() { fn main() {
let mut x = [42, 43, 44]; let mut x = [42, 43, 44];
......
// MIR for `main` after SimplifyCfg-elaborate-drops
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/array-index-is-temporary.rs:12:11: 12:11
let mut _1: [u32; 3]; // in scope 0 at $DIR/array-index-is-temporary.rs:13:9: 13:14
let mut _4: &mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:15:25: 15:31
let mut _5: u32; // in scope 0 at $DIR/array-index-is-temporary.rs:16:12: 16:29
let mut _6: *mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:16:25: 16:26
let _7: usize; // in scope 0 at $DIR/array-index-is-temporary.rs:16:7: 16:8
let mut _8: usize; // in scope 0 at $DIR/array-index-is-temporary.rs:16:5: 16:9
let mut _9: bool; // in scope 0 at $DIR/array-index-is-temporary.rs:16:5: 16:9
scope 1 {
debug x => _1; // in scope 1 at $DIR/array-index-is-temporary.rs:13:9: 13:14
let mut _2: usize; // in scope 1 at $DIR/array-index-is-temporary.rs:14:9: 14:14
scope 2 {
debug y => _2; // in scope 2 at $DIR/array-index-is-temporary.rs:14:9: 14:14
let _3: *mut usize as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10
scope 3 {
debug z => _3; // in scope 3 at $DIR/array-index-is-temporary.rs:15:9: 15:10
scope 4 {
}
}
}
}
bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/array-index-is-temporary.rs:13:9: 13:14
_1 = [const 42u32, const 43u32, const 44u32]; // bb0[1]: scope 0 at $DIR/array-index-is-temporary.rs:13:17: 13:29
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x0000002a))
// mir::Constant
// + span: $DIR/array-index-is-temporary.rs:13:18: 13:20
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x0000002b))
// mir::Constant
// + span: $DIR/array-index-is-temporary.rs:13:22: 13:24
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002b)) }
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x0000002c))
// mir::Constant
// + span: $DIR/array-index-is-temporary.rs:13:26: 13:28
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002c)) }
StorageLive(_2); // bb0[2]: scope 1 at $DIR/array-index-is-temporary.rs:14:9: 14:14
_2 = const 1usize; // bb0[3]: scope 1 at $DIR/array-index-is-temporary.rs:14:17: 14:18
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000001))
// mir::Constant
// + span: $DIR/array-index-is-temporary.rs:14:17: 14:18
// + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) }
StorageLive(_3); // bb0[4]: scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10
StorageLive(_4); // bb0[5]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
_4 = &mut _2; // bb0[6]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
_3 = &raw mut (*_4); // bb0[7]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
StorageDead(_4); // bb0[8]: scope 2 at $DIR/array-index-is-temporary.rs:15:31: 15:32
StorageLive(_5); // bb0[9]: scope 3 at $DIR/array-index-is-temporary.rs:16:12: 16:29
StorageLive(_6); // bb0[10]: scope 4 at $DIR/array-index-is-temporary.rs:16:25: 16:26
_6 = _3; // bb0[11]: scope 4 at $DIR/array-index-is-temporary.rs:16:25: 16:26
_5 = const foo(move _6) -> bb1; // bb0[12]: scope 4 at $DIR/array-index-is-temporary.rs:16:21: 16:27
// ty::Const
// + ty: unsafe fn(*mut usize) -> u32 {foo}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/array-index-is-temporary.rs:16:21: 16:24
// + literal: Const { ty: unsafe fn(*mut usize) -> u32 {foo}, val: Value(Scalar(<ZST>)) }
}
bb1: {
StorageDead(_6); // bb1[0]: scope 4 at $DIR/array-index-is-temporary.rs:16:26: 16:27
StorageLive(_7); // bb1[1]: scope 3 at $DIR/array-index-is-temporary.rs:16:7: 16:8
_7 = _2; // bb1[2]: scope 3 at $DIR/array-index-is-temporary.rs:16:7: 16:8
_8 = Len(_1); // bb1[3]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
_9 = Lt(_7, _8); // bb1[4]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
assert(move _9, "index out of bounds: the len is move _8 but the index is _7") -> bb2; // bb1[5]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
}
bb2: {
_1[_7] = move _5; // bb2[0]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:29
StorageDead(_5); // bb2[1]: scope 3 at $DIR/array-index-is-temporary.rs:16:28: 16:29
StorageDead(_7); // bb2[2]: scope 3 at $DIR/array-index-is-temporary.rs:16:29: 16:30
_0 = (); // bb2[3]: scope 0 at $DIR/array-index-is-temporary.rs:12:11: 17:2
StorageDead(_3); // bb2[4]: scope 2 at $DIR/array-index-is-temporary.rs:17:1: 17:2
StorageDead(_2); // bb2[5]: scope 1 at $DIR/array-index-is-temporary.rs:17:1: 17:2
StorageDead(_1); // bb2[6]: scope 0 at $DIR/array-index-is-temporary.rs:17:1: 17:2
return; // bb2[7]: scope 0 at $DIR/array-index-is-temporary.rs:17:2: 17:2
}
}
// MIR for `main` after SimplifyCfg-elaborate-drops // MIR for `main` after SimplifyCfg-elaborate-drops
fn main() -> () { fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/array-index-is-temporary.rs:11:11: 11:11 let mut _0: (); // return place in scope 0 at $DIR/array-index-is-temporary.rs:12:11: 12:11
let mut _1: [u32; 3]; // in scope 0 at $DIR/array-index-is-temporary.rs:12:9: 12:14 let mut _1: [u32; 3]; // in scope 0 at $DIR/array-index-is-temporary.rs:13:9: 13:14
let mut _4: &mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:14:25: 14:31 let mut _4: &mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:15:25: 15:31
let mut _5: u32; // in scope 0 at $DIR/array-index-is-temporary.rs:15:12: 15:29 let mut _5: u32; // in scope 0 at $DIR/array-index-is-temporary.rs:16:12: 16:29
let mut _6: *mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:15:25: 15:26 let mut _6: *mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:16:25: 16:26
let _7: usize; // in scope 0 at $DIR/array-index-is-temporary.rs:15:7: 15:8 let _7: usize; // in scope 0 at $DIR/array-index-is-temporary.rs:16:7: 16:8
let mut _8: usize; // in scope 0 at $DIR/array-index-is-temporary.rs:15:5: 15:9 let mut _8: usize; // in scope 0 at $DIR/array-index-is-temporary.rs:16:5: 16:9
let mut _9: bool; // in scope 0 at $DIR/array-index-is-temporary.rs:15:5: 15:9 let mut _9: bool; // in scope 0 at $DIR/array-index-is-temporary.rs:16:5: 16:9
scope 1 { scope 1 {
debug x => _1; // in scope 1 at $DIR/array-index-is-temporary.rs:12:9: 12:14 debug x => _1; // in scope 1 at $DIR/array-index-is-temporary.rs:13:9: 13:14
let mut _2: usize; // in scope 1 at $DIR/array-index-is-temporary.rs:13:9: 13:14 let mut _2: usize; // in scope 1 at $DIR/array-index-is-temporary.rs:14:9: 14:14
scope 2 { scope 2 {
debug y => _2; // in scope 2 at $DIR/array-index-is-temporary.rs:13:9: 13:14 debug y => _2; // in scope 2 at $DIR/array-index-is-temporary.rs:14:9: 14:14
let _3: *mut usize as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 2 at $DIR/array-index-is-temporary.rs:14:9: 14:10 let _3: *mut usize as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10
scope 3 { scope 3 {
debug z => _3; // in scope 3 at $DIR/array-index-is-temporary.rs:14:9: 14:10 debug z => _3; // in scope 3 at $DIR/array-index-is-temporary.rs:15:9: 15:10
scope 4 { scope 4 {
} }
} }
...@@ -24,68 +24,68 @@ fn main() -> () { ...@@ -24,68 +24,68 @@ fn main() -> () {
} }
bb0: { bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/array-index-is-temporary.rs:12:9: 12:14 StorageLive(_1); // bb0[0]: scope 0 at $DIR/array-index-is-temporary.rs:13:9: 13:14
_1 = [const 42u32, const 43u32, const 44u32]; // bb0[1]: scope 0 at $DIR/array-index-is-temporary.rs:12:17: 12:29 _1 = [const 42u32, const 43u32, const 44u32]; // bb0[1]: scope 0 at $DIR/array-index-is-temporary.rs:13:17: 13:29
// ty::Const // ty::Const
// + ty: u32 // + ty: u32
// + val: Value(Scalar(0x0000002a)) // + val: Value(Scalar(0x0000002a))
// mir::Constant // mir::Constant
// + span: $DIR/array-index-is-temporary.rs:12:18: 12:20 // + span: $DIR/array-index-is-temporary.rs:13:18: 13:20
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) } // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
// ty::Const // ty::Const
// + ty: u32 // + ty: u32
// + val: Value(Scalar(0x0000002b)) // + val: Value(Scalar(0x0000002b))
// mir::Constant // mir::Constant
// + span: $DIR/array-index-is-temporary.rs:12:22: 12:24 // + span: $DIR/array-index-is-temporary.rs:13:22: 13:24
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002b)) } // + literal: Const { ty: u32, val: Value(Scalar(0x0000002b)) }
// ty::Const // ty::Const
// + ty: u32 // + ty: u32
// + val: Value(Scalar(0x0000002c)) // + val: Value(Scalar(0x0000002c))
// mir::Constant // mir::Constant
// + span: $DIR/array-index-is-temporary.rs:12:26: 12:28 // + span: $DIR/array-index-is-temporary.rs:13:26: 13:28
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002c)) } // + literal: Const { ty: u32, val: Value(Scalar(0x0000002c)) }
StorageLive(_2); // bb0[2]: scope 1 at $DIR/array-index-is-temporary.rs:13:9: 13:14 StorageLive(_2); // bb0[2]: scope 1 at $DIR/array-index-is-temporary.rs:14:9: 14:14
_2 = const 1usize; // bb0[3]: scope 1 at $DIR/array-index-is-temporary.rs:13:17: 13:18 _2 = const 1usize; // bb0[3]: scope 1 at $DIR/array-index-is-temporary.rs:14:17: 14:18
// ty::Const // ty::Const
// + ty: usize // + ty: usize
// + val: Value(Scalar(0x0000000000000001)) // + val: Value(Scalar(0x0000000000000001))
// mir::Constant // mir::Constant
// + span: $DIR/array-index-is-temporary.rs:13:17: 13:18 // + span: $DIR/array-index-is-temporary.rs:14:17: 14:18
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) }
StorageLive(_3); // bb0[4]: scope 2 at $DIR/array-index-is-temporary.rs:14:9: 14:10 StorageLive(_3); // bb0[4]: scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10
StorageLive(_4); // bb0[5]: scope 2 at $DIR/array-index-is-temporary.rs:14:25: 14:31 StorageLive(_4); // bb0[5]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
_4 = &mut _2; // bb0[6]: scope 2 at $DIR/array-index-is-temporary.rs:14:25: 14:31 _4 = &mut _2; // bb0[6]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
_3 = &raw mut (*_4); // bb0[7]: scope 2 at $DIR/array-index-is-temporary.rs:14:25: 14:31 _3 = &raw mut (*_4); // bb0[7]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
StorageDead(_4); // bb0[8]: scope 2 at $DIR/array-index-is-temporary.rs:14:31: 14:32 StorageDead(_4); // bb0[8]: scope 2 at $DIR/array-index-is-temporary.rs:15:31: 15:32
StorageLive(_5); // bb0[9]: scope 3 at $DIR/array-index-is-temporary.rs:15:12: 15:29 StorageLive(_5); // bb0[9]: scope 3 at $DIR/array-index-is-temporary.rs:16:12: 16:29
StorageLive(_6); // bb0[10]: scope 4 at $DIR/array-index-is-temporary.rs:15:25: 15:26 StorageLive(_6); // bb0[10]: scope 4 at $DIR/array-index-is-temporary.rs:16:25: 16:26
_6 = _3; // bb0[11]: scope 4 at $DIR/array-index-is-temporary.rs:15:25: 15:26 _6 = _3; // bb0[11]: scope 4 at $DIR/array-index-is-temporary.rs:16:25: 16:26
_5 = const foo(move _6) -> bb1; // bb0[12]: scope 4 at $DIR/array-index-is-temporary.rs:15:21: 15:27 _5 = const foo(move _6) -> bb1; // bb0[12]: scope 4 at $DIR/array-index-is-temporary.rs:16:21: 16:27
// ty::Const // ty::Const
// + ty: unsafe fn(*mut usize) -> u32 {foo} // + ty: unsafe fn(*mut usize) -> u32 {foo}
// + val: Value(Scalar(<ZST>)) // + val: Value(Scalar(<ZST>))
// mir::Constant // mir::Constant
// + span: $DIR/array-index-is-temporary.rs:15:21: 15:24 // + span: $DIR/array-index-is-temporary.rs:16:21: 16:24
// + literal: Const { ty: unsafe fn(*mut usize) -> u32 {foo}, val: Value(Scalar(<ZST>)) } // + literal: Const { ty: unsafe fn(*mut usize) -> u32 {foo}, val: Value(Scalar(<ZST>)) }
} }
bb1: { bb1: {
StorageDead(_6); // bb1[0]: scope 4 at $DIR/array-index-is-temporary.rs:15:26: 15:27 StorageDead(_6); // bb1[0]: scope 4 at $DIR/array-index-is-temporary.rs:16:26: 16:27
StorageLive(_7); // bb1[1]: scope 3 at $DIR/array-index-is-temporary.rs:15:7: 15:8 StorageLive(_7); // bb1[1]: scope 3 at $DIR/array-index-is-temporary.rs:16:7: 16:8
_7 = _2; // bb1[2]: scope 3 at $DIR/array-index-is-temporary.rs:15:7: 15:8 _7 = _2; // bb1[2]: scope 3 at $DIR/array-index-is-temporary.rs:16:7: 16:8
_8 = Len(_1); // bb1[3]: scope 3 at $DIR/array-index-is-temporary.rs:15:5: 15:9 _8 = Len(_1); // bb1[3]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
_9 = Lt(_7, _8); // bb1[4]: scope 3 at $DIR/array-index-is-temporary.rs:15:5: 15:9 _9 = Lt(_7, _8); // bb1[4]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
assert(move _9, "index out of bounds: the len is move _8 but the index is _7") -> bb2; // bb1[5]: scope 3 at $DIR/array-index-is-temporary.rs:15:5: 15:9 assert(move _9, "index out of bounds: the len is move _8 but the index is _7") -> bb2; // bb1[5]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
} }
bb2: { bb2: {
_1[_7] = move _5; // bb2[0]: scope 3 at $DIR/array-index-is-temporary.rs:15:5: 15:29 _1[_7] = move _5; // bb2[0]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:29
StorageDead(_5); // bb2[1]: scope 3 at $DIR/array-index-is-temporary.rs:15:28: 15:29 StorageDead(_5); // bb2[1]: scope 3 at $DIR/array-index-is-temporary.rs:16:28: 16:29
StorageDead(_7); // bb2[2]: scope 3 at $DIR/array-index-is-temporary.rs:15:29: 15:30 StorageDead(_7); // bb2[2]: scope 3 at $DIR/array-index-is-temporary.rs:16:29: 16:30
_0 = (); // bb2[3]: scope 0 at $DIR/array-index-is-temporary.rs:11:11: 16:2 _0 = (); // bb2[3]: scope 0 at $DIR/array-index-is-temporary.rs:12:11: 17:2
StorageDead(_3); // bb2[4]: scope 2 at $DIR/array-index-is-temporary.rs:16:1: 16:2 StorageDead(_3); // bb2[4]: scope 2 at $DIR/array-index-is-temporary.rs:17:1: 17:2
StorageDead(_2); // bb2[5]: scope 1 at $DIR/array-index-is-temporary.rs:16:1: 16:2 StorageDead(_2); // bb2[5]: scope 1 at $DIR/array-index-is-temporary.rs:17:1: 17:2
StorageDead(_1); // bb2[6]: scope 0 at $DIR/array-index-is-temporary.rs:16:1: 16:2 StorageDead(_1); // bb2[6]: scope 0 at $DIR/array-index-is-temporary.rs:17:1: 17:2
return; // bb2[7]: scope 0 at $DIR/array-index-is-temporary.rs:16:2: 16:2 return; // bb2[7]: scope 0 at $DIR/array-index-is-temporary.rs:17:2: 17:2
} }
} }
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR rustc.norm2.InstCombine.diff // EMIT_MIR rustc.norm2.InstCombine.diff
fn norm2(x: [f32; 2]) -> f32 { fn norm2(x: [f32; 2]) -> f32 {
......
- // MIR for `norm2` before InstCombine
+ // MIR for `norm2` after InstCombine
fn norm2(_1: [f32; 2]) -> f32 {
debug x => _1; // in scope 0 at $DIR/combine_array_len.rs:4:10: 4:11
let mut _0: f32; // return place in scope 0 at $DIR/combine_array_len.rs:4:26: 4:29
let _2: f32; // in scope 0 at $DIR/combine_array_len.rs:5:9: 5:10
let _3: usize; // in scope 0 at $DIR/combine_array_len.rs:5:15: 5:16
let mut _4: usize; // in scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
let mut _5: bool; // in scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
let _7: usize; // in scope 0 at $DIR/combine_array_len.rs:6:15: 6:16
let mut _8: usize; // in scope 0 at $DIR/combine_array_len.rs:6:13: 6:17
let mut _9: bool; // in scope 0 at $DIR/combine_array_len.rs:6:13: 6:17
let mut _10: f32; // in scope 0 at $DIR/combine_array_len.rs:7:5: 7:8
let mut _11: f32; // in scope 0 at $DIR/combine_array_len.rs:7:5: 7:6
let mut _12: f32; // in scope 0 at $DIR/combine_array_len.rs:7:7: 7:8
let mut _13: f32; // in scope 0 at $DIR/combine_array_len.rs:7:11: 7:14
let mut _14: f32; // in scope 0 at $DIR/combine_array_len.rs:7:11: 7:12
let mut _15: f32; // in scope 0 at $DIR/combine_array_len.rs:7:13: 7:14
scope 1 {
debug a => _2; // in scope 1 at $DIR/combine_array_len.rs:5:9: 5:10
let _6: f32; // in scope 1 at $DIR/combine_array_len.rs:6:9: 6:10
scope 2 {
debug b => _6; // in scope 2 at $DIR/combine_array_len.rs:6:9: 6:10
}
}
bb0: {
StorageLive(_2); // bb0[0]: scope 0 at $DIR/combine_array_len.rs:5:9: 5:10
StorageLive(_3); // bb0[1]: scope 0 at $DIR/combine_array_len.rs:5:15: 5:16
_3 = const 0usize; // bb0[2]: scope 0 at $DIR/combine_array_len.rs:5:15: 5:16
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000000))
// mir::Constant
// + span: $DIR/combine_array_len.rs:5:15: 5:16
// + literal: Const { ty: usize, val: Value(Scalar(0x00000000)) }
- _4 = Len(_1); // bb0[3]: scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
+ _4 = const 2usize; // bb0[3]: scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
+ // ty::Const
+ // + ty: usize
+ // + val: Value(Scalar(0x00000002))
+ // mir::Constant
+ // + span: $DIR/combine_array_len.rs:5:13: 5:17
+ // + literal: Const { ty: usize, val: Value(Scalar(0x00000002)) }
_5 = Lt(_3, _4); // bb0[4]: scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
assert(move _5, "index out of bounds: the len is move _4 but the index is _3") -> bb1; // bb0[5]: scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
}
bb1: {
_2 = _1[_3]; // bb1[0]: scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
StorageDead(_3); // bb1[1]: scope 0 at $DIR/combine_array_len.rs:5:17: 5:18
StorageLive(_6); // bb1[2]: scope 1 at $DIR/combine_array_len.rs:6:9: 6:10
StorageLive(_7); // bb1[3]: scope 1 at $DIR/combine_array_len.rs:6:15: 6:16
_7 = const 1usize; // bb1[4]: scope 1 at $DIR/combine_array_len.rs:6:15: 6:16
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000001))
// mir::Constant
// + span: $DIR/combine_array_len.rs:6:15: 6:16
// + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) }
- _8 = Len(_1); // bb1[5]: scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
+ _8 = const 2usize; // bb1[5]: scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
+ // ty::Const
+ // + ty: usize
+ // + val: Value(Scalar(0x00000002))
+ // mir::Constant
+ // + span: $DIR/combine_array_len.rs:6:13: 6:17
+ // + literal: Const { ty: usize, val: Value(Scalar(0x00000002)) }
_9 = Lt(_7, _8); // bb1[6]: scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
assert(move _9, "index out of bounds: the len is move _8 but the index is _7") -> bb2; // bb1[7]: scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
}
bb2: {
_6 = _1[_7]; // bb2[0]: scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
StorageDead(_7); // bb2[1]: scope 1 at $DIR/combine_array_len.rs:6:17: 6:18
StorageLive(_10); // bb2[2]: scope 2 at $DIR/combine_array_len.rs:7:5: 7:8
StorageLive(_11); // bb2[3]: scope 2 at $DIR/combine_array_len.rs:7:5: 7:6
_11 = _2; // bb2[4]: scope 2 at $DIR/combine_array_len.rs:7:5: 7:6
StorageLive(_12); // bb2[5]: scope 2 at $DIR/combine_array_len.rs:7:7: 7:8
_12 = _2; // bb2[6]: scope 2 at $DIR/combine_array_len.rs:7:7: 7:8
_10 = Mul(move _11, move _12); // bb2[7]: scope 2 at $DIR/combine_array_len.rs:7:5: 7:8
StorageDead(_12); // bb2[8]: scope 2 at $DIR/combine_array_len.rs:7:7: 7:8
StorageDead(_11); // bb2[9]: scope 2 at $DIR/combine_array_len.rs:7:7: 7:8
StorageLive(_13); // bb2[10]: scope 2 at $DIR/combine_array_len.rs:7:11: 7:14
StorageLive(_14); // bb2[11]: scope 2 at $DIR/combine_array_len.rs:7:11: 7:12
_14 = _6; // bb2[12]: scope 2 at $DIR/combine_array_len.rs:7:11: 7:12
StorageLive(_15); // bb2[13]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
_15 = _6; // bb2[14]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
_13 = Mul(move _14, move _15); // bb2[15]: scope 2 at $DIR/combine_array_len.rs:7:11: 7:14
StorageDead(_15); // bb2[16]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
StorageDead(_14); // bb2[17]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
_0 = Add(move _10, move _13); // bb2[18]: scope 2 at $DIR/combine_array_len.rs:7:5: 7:14
StorageDead(_13); // bb2[19]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
StorageDead(_10); // bb2[20]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
StorageDead(_6); // bb2[21]: scope 1 at $DIR/combine_array_len.rs:8:1: 8:2
StorageDead(_2); // bb2[22]: scope 0 at $DIR/combine_array_len.rs:8:1: 8:2
return; // bb2[23]: scope 0 at $DIR/combine_array_len.rs:8:2: 8:2
}
}
...@@ -2,100 +2,100 @@ ...@@ -2,100 +2,100 @@
+ // MIR for `norm2` after InstCombine + // MIR for `norm2` after InstCombine
fn norm2(_1: [f32; 2]) -> f32 { fn norm2(_1: [f32; 2]) -> f32 {
debug x => _1; // in scope 0 at $DIR/combine_array_len.rs:3:10: 3:11 debug x => _1; // in scope 0 at $DIR/combine_array_len.rs:4:10: 4:11
let mut _0: f32; // return place in scope 0 at $DIR/combine_array_len.rs:3:26: 3:29 let mut _0: f32; // return place in scope 0 at $DIR/combine_array_len.rs:4:26: 4:29
let _2: f32; // in scope 0 at $DIR/combine_array_len.rs:4:9: 4:10 let _2: f32; // in scope 0 at $DIR/combine_array_len.rs:5:9: 5:10
let _3: usize; // in scope 0 at $DIR/combine_array_len.rs:4:15: 4:16 let _3: usize; // in scope 0 at $DIR/combine_array_len.rs:5:15: 5:16
let mut _4: usize; // in scope 0 at $DIR/combine_array_len.rs:4:13: 4:17 let mut _4: usize; // in scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
let mut _5: bool; // in scope 0 at $DIR/combine_array_len.rs:4:13: 4:17 let mut _5: bool; // in scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
let _7: usize; // in scope 0 at $DIR/combine_array_len.rs:5:15: 5:16 let _7: usize; // in scope 0 at $DIR/combine_array_len.rs:6:15: 6:16
let mut _8: usize; // in scope 0 at $DIR/combine_array_len.rs:5:13: 5:17 let mut _8: usize; // in scope 0 at $DIR/combine_array_len.rs:6:13: 6:17
let mut _9: bool; // in scope 0 at $DIR/combine_array_len.rs:5:13: 5:17 let mut _9: bool; // in scope 0 at $DIR/combine_array_len.rs:6:13: 6:17
let mut _10: f32; // in scope 0 at $DIR/combine_array_len.rs:6:5: 6:8 let mut _10: f32; // in scope 0 at $DIR/combine_array_len.rs:7:5: 7:8
let mut _11: f32; // in scope 0 at $DIR/combine_array_len.rs:6:5: 6:6 let mut _11: f32; // in scope 0 at $DIR/combine_array_len.rs:7:5: 7:6
let mut _12: f32; // in scope 0 at $DIR/combine_array_len.rs:6:7: 6:8 let mut _12: f32; // in scope 0 at $DIR/combine_array_len.rs:7:7: 7:8
let mut _13: f32; // in scope 0 at $DIR/combine_array_len.rs:6:11: 6:14 let mut _13: f32; // in scope 0 at $DIR/combine_array_len.rs:7:11: 7:14
let mut _14: f32; // in scope 0 at $DIR/combine_array_len.rs:6:11: 6:12 let mut _14: f32; // in scope 0 at $DIR/combine_array_len.rs:7:11: 7:12
let mut _15: f32; // in scope 0 at $DIR/combine_array_len.rs:6:13: 6:14 let mut _15: f32; // in scope 0 at $DIR/combine_array_len.rs:7:13: 7:14
scope 1 { scope 1 {
debug a => _2; // in scope 1 at $DIR/combine_array_len.rs:4:9: 4:10 debug a => _2; // in scope 1 at $DIR/combine_array_len.rs:5:9: 5:10
let _6: f32; // in scope 1 at $DIR/combine_array_len.rs:5:9: 5:10 let _6: f32; // in scope 1 at $DIR/combine_array_len.rs:6:9: 6:10
scope 2 { scope 2 {
debug b => _6; // in scope 2 at $DIR/combine_array_len.rs:5:9: 5:10 debug b => _6; // in scope 2 at $DIR/combine_array_len.rs:6:9: 6:10
} }
} }
bb0: { bb0: {
StorageLive(_2); // bb0[0]: scope 0 at $DIR/combine_array_len.rs:4:9: 4:10 StorageLive(_2); // bb0[0]: scope 0 at $DIR/combine_array_len.rs:5:9: 5:10
StorageLive(_3); // bb0[1]: scope 0 at $DIR/combine_array_len.rs:4:15: 4:16 StorageLive(_3); // bb0[1]: scope 0 at $DIR/combine_array_len.rs:5:15: 5:16
_3 = const 0usize; // bb0[2]: scope 0 at $DIR/combine_array_len.rs:4:15: 4:16 _3 = const 0usize; // bb0[2]: scope 0 at $DIR/combine_array_len.rs:5:15: 5:16
// ty::Const // ty::Const
// + ty: usize // + ty: usize
// + val: Value(Scalar(0x0000000000000000)) // + val: Value(Scalar(0x0000000000000000))
// mir::Constant // mir::Constant
// + span: $DIR/combine_array_len.rs:4:15: 4:16 // + span: $DIR/combine_array_len.rs:5:15: 5:16
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) }
- _4 = Len(_1); // bb0[3]: scope 0 at $DIR/combine_array_len.rs:4:13: 4:17 - _4 = Len(_1); // bb0[3]: scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
+ _4 = const 2usize; // bb0[3]: scope 0 at $DIR/combine_array_len.rs:4:13: 4:17 + _4 = const 2usize; // bb0[3]: scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
+ // ty::Const + // ty::Const
+ // + ty: usize + // + ty: usize
+ // + val: Value(Scalar(0x0000000000000002)) + // + val: Value(Scalar(0x0000000000000002))
+ // mir::Constant + // mir::Constant
+ // + span: $DIR/combine_array_len.rs:4:13: 4:17 + // + span: $DIR/combine_array_len.rs:5:13: 5:17
+ // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000002)) } + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000002)) }
_5 = Lt(_3, _4); // bb0[4]: scope 0 at $DIR/combine_array_len.rs:4:13: 4:17 _5 = Lt(_3, _4); // bb0[4]: scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
assert(move _5, "index out of bounds: the len is move _4 but the index is _3") -> bb1; // bb0[5]: scope 0 at $DIR/combine_array_len.rs:4:13: 4:17 assert(move _5, "index out of bounds: the len is move _4 but the index is _3") -> bb1; // bb0[5]: scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
} }
bb1: { bb1: {
_2 = _1[_3]; // bb1[0]: scope 0 at $DIR/combine_array_len.rs:4:13: 4:17 _2 = _1[_3]; // bb1[0]: scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
StorageDead(_3); // bb1[1]: scope 0 at $DIR/combine_array_len.rs:4:17: 4:18 StorageDead(_3); // bb1[1]: scope 0 at $DIR/combine_array_len.rs:5:17: 5:18
StorageLive(_6); // bb1[2]: scope 1 at $DIR/combine_array_len.rs:5:9: 5:10 StorageLive(_6); // bb1[2]: scope 1 at $DIR/combine_array_len.rs:6:9: 6:10
StorageLive(_7); // bb1[3]: scope 1 at $DIR/combine_array_len.rs:5:15: 5:16 StorageLive(_7); // bb1[3]: scope 1 at $DIR/combine_array_len.rs:6:15: 6:16
_7 = const 1usize; // bb1[4]: scope 1 at $DIR/combine_array_len.rs:5:15: 5:16 _7 = const 1usize; // bb1[4]: scope 1 at $DIR/combine_array_len.rs:6:15: 6:16
// ty::Const // ty::Const
// + ty: usize // + ty: usize
// + val: Value(Scalar(0x0000000000000001)) // + val: Value(Scalar(0x0000000000000001))
// mir::Constant // mir::Constant
// + span: $DIR/combine_array_len.rs:5:15: 5:16 // + span: $DIR/combine_array_len.rs:6:15: 6:16
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) }
- _8 = Len(_1); // bb1[5]: scope 1 at $DIR/combine_array_len.rs:5:13: 5:17 - _8 = Len(_1); // bb1[5]: scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
+ _8 = const 2usize; // bb1[5]: scope 1 at $DIR/combine_array_len.rs:5:13: 5:17 + _8 = const 2usize; // bb1[5]: scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
+ // ty::Const + // ty::Const
+ // + ty: usize + // + ty: usize
+ // + val: Value(Scalar(0x0000000000000002)) + // + val: Value(Scalar(0x0000000000000002))
+ // mir::Constant + // mir::Constant
+ // + span: $DIR/combine_array_len.rs:5:13: 5:17 + // + span: $DIR/combine_array_len.rs:6:13: 6:17
+ // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000002)) } + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000002)) }
_9 = Lt(_7, _8); // bb1[6]: scope 1 at $DIR/combine_array_len.rs:5:13: 5:17 _9 = Lt(_7, _8); // bb1[6]: scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
assert(move _9, "index out of bounds: the len is move _8 but the index is _7") -> bb2; // bb1[7]: scope 1 at $DIR/combine_array_len.rs:5:13: 5:17 assert(move _9, "index out of bounds: the len is move _8 but the index is _7") -> bb2; // bb1[7]: scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
} }
bb2: { bb2: {
_6 = _1[_7]; // bb2[0]: scope 1 at $DIR/combine_array_len.rs:5:13: 5:17 _6 = _1[_7]; // bb2[0]: scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
StorageDead(_7); // bb2[1]: scope 1 at $DIR/combine_array_len.rs:5:17: 5:18 StorageDead(_7); // bb2[1]: scope 1 at $DIR/combine_array_len.rs:6:17: 6:18
StorageLive(_10); // bb2[2]: scope 2 at $DIR/combine_array_len.rs:6:5: 6:8 StorageLive(_10); // bb2[2]: scope 2 at $DIR/combine_array_len.rs:7:5: 7:8
StorageLive(_11); // bb2[3]: scope 2 at $DIR/combine_array_len.rs:6:5: 6:6 StorageLive(_11); // bb2[3]: scope 2 at $DIR/combine_array_len.rs:7:5: 7:6
_11 = _2; // bb2[4]: scope 2 at $DIR/combine_array_len.rs:6:5: 6:6 _11 = _2; // bb2[4]: scope 2 at $DIR/combine_array_len.rs:7:5: 7:6
StorageLive(_12); // bb2[5]: scope 2 at $DIR/combine_array_len.rs:6:7: 6:8 StorageLive(_12); // bb2[5]: scope 2 at $DIR/combine_array_len.rs:7:7: 7:8
_12 = _2; // bb2[6]: scope 2 at $DIR/combine_array_len.rs:6:7: 6:8 _12 = _2; // bb2[6]: scope 2 at $DIR/combine_array_len.rs:7:7: 7:8
_10 = Mul(move _11, move _12); // bb2[7]: scope 2 at $DIR/combine_array_len.rs:6:5: 6:8 _10 = Mul(move _11, move _12); // bb2[7]: scope 2 at $DIR/combine_array_len.rs:7:5: 7:8
StorageDead(_12); // bb2[8]: scope 2 at $DIR/combine_array_len.rs:6:7: 6:8 StorageDead(_12); // bb2[8]: scope 2 at $DIR/combine_array_len.rs:7:7: 7:8
StorageDead(_11); // bb2[9]: scope 2 at $DIR/combine_array_len.rs:6:7: 6:8 StorageDead(_11); // bb2[9]: scope 2 at $DIR/combine_array_len.rs:7:7: 7:8
StorageLive(_13); // bb2[10]: scope 2 at $DIR/combine_array_len.rs:6:11: 6:14 StorageLive(_13); // bb2[10]: scope 2 at $DIR/combine_array_len.rs:7:11: 7:14
StorageLive(_14); // bb2[11]: scope 2 at $DIR/combine_array_len.rs:6:11: 6:12 StorageLive(_14); // bb2[11]: scope 2 at $DIR/combine_array_len.rs:7:11: 7:12
_14 = _6; // bb2[12]: scope 2 at $DIR/combine_array_len.rs:6:11: 6:12 _14 = _6; // bb2[12]: scope 2 at $DIR/combine_array_len.rs:7:11: 7:12
StorageLive(_15); // bb2[13]: scope 2 at $DIR/combine_array_len.rs:6:13: 6:14 StorageLive(_15); // bb2[13]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
_15 = _6; // bb2[14]: scope 2 at $DIR/combine_array_len.rs:6:13: 6:14 _15 = _6; // bb2[14]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
_13 = Mul(move _14, move _15); // bb2[15]: scope 2 at $DIR/combine_array_len.rs:6:11: 6:14 _13 = Mul(move _14, move _15); // bb2[15]: scope 2 at $DIR/combine_array_len.rs:7:11: 7:14
StorageDead(_15); // bb2[16]: scope 2 at $DIR/combine_array_len.rs:6:13: 6:14 StorageDead(_15); // bb2[16]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
StorageDead(_14); // bb2[17]: scope 2 at $DIR/combine_array_len.rs:6:13: 6:14 StorageDead(_14); // bb2[17]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
_0 = Add(move _10, move _13); // bb2[18]: scope 2 at $DIR/combine_array_len.rs:6:5: 6:14 _0 = Add(move _10, move _13); // bb2[18]: scope 2 at $DIR/combine_array_len.rs:7:5: 7:14
StorageDead(_13); // bb2[19]: scope 2 at $DIR/combine_array_len.rs:6:13: 6:14 StorageDead(_13); // bb2[19]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
StorageDead(_10); // bb2[20]: scope 2 at $DIR/combine_array_len.rs:6:13: 6:14 StorageDead(_10); // bb2[20]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
StorageDead(_6); // bb2[21]: scope 1 at $DIR/combine_array_len.rs:7:1: 7:2 StorageDead(_6); // bb2[21]: scope 1 at $DIR/combine_array_len.rs:8:1: 8:2
StorageDead(_2); // bb2[22]: scope 0 at $DIR/combine_array_len.rs:7:1: 7:2 StorageDead(_2); // bb2[22]: scope 0 at $DIR/combine_array_len.rs:8:1: 8:2
return; // bb2[23]: scope 0 at $DIR/combine_array_len.rs:7:2: 7:2 return; // bb2[23]: scope 0 at $DIR/combine_array_len.rs:8:2: 8:2
} }
} }
// EMIT_MIR rustc.main.ConstProp.diff // EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR rustc.main.ConstProp.diff
fn main() { fn main() {
let x: u32 = [0, 1, 2, 3][2]; let x: u32 = [0, 1, 2, 3][2];
} }
- // MIR for `main` before ConstProp
+ // MIR for `main` after ConstProp
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/array_index.rs:4:11: 4:11
let _1: u32 as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/array_index.rs:5:9: 5:10
let mut _2: [u32; 4]; // in scope 0 at $DIR/array_index.rs:5:18: 5:30
let _3: usize; // in scope 0 at $DIR/array_index.rs:5:31: 5:32
let mut _4: usize; // in scope 0 at $DIR/array_index.rs:5:18: 5:33
let mut _5: bool; // in scope 0 at $DIR/array_index.rs:5:18: 5:33
scope 1 {
debug x => _1; // in scope 1 at $DIR/array_index.rs:5:9: 5:10
}
bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/array_index.rs:5:9: 5:10
StorageLive(_2); // bb0[1]: scope 0 at $DIR/array_index.rs:5:18: 5:30
_2 = [const 0u32, const 1u32, const 2u32, const 3u32]; // bb0[2]: scope 0 at $DIR/array_index.rs:5:18: 5:30
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x00000000))
// mir::Constant
// + span: $DIR/array_index.rs:5:19: 5:20
// + literal: Const { ty: u32, val: Value(Scalar(0x00000000)) }
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x00000001))
// mir::Constant
// + span: $DIR/array_index.rs:5:22: 5:23
// + literal: Const { ty: u32, val: Value(Scalar(0x00000001)) }
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x00000002))
// mir::Constant
// + span: $DIR/array_index.rs:5:25: 5:26
// + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) }
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x00000003))
// mir::Constant
// + span: $DIR/array_index.rs:5:28: 5:29
// + literal: Const { ty: u32, val: Value(Scalar(0x00000003)) }
StorageLive(_3); // bb0[3]: scope 0 at $DIR/array_index.rs:5:31: 5:32
_3 = const 2usize; // bb0[4]: scope 0 at $DIR/array_index.rs:5:31: 5:32
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000002))
// mir::Constant
// + span: $DIR/array_index.rs:5:31: 5:32
// + literal: Const { ty: usize, val: Value(Scalar(0x00000002)) }
_4 = const 4usize; // bb0[5]: scope 0 at $DIR/array_index.rs:5:18: 5:33
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000004))
// mir::Constant
// + span: $DIR/array_index.rs:5:18: 5:33
// + literal: Const { ty: usize, val: Value(Scalar(0x00000004)) }
- _5 = Lt(_3, _4); // bb0[6]: scope 0 at $DIR/array_index.rs:5:18: 5:33
- assert(move _5, "index out of bounds: the len is move _4 but the index is _3") -> bb1; // bb0[7]: scope 0 at $DIR/array_index.rs:5:18: 5:33
+ _5 = const true; // bb0[6]: scope 0 at $DIR/array_index.rs:5:18: 5:33
+ // ty::Const
+ // + ty: bool
+ // + val: Value(Scalar(0x01))
+ // mir::Constant
+ // + span: $DIR/array_index.rs:5:18: 5:33
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
+ assert(const true, "index out of bounds: the len is move _4 but the index is _3") -> bb1; // bb0[7]: scope 0 at $DIR/array_index.rs:5:18: 5:33
+ // ty::Const
+ // + ty: bool
+ // + val: Value(Scalar(0x01))
+ // mir::Constant
+ // + span: $DIR/array_index.rs:5:18: 5:33
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
}
bb1: {
- _1 = _2[_3]; // bb1[0]: scope 0 at $DIR/array_index.rs:5:18: 5:33
+ _1 = const 2u32; // bb1[0]: scope 0 at $DIR/array_index.rs:5:18: 5:33
+ // ty::Const
+ // + ty: u32
+ // + val: Value(Scalar(0x00000002))
+ // mir::Constant
+ // + span: $DIR/array_index.rs:5:18: 5:33
+ // + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) }
StorageDead(_3); // bb1[1]: scope 0 at $DIR/array_index.rs:5:33: 5:34
StorageDead(_2); // bb1[2]: scope 0 at $DIR/array_index.rs:5:33: 5:34
_0 = (); // bb1[3]: scope 0 at $DIR/array_index.rs:4:11: 6:2
StorageDead(_1); // bb1[4]: scope 0 at $DIR/array_index.rs:6:1: 6:2
return; // bb1[5]: scope 0 at $DIR/array_index.rs:6:2: 6:2
}
}
...@@ -2,91 +2,91 @@ ...@@ -2,91 +2,91 @@
+ // MIR for `main` after ConstProp + // MIR for `main` after ConstProp
fn main() -> () { fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/array_index.rs:3:11: 3:11 let mut _0: (); // return place in scope 0 at $DIR/array_index.rs:4:11: 4:11
let _1: u32 as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/array_index.rs:4:9: 4:10 let _1: u32 as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/array_index.rs:5:9: 5:10
let mut _2: [u32; 4]; // in scope 0 at $DIR/array_index.rs:4:18: 4:30 let mut _2: [u32; 4]; // in scope 0 at $DIR/array_index.rs:5:18: 5:30
let _3: usize; // in scope 0 at $DIR/array_index.rs:4:31: 4:32 let _3: usize; // in scope 0 at $DIR/array_index.rs:5:31: 5:32
let mut _4: usize; // in scope 0 at $DIR/array_index.rs:4:18: 4:33 let mut _4: usize; // in scope 0 at $DIR/array_index.rs:5:18: 5:33
let mut _5: bool; // in scope 0 at $DIR/array_index.rs:4:18: 4:33 let mut _5: bool; // in scope 0 at $DIR/array_index.rs:5:18: 5:33
scope 1 { scope 1 {
debug x => _1; // in scope 1 at $DIR/array_index.rs:4:9: 4:10 debug x => _1; // in scope 1 at $DIR/array_index.rs:5:9: 5:10
} }
bb0: { bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/array_index.rs:4:9: 4:10 StorageLive(_1); // bb0[0]: scope 0 at $DIR/array_index.rs:5:9: 5:10
StorageLive(_2); // bb0[1]: scope 0 at $DIR/array_index.rs:4:18: 4:30 StorageLive(_2); // bb0[1]: scope 0 at $DIR/array_index.rs:5:18: 5:30
_2 = [const 0u32, const 1u32, const 2u32, const 3u32]; // bb0[2]: scope 0 at $DIR/array_index.rs:4:18: 4:30 _2 = [const 0u32, const 1u32, const 2u32, const 3u32]; // bb0[2]: scope 0 at $DIR/array_index.rs:5:18: 5:30
// ty::Const // ty::Const
// + ty: u32 // + ty: u32
// + val: Value(Scalar(0x00000000)) // + val: Value(Scalar(0x00000000))
// mir::Constant // mir::Constant
// + span: $DIR/array_index.rs:4:19: 4:20 // + span: $DIR/array_index.rs:5:19: 5:20
// + literal: Const { ty: u32, val: Value(Scalar(0x00000000)) } // + literal: Const { ty: u32, val: Value(Scalar(0x00000000)) }
// ty::Const // ty::Const
// + ty: u32 // + ty: u32
// + val: Value(Scalar(0x00000001)) // + val: Value(Scalar(0x00000001))
// mir::Constant // mir::Constant
// + span: $DIR/array_index.rs:4:22: 4:23 // + span: $DIR/array_index.rs:5:22: 5:23
// + literal: Const { ty: u32, val: Value(Scalar(0x00000001)) } // + literal: Const { ty: u32, val: Value(Scalar(0x00000001)) }
// ty::Const // ty::Const
// + ty: u32 // + ty: u32
// + val: Value(Scalar(0x00000002)) // + val: Value(Scalar(0x00000002))
// mir::Constant // mir::Constant
// + span: $DIR/array_index.rs:4:25: 4:26 // + span: $DIR/array_index.rs:5:25: 5:26
// + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) } // + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) }
// ty::Const // ty::Const
// + ty: u32 // + ty: u32
// + val: Value(Scalar(0x00000003)) // + val: Value(Scalar(0x00000003))
// mir::Constant // mir::Constant
// + span: $DIR/array_index.rs:4:28: 4:29 // + span: $DIR/array_index.rs:5:28: 5:29
// + literal: Const { ty: u32, val: Value(Scalar(0x00000003)) } // + literal: Const { ty: u32, val: Value(Scalar(0x00000003)) }
StorageLive(_3); // bb0[3]: scope 0 at $DIR/array_index.rs:4:31: 4:32 StorageLive(_3); // bb0[3]: scope 0 at $DIR/array_index.rs:5:31: 5:32
_3 = const 2usize; // bb0[4]: scope 0 at $DIR/array_index.rs:4:31: 4:32 _3 = const 2usize; // bb0[4]: scope 0 at $DIR/array_index.rs:5:31: 5:32
// ty::Const // ty::Const
// + ty: usize // + ty: usize
// + val: Value(Scalar(0x0000000000000002)) // + val: Value(Scalar(0x0000000000000002))
// mir::Constant // mir::Constant
// + span: $DIR/array_index.rs:4:31: 4:32 // + span: $DIR/array_index.rs:5:31: 5:32
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000002)) } // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000002)) }
_4 = const 4usize; // bb0[5]: scope 0 at $DIR/array_index.rs:4:18: 4:33 _4 = const 4usize; // bb0[5]: scope 0 at $DIR/array_index.rs:5:18: 5:33
// ty::Const // ty::Const
// + ty: usize // + ty: usize
// + val: Value(Scalar(0x0000000000000004)) // + val: Value(Scalar(0x0000000000000004))
// mir::Constant // mir::Constant
// + span: $DIR/array_index.rs:4:18: 4:33 // + span: $DIR/array_index.rs:5:18: 5:33
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000004)) } // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000004)) }
- _5 = Lt(_3, _4); // bb0[6]: scope 0 at $DIR/array_index.rs:4:18: 4:33 - _5 = Lt(_3, _4); // bb0[6]: scope 0 at $DIR/array_index.rs:5:18: 5:33
- assert(move _5, "index out of bounds: the len is move _4 but the index is _3") -> bb1; // bb0[7]: scope 0 at $DIR/array_index.rs:4:18: 4:33 - assert(move _5, "index out of bounds: the len is move _4 but the index is _3") -> bb1; // bb0[7]: scope 0 at $DIR/array_index.rs:5:18: 5:33
+ _5 = const true; // bb0[6]: scope 0 at $DIR/array_index.rs:4:18: 4:33 + _5 = const true; // bb0[6]: scope 0 at $DIR/array_index.rs:5:18: 5:33
+ // ty::Const + // ty::Const
+ // + ty: bool + // + ty: bool
+ // + val: Value(Scalar(0x01)) + // + val: Value(Scalar(0x01))
+ // mir::Constant + // mir::Constant
+ // + span: $DIR/array_index.rs:4:18: 4:33 + // + span: $DIR/array_index.rs:5:18: 5:33
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) } + // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
+ assert(const true, "index out of bounds: the len is move _4 but the index is _3") -> bb1; // bb0[7]: scope 0 at $DIR/array_index.rs:4:18: 4:33 + assert(const true, "index out of bounds: the len is move _4 but the index is _3") -> bb1; // bb0[7]: scope 0 at $DIR/array_index.rs:5:18: 5:33
+ // ty::Const + // ty::Const
+ // + ty: bool + // + ty: bool
+ // + val: Value(Scalar(0x01)) + // + val: Value(Scalar(0x01))
+ // mir::Constant + // mir::Constant
+ // + span: $DIR/array_index.rs:4:18: 4:33 + // + span: $DIR/array_index.rs:5:18: 5:33
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) } + // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
} }
bb1: { bb1: {
- _1 = _2[_3]; // bb1[0]: scope 0 at $DIR/array_index.rs:4:18: 4:33 - _1 = _2[_3]; // bb1[0]: scope 0 at $DIR/array_index.rs:5:18: 5:33
+ _1 = const 2u32; // bb1[0]: scope 0 at $DIR/array_index.rs:4:18: 4:33 + _1 = const 2u32; // bb1[0]: scope 0 at $DIR/array_index.rs:5:18: 5:33
+ // ty::Const + // ty::Const
+ // + ty: u32 + // + ty: u32
+ // + val: Value(Scalar(0x00000002)) + // + val: Value(Scalar(0x00000002))
+ // mir::Constant + // mir::Constant
+ // + span: $DIR/array_index.rs:4:18: 4:33 + // + span: $DIR/array_index.rs:5:18: 5:33
+ // + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) } + // + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) }
StorageDead(_3); // bb1[1]: scope 0 at $DIR/array_index.rs:4:33: 4:34 StorageDead(_3); // bb1[1]: scope 0 at $DIR/array_index.rs:5:33: 5:34
StorageDead(_2); // bb1[2]: scope 0 at $DIR/array_index.rs:4:33: 4:34 StorageDead(_2); // bb1[2]: scope 0 at $DIR/array_index.rs:5:33: 5:34
_0 = (); // bb1[3]: scope 0 at $DIR/array_index.rs:3:11: 5:2 _0 = (); // bb1[3]: scope 0 at $DIR/array_index.rs:4:11: 6:2
StorageDead(_1); // bb1[4]: scope 0 at $DIR/array_index.rs:5:1: 5:2 StorageDead(_1); // bb1[4]: scope 0 at $DIR/array_index.rs:6:1: 6:2
return; // bb1[5]: scope 0 at $DIR/array_index.rs:5:2: 5:2 return; // bb1[5]: scope 0 at $DIR/array_index.rs:6:2: 6:2
} }
} }
// compile-flags: -O // compile-flags: -O
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR rustc.main.ConstProp.diff // EMIT_MIR rustc.main.ConstProp.diff
fn main() { fn main() {
let x = (if let Some(true) = Some(true) { 42 } else { 10 }) + 0; let x = (if let Some(true) = Some(true) { 42 } else { 10 }) + 0;
......
- // MIR for `main` before ConstProp
+ // MIR for `main` after ConstProp
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/discriminant.rs:5:11: 5:11
let _1: i32; // in scope 0 at $DIR/discriminant.rs:6:9: 6:10
let mut _2: i32; // in scope 0 at $DIR/discriminant.rs:6:13: 6:64
let mut _3: std::option::Option<bool>; // in scope 0 at $DIR/discriminant.rs:6:34: 6:44
let mut _4: isize; // in scope 0 at $DIR/discriminant.rs:6:21: 6:31
scope 1 {
debug x => _1; // in scope 1 at $DIR/discriminant.rs:6:9: 6:10
}
bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/discriminant.rs:6:9: 6:10
StorageLive(_2); // bb0[1]: scope 0 at $DIR/discriminant.rs:6:13: 6:64
StorageLive(_3); // bb0[2]: scope 0 at $DIR/discriminant.rs:6:34: 6:44
- _3 = std::option::Option::<bool>::Some(const true,); // bb0[3]: scope 0 at $DIR/discriminant.rs:6:34: 6:44
+ _3 = const {transmute(0x01): std::option::Option<bool>}; // bb0[3]: scope 0 at $DIR/discriminant.rs:6:34: 6:44
// ty::Const
- // + ty: bool
+ // + ty: std::option::Option<bool>
// + val: Value(Scalar(0x01))
// mir::Constant
- // + span: $DIR/discriminant.rs:6:39: 6:43
- // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
- _4 = discriminant(_3); // bb0[4]: scope 0 at $DIR/discriminant.rs:6:21: 6:31
- switchInt(move _4) -> [1isize: bb2, otherwise: bb1]; // bb0[5]: scope 0 at $DIR/discriminant.rs:6:21: 6:31
+ // + span: $DIR/discriminant.rs:6:34: 6:44
+ // + literal: Const { ty: std::option::Option<bool>, val: Value(Scalar(0x01)) }
+ _4 = const 1isize; // bb0[4]: scope 0 at $DIR/discriminant.rs:6:21: 6:31
+ // ty::Const
+ // + ty: isize
+ // + val: Value(Scalar(0x00000001))
+ // mir::Constant
+ // + span: $DIR/discriminant.rs:6:21: 6:31
+ // + literal: Const { ty: isize, val: Value(Scalar(0x00000001)) }
+ switchInt(const 1isize) -> [1isize: bb2, otherwise: bb1]; // bb0[5]: scope 0 at $DIR/discriminant.rs:6:21: 6:31
+ // ty::Const
+ // + ty: isize
+ // + val: Value(Scalar(0x00000001))
+ // mir::Constant
+ // + span: $DIR/discriminant.rs:6:21: 6:31
+ // + literal: Const { ty: isize, val: Value(Scalar(0x00000001)) }
}
bb1: {
_2 = const 10i32; // bb1[0]: scope 0 at $DIR/discriminant.rs:6:59: 6:61
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x0000000a))
// mir::Constant
// + span: $DIR/discriminant.rs:6:59: 6:61
// + literal: Const { ty: i32, val: Value(Scalar(0x0000000a)) }
goto -> bb4; // bb1[1]: scope 0 at $DIR/discriminant.rs:6:13: 6:64
}
bb2: {
- switchInt(((_3 as Some).0: bool)) -> [false: bb1, otherwise: bb3]; // bb2[0]: scope 0 at $DIR/discriminant.rs:6:26: 6:30
+ switchInt(const true) -> [false: bb1, otherwise: bb3]; // bb2[0]: scope 0 at $DIR/discriminant.rs:6:26: 6:30
+ // ty::Const
+ // + ty: bool
+ // + val: Value(Scalar(0x01))
+ // mir::Constant
+ // + span: $DIR/discriminant.rs:6:26: 6:30
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
}
bb3: {
_2 = const 42i32; // bb3[0]: scope 0 at $DIR/discriminant.rs:6:47: 6:49
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x0000002a))
// mir::Constant
// + span: $DIR/discriminant.rs:6:47: 6:49
// + literal: Const { ty: i32, val: Value(Scalar(0x0000002a)) }
goto -> bb4; // bb3[1]: scope 0 at $DIR/discriminant.rs:6:13: 6:64
}
bb4: {
_1 = Add(move _2, const 0i32); // bb4[0]: scope 0 at $DIR/discriminant.rs:6:13: 6:68
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000000))
// mir::Constant
// + span: $DIR/discriminant.rs:6:67: 6:68
// + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) }
StorageDead(_2); // bb4[1]: scope 0 at $DIR/discriminant.rs:6:67: 6:68
StorageDead(_3); // bb4[2]: scope 0 at $DIR/discriminant.rs:6:68: 6:69
_0 = (); // bb4[3]: scope 0 at $DIR/discriminant.rs:5:11: 7:2
StorageDead(_1); // bb4[4]: scope 0 at $DIR/discriminant.rs:7:1: 7:2
return; // bb4[5]: scope 0 at $DIR/discriminant.rs:7:2: 7:2
}
}
...@@ -2,94 +2,94 @@ ...@@ -2,94 +2,94 @@
+ // MIR for `main` after ConstProp + // MIR for `main` after ConstProp
fn main() -> () { fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/discriminant.rs:4:11: 4:11 let mut _0: (); // return place in scope 0 at $DIR/discriminant.rs:5:11: 5:11
let _1: i32; // in scope 0 at $DIR/discriminant.rs:5:9: 5:10 let _1: i32; // in scope 0 at $DIR/discriminant.rs:6:9: 6:10
let mut _2: i32; // in scope 0 at $DIR/discriminant.rs:5:13: 5:64 let mut _2: i32; // in scope 0 at $DIR/discriminant.rs:6:13: 6:64
let mut _3: std::option::Option<bool>; // in scope 0 at $DIR/discriminant.rs:5:34: 5:44 let mut _3: std::option::Option<bool>; // in scope 0 at $DIR/discriminant.rs:6:34: 6:44
let mut _4: isize; // in scope 0 at $DIR/discriminant.rs:5:21: 5:31 let mut _4: isize; // in scope 0 at $DIR/discriminant.rs:6:21: 6:31
scope 1 { scope 1 {
debug x => _1; // in scope 1 at $DIR/discriminant.rs:5:9: 5:10 debug x => _1; // in scope 1 at $DIR/discriminant.rs:6:9: 6:10
} }
bb0: { bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/discriminant.rs:5:9: 5:10 StorageLive(_1); // bb0[0]: scope 0 at $DIR/discriminant.rs:6:9: 6:10
StorageLive(_2); // bb0[1]: scope 0 at $DIR/discriminant.rs:5:13: 5:64 StorageLive(_2); // bb0[1]: scope 0 at $DIR/discriminant.rs:6:13: 6:64
StorageLive(_3); // bb0[2]: scope 0 at $DIR/discriminant.rs:5:34: 5:44 StorageLive(_3); // bb0[2]: scope 0 at $DIR/discriminant.rs:6:34: 6:44
- _3 = std::option::Option::<bool>::Some(const true,); // bb0[3]: scope 0 at $DIR/discriminant.rs:5:34: 5:44 - _3 = std::option::Option::<bool>::Some(const true,); // bb0[3]: scope 0 at $DIR/discriminant.rs:6:34: 6:44
+ _3 = const {transmute(0x01): std::option::Option<bool>}; // bb0[3]: scope 0 at $DIR/discriminant.rs:5:34: 5:44 + _3 = const {transmute(0x01): std::option::Option<bool>}; // bb0[3]: scope 0 at $DIR/discriminant.rs:6:34: 6:44
// ty::Const // ty::Const
- // + ty: bool - // + ty: bool
+ // + ty: std::option::Option<bool> + // + ty: std::option::Option<bool>
// + val: Value(Scalar(0x01)) // + val: Value(Scalar(0x01))
// mir::Constant // mir::Constant
- // + span: $DIR/discriminant.rs:5:39: 5:43 - // + span: $DIR/discriminant.rs:6:39: 6:43
- // + literal: Const { ty: bool, val: Value(Scalar(0x01)) } - // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
- _4 = discriminant(_3); // bb0[4]: scope 0 at $DIR/discriminant.rs:5:21: 5:31 - _4 = discriminant(_3); // bb0[4]: scope 0 at $DIR/discriminant.rs:6:21: 6:31
- switchInt(move _4) -> [1isize: bb2, otherwise: bb1]; // bb0[5]: scope 0 at $DIR/discriminant.rs:5:21: 5:31 - switchInt(move _4) -> [1isize: bb2, otherwise: bb1]; // bb0[5]: scope 0 at $DIR/discriminant.rs:6:21: 6:31
+ // + span: $DIR/discriminant.rs:5:34: 5:44 + // + span: $DIR/discriminant.rs:6:34: 6:44
+ // + literal: Const { ty: std::option::Option<bool>, val: Value(Scalar(0x01)) } + // + literal: Const { ty: std::option::Option<bool>, val: Value(Scalar(0x01)) }
+ _4 = const 1isize; // bb0[4]: scope 0 at $DIR/discriminant.rs:5:21: 5:31 + _4 = const 1isize; // bb0[4]: scope 0 at $DIR/discriminant.rs:6:21: 6:31
+ // ty::Const + // ty::Const
+ // + ty: isize + // + ty: isize
+ // + val: Value(Scalar(0x0000000000000001)) + // + val: Value(Scalar(0x0000000000000001))
+ // mir::Constant + // mir::Constant
+ // + span: $DIR/discriminant.rs:5:21: 5:31 + // + span: $DIR/discriminant.rs:6:21: 6:31
+ // + literal: Const { ty: isize, val: Value(Scalar(0x0000000000000001)) } + // + literal: Const { ty: isize, val: Value(Scalar(0x0000000000000001)) }
+ switchInt(const 1isize) -> [1isize: bb2, otherwise: bb1]; // bb0[5]: scope 0 at $DIR/discriminant.rs:5:21: 5:31 + switchInt(const 1isize) -> [1isize: bb2, otherwise: bb1]; // bb0[5]: scope 0 at $DIR/discriminant.rs:6:21: 6:31
+ // ty::Const + // ty::Const
+ // + ty: isize + // + ty: isize
+ // + val: Value(Scalar(0x0000000000000001)) + // + val: Value(Scalar(0x0000000000000001))
+ // mir::Constant + // mir::Constant
+ // + span: $DIR/discriminant.rs:5:21: 5:31 + // + span: $DIR/discriminant.rs:6:21: 6:31
+ // + literal: Const { ty: isize, val: Value(Scalar(0x0000000000000001)) } + // + literal: Const { ty: isize, val: Value(Scalar(0x0000000000000001)) }
} }
bb1: { bb1: {
_2 = const 10i32; // bb1[0]: scope 0 at $DIR/discriminant.rs:5:59: 5:61 _2 = const 10i32; // bb1[0]: scope 0 at $DIR/discriminant.rs:6:59: 6:61
// ty::Const // ty::Const
// + ty: i32 // + ty: i32
// + val: Value(Scalar(0x0000000a)) // + val: Value(Scalar(0x0000000a))
// mir::Constant // mir::Constant
// + span: $DIR/discriminant.rs:5:59: 5:61 // + span: $DIR/discriminant.rs:6:59: 6:61
// + literal: Const { ty: i32, val: Value(Scalar(0x0000000a)) } // + literal: Const { ty: i32, val: Value(Scalar(0x0000000a)) }
goto -> bb4; // bb1[1]: scope 0 at $DIR/discriminant.rs:5:13: 5:64 goto -> bb4; // bb1[1]: scope 0 at $DIR/discriminant.rs:6:13: 6:64
} }
bb2: { bb2: {
- switchInt(((_3 as Some).0: bool)) -> [false: bb1, otherwise: bb3]; // bb2[0]: scope 0 at $DIR/discriminant.rs:5:26: 5:30 - switchInt(((_3 as Some).0: bool)) -> [false: bb1, otherwise: bb3]; // bb2[0]: scope 0 at $DIR/discriminant.rs:6:26: 6:30
+ switchInt(const true) -> [false: bb1, otherwise: bb3]; // bb2[0]: scope 0 at $DIR/discriminant.rs:5:26: 5:30 + switchInt(const true) -> [false: bb1, otherwise: bb3]; // bb2[0]: scope 0 at $DIR/discriminant.rs:6:26: 6:30
+ // ty::Const + // ty::Const
+ // + ty: bool + // + ty: bool
+ // + val: Value(Scalar(0x01)) + // + val: Value(Scalar(0x01))
+ // mir::Constant + // mir::Constant
+ // + span: $DIR/discriminant.rs:5:26: 5:30 + // + span: $DIR/discriminant.rs:6:26: 6:30
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) } + // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
} }
bb3: { bb3: {
_2 = const 42i32; // bb3[0]: scope 0 at $DIR/discriminant.rs:5:47: 5:49 _2 = const 42i32; // bb3[0]: scope 0 at $DIR/discriminant.rs:6:47: 6:49
// ty::Const // ty::Const
// + ty: i32 // + ty: i32
// + val: Value(Scalar(0x0000002a)) // + val: Value(Scalar(0x0000002a))
// mir::Constant // mir::Constant
// + span: $DIR/discriminant.rs:5:47: 5:49 // + span: $DIR/discriminant.rs:6:47: 6:49
// + literal: Const { ty: i32, val: Value(Scalar(0x0000002a)) } // + literal: Const { ty: i32, val: Value(Scalar(0x0000002a)) }
goto -> bb4; // bb3[1]: scope 0 at $DIR/discriminant.rs:5:13: 5:64 goto -> bb4; // bb3[1]: scope 0 at $DIR/discriminant.rs:6:13: 6:64
} }
bb4: { bb4: {
_1 = Add(move _2, const 0i32); // bb4[0]: scope 0 at $DIR/discriminant.rs:5:13: 5:68 _1 = Add(move _2, const 0i32); // bb4[0]: scope 0 at $DIR/discriminant.rs:6:13: 6:68
// ty::Const // ty::Const
// + ty: i32 // + ty: i32
// + val: Value(Scalar(0x00000000)) // + val: Value(Scalar(0x00000000))
// mir::Constant // mir::Constant
// + span: $DIR/discriminant.rs:5:67: 5:68 // + span: $DIR/discriminant.rs:6:67: 6:68
// + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) } // + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) }
StorageDead(_2); // bb4[1]: scope 0 at $DIR/discriminant.rs:5:67: 5:68 StorageDead(_2); // bb4[1]: scope 0 at $DIR/discriminant.rs:6:67: 6:68
StorageDead(_3); // bb4[2]: scope 0 at $DIR/discriminant.rs:5:68: 5:69 StorageDead(_3); // bb4[2]: scope 0 at $DIR/discriminant.rs:6:68: 6:69
_0 = (); // bb4[3]: scope 0 at $DIR/discriminant.rs:4:11: 6:2 _0 = (); // bb4[3]: scope 0 at $DIR/discriminant.rs:5:11: 7:2
StorageDead(_1); // bb4[4]: scope 0 at $DIR/discriminant.rs:6:1: 6:2 StorageDead(_1); // bb4[4]: scope 0 at $DIR/discriminant.rs:7:1: 7:2
return; // bb4[5]: scope 0 at $DIR/discriminant.rs:6:2: 6:2 return; // bb4[5]: scope 0 at $DIR/discriminant.rs:7:2: 7:2
} }
} }
...@@ -5,6 +5,7 @@ struct Point { ...@@ -5,6 +5,7 @@ struct Point {
y: u32, y: u32,
} }
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR rustc.main.ConstProp.diff // EMIT_MIR rustc.main.ConstProp.diff
// EMIT_MIR rustc.main.SimplifyLocals.after.mir // EMIT_MIR rustc.main.SimplifyLocals.after.mir
fn main() { fn main() {
......
- // MIR for `main` before ConstProp
+ // MIR for `main` after ConstProp
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:11:11: 11:11
let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:13:13: 13:31
let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:13:32: 13:33
let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:13:13: 13:34
let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:13:13: 13:34
let mut _9: Point; // in scope 0 at $DIR/optimizes_into_variable.rs:14:13: 14:36
scope 1 {
debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10
let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
scope 2 {
debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10
let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
scope 3 {
debug z => _8; // in scope 3 at $DIR/optimizes_into_variable.rs:14:9: 14:10
}
}
}
bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
- _2 = CheckedAdd(const 2i32, const 2i32); // bb0[1]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
+ _2 = (const 4i32, const false); // bb0[1]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
// ty::Const
// + ty: i32
- // + val: Value(Scalar(0x00000002))
+ // + val: Value(Scalar(0x00000004))
// mir::Constant
- // + span: $DIR/optimizes_into_variable.rs:12:13: 12:14
- // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
+ // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
+ // + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
// ty::Const
- // + ty: i32
- // + val: Value(Scalar(0x00000002))
+ // + ty: bool
+ // + val: Value(Scalar(0x00))
// mir::Constant
- // + span: $DIR/optimizes_into_variable.rs:12:17: 12:18
- // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
- assert(!move (_2.1: bool), "attempt to add with overflow") -> bb1; // bb0[2]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
+ // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
+ // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
+ assert(!const false, "attempt to add with overflow") -> bb1; // bb0[2]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
+ // ty::Const
+ // + ty: bool
+ // + val: Value(Scalar(0x00))
+ // mir::Constant
+ // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
+ // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
}
bb1: {
- _1 = move (_2.0: i32); // bb1[0]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
+ _1 = const 4i32; // bb1[0]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
+ // ty::Const
+ // + ty: i32
+ // + val: Value(Scalar(0x00000004))
+ // mir::Constant
+ // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
+ // + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
StorageLive(_3); // bb1[1]: scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
StorageLive(_4); // bb1[2]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:31
_4 = [const 0i32, const 1i32, const 2i32, const 3i32, const 4i32, const 5i32]; // bb1[3]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:31
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000000))
// mir::Constant
// + span: $DIR/optimizes_into_variable.rs:13:14: 13:15
// + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) }
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000001))
// mir::Constant
// + span: $DIR/optimizes_into_variable.rs:13:17: 13:18
// + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000002))
// mir::Constant
// + span: $DIR/optimizes_into_variable.rs:13:20: 13:21
// + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000003))
// mir::Constant
// + span: $DIR/optimizes_into_variable.rs:13:23: 13:24
// + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000004))
// mir::Constant
// + span: $DIR/optimizes_into_variable.rs:13:26: 13:27
// + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000005))
// mir::Constant
// + span: $DIR/optimizes_into_variable.rs:13:29: 13:30
// + literal: Const { ty: i32, val: Value(Scalar(0x00000005)) }
StorageLive(_5); // bb1[4]: scope 1 at $DIR/optimizes_into_variable.rs:13:32: 13:33
_5 = const 3usize; // bb1[5]: scope 1 at $DIR/optimizes_into_variable.rs:13:32: 13:33
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000003))
// mir::Constant
// + span: $DIR/optimizes_into_variable.rs:13:32: 13:33
// + literal: Const { ty: usize, val: Value(Scalar(0x00000003)) }
_6 = const 6usize; // bb1[6]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000006))
// mir::Constant
// + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
// + literal: Const { ty: usize, val: Value(Scalar(0x00000006)) }
- _7 = Lt(_5, _6); // bb1[7]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
- assert(move _7, "index out of bounds: the len is move _6 but the index is _5") -> bb2; // bb1[8]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
+ _7 = const true; // bb1[7]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
+ // ty::Const
+ // + ty: bool
+ // + val: Value(Scalar(0x01))
+ // mir::Constant
+ // + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
+ assert(const true, "index out of bounds: the len is move _6 but the index is _5") -> bb2; // bb1[8]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
+ // ty::Const
+ // + ty: bool
+ // + val: Value(Scalar(0x01))
+ // mir::Constant
+ // + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
}
bb2: {
- _3 = _4[_5]; // bb2[0]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
+ _3 = const 3i32; // bb2[0]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
+ // ty::Const
+ // + ty: i32
+ // + val: Value(Scalar(0x00000003))
+ // mir::Constant
+ // + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
+ // + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
StorageDead(_5); // bb2[1]: scope 1 at $DIR/optimizes_into_variable.rs:13:34: 13:35
StorageDead(_4); // bb2[2]: scope 1 at $DIR/optimizes_into_variable.rs:13:34: 13:35
StorageLive(_8); // bb2[3]: scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
StorageLive(_9); // bb2[4]: scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:36
_9 = Point { x: const 12u32, y: const 42u32 }; // bb2[5]: scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:36
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x0000000c))
// mir::Constant
// + span: $DIR/optimizes_into_variable.rs:14:25: 14:27
// + literal: Const { ty: u32, val: Value(Scalar(0x0000000c)) }
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x0000002a))
// mir::Constant
// + span: $DIR/optimizes_into_variable.rs:14:32: 14:34
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
- _8 = (_9.1: u32); // bb2[6]: scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
+ _8 = const 42u32; // bb2[6]: scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
+ // ty::Const
+ // + ty: u32
+ // + val: Value(Scalar(0x0000002a))
+ // mir::Constant
+ // + span: $DIR/optimizes_into_variable.rs:14:13: 14:38
+ // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
StorageDead(_9); // bb2[7]: scope 2 at $DIR/optimizes_into_variable.rs:14:38: 14:39
_0 = (); // bb2[8]: scope 0 at $DIR/optimizes_into_variable.rs:11:11: 15:2
StorageDead(_8); // bb2[9]: scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2
StorageDead(_3); // bb2[10]: scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2
StorageDead(_1); // bb2[11]: scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2
return; // bb2[12]: scope 0 at $DIR/optimizes_into_variable.rs:15:2: 15:2
}
}
// MIR for `main` after SimplifyLocals // MIR for `main` after SimplifyLocals
fn main() -> () { fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:10:11: 10:11 let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:11:11: 11:11
let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:11:9: 11:10 let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
let mut _3: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:31 let mut _3: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:13:13: 13:31
scope 1 { scope 1 {
debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:11:9: 11:10 debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10
let _2: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10 let _2: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
scope 2 { scope 2 {
debug y => _2; // in scope 2 at $DIR/optimizes_into_variable.rs:12:9: 12:10 debug y => _2; // in scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10
let _4: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10 let _4: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
scope 3 { scope 3 {
debug z => _4; // in scope 3 at $DIR/optimizes_into_variable.rs:13:9: 13:10 debug z => _4; // in scope 3 at $DIR/optimizes_into_variable.rs:14:9: 14:10
} }
} }
} }
bb0: { bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/optimizes_into_variable.rs:11:9: 11:10 StorageLive(_1); // bb0[0]: scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
_1 = const 4i32; // bb0[1]: scope 0 at $DIR/optimizes_into_variable.rs:11:13: 11:18 _1 = const 4i32; // bb0[1]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
// ty::Const // ty::Const
// + ty: i32 // + ty: i32
// + val: Value(Scalar(0x00000004)) // + val: Value(Scalar(0x00000004))
// mir::Constant // mir::Constant
// + span: $DIR/optimizes_into_variable.rs:11:13: 11:18 // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
// + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) } // + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
StorageLive(_2); // bb0[2]: scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10 StorageLive(_2); // bb0[2]: scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
StorageLive(_3); // bb0[3]: scope 1 at $DIR/optimizes_into_variable.rs:12:13: 12:31 StorageLive(_3); // bb0[3]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:31
_3 = [const 0i32, const 1i32, const 2i32, const 3i32, const 4i32, const 5i32]; // bb0[4]: scope 1 at $DIR/optimizes_into_variable.rs:12:13: 12:31 _3 = [const 0i32, const 1i32, const 2i32, const 3i32, const 4i32, const 5i32]; // bb0[4]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:31
// ty::Const // ty::Const
// + ty: i32 // + ty: i32
// + val: Value(Scalar(0x00000000)) // + val: Value(Scalar(0x00000000))
// mir::Constant // mir::Constant
// + span: $DIR/optimizes_into_variable.rs:12:14: 12:15 // + span: $DIR/optimizes_into_variable.rs:13:14: 13:15
// + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) } // + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) }
// ty::Const // ty::Const
// + ty: i32 // + ty: i32
// + val: Value(Scalar(0x00000001)) // + val: Value(Scalar(0x00000001))
// mir::Constant // mir::Constant
// + span: $DIR/optimizes_into_variable.rs:12:17: 12:18 // + span: $DIR/optimizes_into_variable.rs:13:17: 13:18
// + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) } // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
// ty::Const // ty::Const
// + ty: i32 // + ty: i32
// + val: Value(Scalar(0x00000002)) // + val: Value(Scalar(0x00000002))
// mir::Constant // mir::Constant
// + span: $DIR/optimizes_into_variable.rs:12:20: 12:21 // + span: $DIR/optimizes_into_variable.rs:13:20: 13:21
// + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) } // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
// ty::Const // ty::Const
// + ty: i32 // + ty: i32
// + val: Value(Scalar(0x00000003)) // + val: Value(Scalar(0x00000003))
// mir::Constant // mir::Constant
// + span: $DIR/optimizes_into_variable.rs:12:23: 12:24 // + span: $DIR/optimizes_into_variable.rs:13:23: 13:24
// + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) } // + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
// ty::Const // ty::Const
// + ty: i32 // + ty: i32
// + val: Value(Scalar(0x00000004)) // + val: Value(Scalar(0x00000004))
// mir::Constant // mir::Constant
// + span: $DIR/optimizes_into_variable.rs:12:26: 12:27 // + span: $DIR/optimizes_into_variable.rs:13:26: 13:27
// + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) } // + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
// ty::Const // ty::Const
// + ty: i32 // + ty: i32
// + val: Value(Scalar(0x00000005)) // + val: Value(Scalar(0x00000005))
// mir::Constant // mir::Constant
// + span: $DIR/optimizes_into_variable.rs:12:29: 12:30 // + span: $DIR/optimizes_into_variable.rs:13:29: 13:30
// + literal: Const { ty: i32, val: Value(Scalar(0x00000005)) } // + literal: Const { ty: i32, val: Value(Scalar(0x00000005)) }
_2 = const 3i32; // bb0[5]: scope 1 at $DIR/optimizes_into_variable.rs:12:13: 12:34 _2 = const 3i32; // bb0[5]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
// ty::Const // ty::Const
// + ty: i32 // + ty: i32
// + val: Value(Scalar(0x00000003)) // + val: Value(Scalar(0x00000003))
// mir::Constant // mir::Constant
// + span: $DIR/optimizes_into_variable.rs:12:13: 12:34 // + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
// + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) } // + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
StorageDead(_3); // bb0[6]: scope 1 at $DIR/optimizes_into_variable.rs:12:34: 12:35 StorageDead(_3); // bb0[6]: scope 1 at $DIR/optimizes_into_variable.rs:13:34: 13:35
StorageLive(_4); // bb0[7]: scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10 StorageLive(_4); // bb0[7]: scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
_4 = const 42u32; // bb0[8]: scope 2 at $DIR/optimizes_into_variable.rs:13:13: 13:38 _4 = const 42u32; // bb0[8]: scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
// ty::Const // ty::Const
// + ty: u32 // + ty: u32
// + val: Value(Scalar(0x0000002a)) // + val: Value(Scalar(0x0000002a))
// mir::Constant // mir::Constant
// + span: $DIR/optimizes_into_variable.rs:13:13: 13:38 // + span: $DIR/optimizes_into_variable.rs:14:13: 14:38
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) } // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
StorageDead(_4); // bb0[9]: scope 2 at $DIR/optimizes_into_variable.rs:14:1: 14:2 StorageDead(_4); // bb0[9]: scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2
StorageDead(_2); // bb0[10]: scope 1 at $DIR/optimizes_into_variable.rs:14:1: 14:2 StorageDead(_2); // bb0[10]: scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2
StorageDead(_1); // bb0[11]: scope 0 at $DIR/optimizes_into_variable.rs:14:1: 14:2 StorageDead(_1); // bb0[11]: scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2
return; // bb0[12]: scope 0 at $DIR/optimizes_into_variable.rs:14:2: 14:2 return; // bb0[12]: scope 0 at $DIR/optimizes_into_variable.rs:15:2: 15:2
} }
} }
...@@ -2,38 +2,38 @@ ...@@ -2,38 +2,38 @@
+ // MIR for `main` after ConstProp + // MIR for `main` after ConstProp
fn main() -> () { fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:10:11: 10:11 let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:11:11: 11:11
let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:11:9: 11:10 let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:11:13: 11:18 let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:31 let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:13:13: 13:31
let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:12:32: 12:33 let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:13:32: 13:33
let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:34 let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:13:13: 13:34
let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:34 let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:13:13: 13:34
let mut _9: Point; // in scope 0 at $DIR/optimizes_into_variable.rs:13:13: 13:36 let mut _9: Point; // in scope 0 at $DIR/optimizes_into_variable.rs:14:13: 14:36
scope 1 { scope 1 {
debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:11:9: 11:10 debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10
let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10 let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
scope 2 { scope 2 {
debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:12:9: 12:10 debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10
let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10 let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
scope 3 { scope 3 {
debug z => _8; // in scope 3 at $DIR/optimizes_into_variable.rs:13:9: 13:10 debug z => _8; // in scope 3 at $DIR/optimizes_into_variable.rs:14:9: 14:10
} }
} }
} }
bb0: { bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/optimizes_into_variable.rs:11:9: 11:10 StorageLive(_1); // bb0[0]: scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
- _2 = CheckedAdd(const 2i32, const 2i32); // bb0[1]: scope 0 at $DIR/optimizes_into_variable.rs:11:13: 11:18 - _2 = CheckedAdd(const 2i32, const 2i32); // bb0[1]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
+ _2 = (const 4i32, const false); // bb0[1]: scope 0 at $DIR/optimizes_into_variable.rs:11:13: 11:18 + _2 = (const 4i32, const false); // bb0[1]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
// ty::Const // ty::Const
// + ty: i32 // + ty: i32
- // + val: Value(Scalar(0x00000002)) - // + val: Value(Scalar(0x00000002))
+ // + val: Value(Scalar(0x00000004)) + // + val: Value(Scalar(0x00000004))
// mir::Constant // mir::Constant
- // + span: $DIR/optimizes_into_variable.rs:11:13: 11:14 - // + span: $DIR/optimizes_into_variable.rs:12:13: 12:14
- // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) } - // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
+ // + span: $DIR/optimizes_into_variable.rs:11:13: 11:18 + // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
+ // + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) } + // + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
// ty::Const // ty::Const
- // + ty: i32 - // + ty: i32
...@@ -41,141 +41,141 @@ ...@@ -41,141 +41,141 @@
+ // + ty: bool + // + ty: bool
+ // + val: Value(Scalar(0x00)) + // + val: Value(Scalar(0x00))
// mir::Constant // mir::Constant
- // + span: $DIR/optimizes_into_variable.rs:11:17: 11:18 - // + span: $DIR/optimizes_into_variable.rs:12:17: 12:18
- // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) } - // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
- assert(!move (_2.1: bool), "attempt to add with overflow") -> bb1; // bb0[2]: scope 0 at $DIR/optimizes_into_variable.rs:11:13: 11:18 - assert(!move (_2.1: bool), "attempt to add with overflow") -> bb1; // bb0[2]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
+ // + span: $DIR/optimizes_into_variable.rs:11:13: 11:18 + // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
+ // + literal: Const { ty: bool, val: Value(Scalar(0x00)) } + // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
+ assert(!const false, "attempt to add with overflow") -> bb1; // bb0[2]: scope 0 at $DIR/optimizes_into_variable.rs:11:13: 11:18 + assert(!const false, "attempt to add with overflow") -> bb1; // bb0[2]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
+ // ty::Const + // ty::Const
+ // + ty: bool + // + ty: bool
+ // + val: Value(Scalar(0x00)) + // + val: Value(Scalar(0x00))
+ // mir::Constant + // mir::Constant
+ // + span: $DIR/optimizes_into_variable.rs:11:13: 11:18 + // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
+ // + literal: Const { ty: bool, val: Value(Scalar(0x00)) } + // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
} }
bb1: { bb1: {
- _1 = move (_2.0: i32); // bb1[0]: scope 0 at $DIR/optimizes_into_variable.rs:11:13: 11:18 - _1 = move (_2.0: i32); // bb1[0]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
+ _1 = const 4i32; // bb1[0]: scope 0 at $DIR/optimizes_into_variable.rs:11:13: 11:18 + _1 = const 4i32; // bb1[0]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
+ // ty::Const + // ty::Const
+ // + ty: i32 + // + ty: i32
+ // + val: Value(Scalar(0x00000004)) + // + val: Value(Scalar(0x00000004))
+ // mir::Constant + // mir::Constant
+ // + span: $DIR/optimizes_into_variable.rs:11:13: 11:18 + // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
+ // + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) } + // + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
StorageLive(_3); // bb1[1]: scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10 StorageLive(_3); // bb1[1]: scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
StorageLive(_4); // bb1[2]: scope 1 at $DIR/optimizes_into_variable.rs:12:13: 12:31 StorageLive(_4); // bb1[2]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:31
_4 = [const 0i32, const 1i32, const 2i32, const 3i32, const 4i32, const 5i32]; // bb1[3]: scope 1 at $DIR/optimizes_into_variable.rs:12:13: 12:31 _4 = [const 0i32, const 1i32, const 2i32, const 3i32, const 4i32, const 5i32]; // bb1[3]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:31
// ty::Const // ty::Const
// + ty: i32 // + ty: i32
// + val: Value(Scalar(0x00000000)) // + val: Value(Scalar(0x00000000))
// mir::Constant // mir::Constant
// + span: $DIR/optimizes_into_variable.rs:12:14: 12:15 // + span: $DIR/optimizes_into_variable.rs:13:14: 13:15
// + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) } // + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) }
// ty::Const // ty::Const
// + ty: i32 // + ty: i32
// + val: Value(Scalar(0x00000001)) // + val: Value(Scalar(0x00000001))
// mir::Constant // mir::Constant
// + span: $DIR/optimizes_into_variable.rs:12:17: 12:18 // + span: $DIR/optimizes_into_variable.rs:13:17: 13:18
// + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) } // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
// ty::Const // ty::Const
// + ty: i32 // + ty: i32
// + val: Value(Scalar(0x00000002)) // + val: Value(Scalar(0x00000002))
// mir::Constant // mir::Constant
// + span: $DIR/optimizes_into_variable.rs:12:20: 12:21 // + span: $DIR/optimizes_into_variable.rs:13:20: 13:21
// + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) } // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
// ty::Const // ty::Const
// + ty: i32 // + ty: i32
// + val: Value(Scalar(0x00000003)) // + val: Value(Scalar(0x00000003))
// mir::Constant // mir::Constant
// + span: $DIR/optimizes_into_variable.rs:12:23: 12:24 // + span: $DIR/optimizes_into_variable.rs:13:23: 13:24
// + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) } // + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
// ty::Const // ty::Const
// + ty: i32 // + ty: i32
// + val: Value(Scalar(0x00000004)) // + val: Value(Scalar(0x00000004))
// mir::Constant // mir::Constant
// + span: $DIR/optimizes_into_variable.rs:12:26: 12:27 // + span: $DIR/optimizes_into_variable.rs:13:26: 13:27
// + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) } // + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
// ty::Const // ty::Const
// + ty: i32 // + ty: i32
// + val: Value(Scalar(0x00000005)) // + val: Value(Scalar(0x00000005))
// mir::Constant // mir::Constant
// + span: $DIR/optimizes_into_variable.rs:12:29: 12:30 // + span: $DIR/optimizes_into_variable.rs:13:29: 13:30
// + literal: Const { ty: i32, val: Value(Scalar(0x00000005)) } // + literal: Const { ty: i32, val: Value(Scalar(0x00000005)) }
StorageLive(_5); // bb1[4]: scope 1 at $DIR/optimizes_into_variable.rs:12:32: 12:33 StorageLive(_5); // bb1[4]: scope 1 at $DIR/optimizes_into_variable.rs:13:32: 13:33
_5 = const 3usize; // bb1[5]: scope 1 at $DIR/optimizes_into_variable.rs:12:32: 12:33 _5 = const 3usize; // bb1[5]: scope 1 at $DIR/optimizes_into_variable.rs:13:32: 13:33
// ty::Const // ty::Const
// + ty: usize // + ty: usize
// + val: Value(Scalar(0x0000000000000003)) // + val: Value(Scalar(0x0000000000000003))
// mir::Constant // mir::Constant
// + span: $DIR/optimizes_into_variable.rs:12:32: 12:33 // + span: $DIR/optimizes_into_variable.rs:13:32: 13:33
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000003)) } // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000003)) }
_6 = const 6usize; // bb1[6]: scope 1 at $DIR/optimizes_into_variable.rs:12:13: 12:34 _6 = const 6usize; // bb1[6]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
// ty::Const // ty::Const
// + ty: usize // + ty: usize
// + val: Value(Scalar(0x0000000000000006)) // + val: Value(Scalar(0x0000000000000006))
// mir::Constant // mir::Constant
// + span: $DIR/optimizes_into_variable.rs:12:13: 12:34 // + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000006)) } // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000006)) }
- _7 = Lt(_5, _6); // bb1[7]: scope 1 at $DIR/optimizes_into_variable.rs:12:13: 12:34 - _7 = Lt(_5, _6); // bb1[7]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
- assert(move _7, "index out of bounds: the len is move _6 but the index is _5") -> bb2; // bb1[8]: scope 1 at $DIR/optimizes_into_variable.rs:12:13: 12:34 - assert(move _7, "index out of bounds: the len is move _6 but the index is _5") -> bb2; // bb1[8]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
+ _7 = const true; // bb1[7]: scope 1 at $DIR/optimizes_into_variable.rs:12:13: 12:34 + _7 = const true; // bb1[7]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
+ // ty::Const + // ty::Const
+ // + ty: bool + // + ty: bool
+ // + val: Value(Scalar(0x01)) + // + val: Value(Scalar(0x01))
+ // mir::Constant + // mir::Constant
+ // + span: $DIR/optimizes_into_variable.rs:12:13: 12:34 + // + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) } + // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
+ assert(const true, "index out of bounds: the len is move _6 but the index is _5") -> bb2; // bb1[8]: scope 1 at $DIR/optimizes_into_variable.rs:12:13: 12:34 + assert(const true, "index out of bounds: the len is move _6 but the index is _5") -> bb2; // bb1[8]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
+ // ty::Const + // ty::Const
+ // + ty: bool + // + ty: bool
+ // + val: Value(Scalar(0x01)) + // + val: Value(Scalar(0x01))
+ // mir::Constant + // mir::Constant
+ // + span: $DIR/optimizes_into_variable.rs:12:13: 12:34 + // + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) } + // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
} }
bb2: { bb2: {
- _3 = _4[_5]; // bb2[0]: scope 1 at $DIR/optimizes_into_variable.rs:12:13: 12:34 - _3 = _4[_5]; // bb2[0]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
+ _3 = const 3i32; // bb2[0]: scope 1 at $DIR/optimizes_into_variable.rs:12:13: 12:34 + _3 = const 3i32; // bb2[0]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
+ // ty::Const + // ty::Const
+ // + ty: i32 + // + ty: i32
+ // + val: Value(Scalar(0x00000003)) + // + val: Value(Scalar(0x00000003))
+ // mir::Constant + // mir::Constant
+ // + span: $DIR/optimizes_into_variable.rs:12:13: 12:34 + // + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
+ // + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) } + // + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
StorageDead(_5); // bb2[1]: scope 1 at $DIR/optimizes_into_variable.rs:12:34: 12:35 StorageDead(_5); // bb2[1]: scope 1 at $DIR/optimizes_into_variable.rs:13:34: 13:35
StorageDead(_4); // bb2[2]: scope 1 at $DIR/optimizes_into_variable.rs:12:34: 12:35 StorageDead(_4); // bb2[2]: scope 1 at $DIR/optimizes_into_variable.rs:13:34: 13:35
StorageLive(_8); // bb2[3]: scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10 StorageLive(_8); // bb2[3]: scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
StorageLive(_9); // bb2[4]: scope 2 at $DIR/optimizes_into_variable.rs:13:13: 13:36 StorageLive(_9); // bb2[4]: scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:36
_9 = Point { x: const 12u32, y: const 42u32 }; // bb2[5]: scope 2 at $DIR/optimizes_into_variable.rs:13:13: 13:36 _9 = Point { x: const 12u32, y: const 42u32 }; // bb2[5]: scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:36
// ty::Const // ty::Const
// + ty: u32 // + ty: u32
// + val: Value(Scalar(0x0000000c)) // + val: Value(Scalar(0x0000000c))
// mir::Constant // mir::Constant
// + span: $DIR/optimizes_into_variable.rs:13:25: 13:27 // + span: $DIR/optimizes_into_variable.rs:14:25: 14:27
// + literal: Const { ty: u32, val: Value(Scalar(0x0000000c)) } // + literal: Const { ty: u32, val: Value(Scalar(0x0000000c)) }
// ty::Const // ty::Const
// + ty: u32 // + ty: u32
// + val: Value(Scalar(0x0000002a)) // + val: Value(Scalar(0x0000002a))
// mir::Constant // mir::Constant
// + span: $DIR/optimizes_into_variable.rs:13:32: 13:34 // + span: $DIR/optimizes_into_variable.rs:14:32: 14:34
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) } // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
- _8 = (_9.1: u32); // bb2[6]: scope 2 at $DIR/optimizes_into_variable.rs:13:13: 13:38 - _8 = (_9.1: u32); // bb2[6]: scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
+ _8 = const 42u32; // bb2[6]: scope 2 at $DIR/optimizes_into_variable.rs:13:13: 13:38 + _8 = const 42u32; // bb2[6]: scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
+ // ty::Const + // ty::Const
+ // + ty: u32 + // + ty: u32
+ // + val: Value(Scalar(0x0000002a)) + // + val: Value(Scalar(0x0000002a))
+ // mir::Constant + // mir::Constant
+ // + span: $DIR/optimizes_into_variable.rs:13:13: 13:38 + // + span: $DIR/optimizes_into_variable.rs:14:13: 14:38
+ // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) } + // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
StorageDead(_9); // bb2[7]: scope 2 at $DIR/optimizes_into_variable.rs:13:38: 13:39 StorageDead(_9); // bb2[7]: scope 2 at $DIR/optimizes_into_variable.rs:14:38: 14:39
_0 = (); // bb2[8]: scope 0 at $DIR/optimizes_into_variable.rs:10:11: 14:2 _0 = (); // bb2[8]: scope 0 at $DIR/optimizes_into_variable.rs:11:11: 15:2
StorageDead(_8); // bb2[9]: scope 2 at $DIR/optimizes_into_variable.rs:14:1: 14:2 StorageDead(_8); // bb2[9]: scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2
StorageDead(_3); // bb2[10]: scope 1 at $DIR/optimizes_into_variable.rs:14:1: 14:2 StorageDead(_3); // bb2[10]: scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2
StorageDead(_1); // bb2[11]: scope 0 at $DIR/optimizes_into_variable.rs:14:1: 14:2 StorageDead(_1); // bb2[11]: scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2
return; // bb2[12]: scope 0 at $DIR/optimizes_into_variable.rs:14:2: 14:2 return; // bb2[12]: scope 0 at $DIR/optimizes_into_variable.rs:15:2: 15:2
} }
} }
// MIR for `main` after SimplifyLocals
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:11:11: 11:11
let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
let mut _3: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:13:13: 13:31
scope 1 {
debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10
let _2: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
scope 2 {
debug y => _2; // in scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10
let _4: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
scope 3 {
debug z => _4; // in scope 3 at $DIR/optimizes_into_variable.rs:14:9: 14:10
}
}
}
bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
_1 = const 4i32; // bb0[1]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000004))
// mir::Constant
// + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
// + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
StorageLive(_2); // bb0[2]: scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
StorageLive(_3); // bb0[3]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:31
_3 = [const 0i32, const 1i32, const 2i32, const 3i32, const 4i32, const 5i32]; // bb0[4]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:31
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000000))
// mir::Constant
// + span: $DIR/optimizes_into_variable.rs:13:14: 13:15
// + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) }
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000001))
// mir::Constant
// + span: $DIR/optimizes_into_variable.rs:13:17: 13:18
// + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000002))
// mir::Constant
// + span: $DIR/optimizes_into_variable.rs:13:20: 13:21
// + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000003))
// mir::Constant
// + span: $DIR/optimizes_into_variable.rs:13:23: 13:24
// + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000004))
// mir::Constant
// + span: $DIR/optimizes_into_variable.rs:13:26: 13:27
// + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000005))
// mir::Constant
// + span: $DIR/optimizes_into_variable.rs:13:29: 13:30
// + literal: Const { ty: i32, val: Value(Scalar(0x00000005)) }
_2 = const 3i32; // bb0[5]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000003))
// mir::Constant
// + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
// + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
StorageDead(_3); // bb0[6]: scope 1 at $DIR/optimizes_into_variable.rs:13:34: 13:35
StorageLive(_4); // bb0[7]: scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
_4 = const 42u32; // bb0[8]: scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x0000002a))
// mir::Constant
// + span: $DIR/optimizes_into_variable.rs:14:13: 14:38
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
StorageDead(_4); // bb0[9]: scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2
StorageDead(_2); // bb0[10]: scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2
StorageDead(_1); // bb0[11]: scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2
return; // bb0[12]: scope 0 at $DIR/optimizes_into_variable.rs:15:2: 15:2
}
}
// compile-flags: -O // compile-flags: -O
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR rustc.main.ConstProp.diff // EMIT_MIR rustc.main.ConstProp.diff
fn main() { fn main() {
let x: u32 = [42; 8][2] + 0; let x: u32 = [42; 8][2] + 0;
......
- // MIR for `main` before ConstProp
+ // MIR for `main` after ConstProp
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/repeat.rs:5:11: 5:11
let _1: u32 as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/repeat.rs:6:9: 6:10
let mut _2: u32; // in scope 0 at $DIR/repeat.rs:6:18: 6:28
let mut _3: [u32; 8]; // in scope 0 at $DIR/repeat.rs:6:18: 6:25
let _4: usize; // in scope 0 at $DIR/repeat.rs:6:26: 6:27
let mut _5: usize; // in scope 0 at $DIR/repeat.rs:6:18: 6:28
let mut _6: bool; // in scope 0 at $DIR/repeat.rs:6:18: 6:28
scope 1 {
debug x => _1; // in scope 1 at $DIR/repeat.rs:6:9: 6:10
}
bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/repeat.rs:6:9: 6:10
StorageLive(_2); // bb0[1]: scope 0 at $DIR/repeat.rs:6:18: 6:28
StorageLive(_3); // bb0[2]: scope 0 at $DIR/repeat.rs:6:18: 6:25
_3 = [const 42u32; 8]; // bb0[3]: scope 0 at $DIR/repeat.rs:6:18: 6:25
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x0000002a))
// mir::Constant
// + span: $DIR/repeat.rs:6:19: 6:21
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
StorageLive(_4); // bb0[4]: scope 0 at $DIR/repeat.rs:6:26: 6:27
_4 = const 2usize; // bb0[5]: scope 0 at $DIR/repeat.rs:6:26: 6:27
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000002))
// mir::Constant
// + span: $DIR/repeat.rs:6:26: 6:27
// + literal: Const { ty: usize, val: Value(Scalar(0x00000002)) }
_5 = const 8usize; // bb0[6]: scope 0 at $DIR/repeat.rs:6:18: 6:28
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000008))
// mir::Constant
// + span: $DIR/repeat.rs:6:18: 6:28
// + literal: Const { ty: usize, val: Value(Scalar(0x00000008)) }
- _6 = Lt(_4, _5); // bb0[7]: scope 0 at $DIR/repeat.rs:6:18: 6:28
- assert(move _6, "index out of bounds: the len is move _5 but the index is _4") -> bb1; // bb0[8]: scope 0 at $DIR/repeat.rs:6:18: 6:28
+ _6 = const true; // bb0[7]: scope 0 at $DIR/repeat.rs:6:18: 6:28
+ // ty::Const
+ // + ty: bool
+ // + val: Value(Scalar(0x01))
+ // mir::Constant
+ // + span: $DIR/repeat.rs:6:18: 6:28
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
+ assert(const true, "index out of bounds: the len is move _5 but the index is _4") -> bb1; // bb0[8]: scope 0 at $DIR/repeat.rs:6:18: 6:28
+ // ty::Const
+ // + ty: bool
+ // + val: Value(Scalar(0x01))
+ // mir::Constant
+ // + span: $DIR/repeat.rs:6:18: 6:28
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
}
bb1: {
- _2 = _3[_4]; // bb1[0]: scope 0 at $DIR/repeat.rs:6:18: 6:28
- _1 = Add(move _2, const 0u32); // bb1[1]: scope 0 at $DIR/repeat.rs:6:18: 6:32
+ _2 = const 42u32; // bb1[0]: scope 0 at $DIR/repeat.rs:6:18: 6:28
// ty::Const
// + ty: u32
- // + val: Value(Scalar(0x00000000))
+ // + val: Value(Scalar(0x0000002a))
// mir::Constant
- // + span: $DIR/repeat.rs:6:31: 6:32
- // + literal: Const { ty: u32, val: Value(Scalar(0x00000000)) }
+ // + span: $DIR/repeat.rs:6:18: 6:28
+ // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
+ _1 = const 42u32; // bb1[1]: scope 0 at $DIR/repeat.rs:6:18: 6:32
+ // ty::Const
+ // + ty: u32
+ // + val: Value(Scalar(0x0000002a))
+ // mir::Constant
+ // + span: $DIR/repeat.rs:6:18: 6:32
+ // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
StorageDead(_2); // bb1[2]: scope 0 at $DIR/repeat.rs:6:31: 6:32
StorageDead(_4); // bb1[3]: scope 0 at $DIR/repeat.rs:6:32: 6:33
StorageDead(_3); // bb1[4]: scope 0 at $DIR/repeat.rs:6:32: 6:33
_0 = (); // bb1[5]: scope 0 at $DIR/repeat.rs:5:11: 7:2
StorageDead(_1); // bb1[6]: scope 0 at $DIR/repeat.rs:7:1: 7:2
return; // bb1[7]: scope 0 at $DIR/repeat.rs:7:2: 7:2
}
}
...@@ -2,87 +2,87 @@ ...@@ -2,87 +2,87 @@
+ // MIR for `main` after ConstProp + // MIR for `main` after ConstProp
fn main() -> () { fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/repeat.rs:4:11: 4:11 let mut _0: (); // return place in scope 0 at $DIR/repeat.rs:5:11: 5:11
let _1: u32 as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/repeat.rs:5:9: 5:10 let _1: u32 as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/repeat.rs:6:9: 6:10
let mut _2: u32; // in scope 0 at $DIR/repeat.rs:5:18: 5:28 let mut _2: u32; // in scope 0 at $DIR/repeat.rs:6:18: 6:28
let mut _3: [u32; 8]; // in scope 0 at $DIR/repeat.rs:5:18: 5:25 let mut _3: [u32; 8]; // in scope 0 at $DIR/repeat.rs:6:18: 6:25
let _4: usize; // in scope 0 at $DIR/repeat.rs:5:26: 5:27 let _4: usize; // in scope 0 at $DIR/repeat.rs:6:26: 6:27
let mut _5: usize; // in scope 0 at $DIR/repeat.rs:5:18: 5:28 let mut _5: usize; // in scope 0 at $DIR/repeat.rs:6:18: 6:28
let mut _6: bool; // in scope 0 at $DIR/repeat.rs:5:18: 5:28 let mut _6: bool; // in scope 0 at $DIR/repeat.rs:6:18: 6:28
scope 1 { scope 1 {
debug x => _1; // in scope 1 at $DIR/repeat.rs:5:9: 5:10 debug x => _1; // in scope 1 at $DIR/repeat.rs:6:9: 6:10
} }
bb0: { bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/repeat.rs:5:9: 5:10 StorageLive(_1); // bb0[0]: scope 0 at $DIR/repeat.rs:6:9: 6:10
StorageLive(_2); // bb0[1]: scope 0 at $DIR/repeat.rs:5:18: 5:28 StorageLive(_2); // bb0[1]: scope 0 at $DIR/repeat.rs:6:18: 6:28
StorageLive(_3); // bb0[2]: scope 0 at $DIR/repeat.rs:5:18: 5:25 StorageLive(_3); // bb0[2]: scope 0 at $DIR/repeat.rs:6:18: 6:25
_3 = [const 42u32; 8]; // bb0[3]: scope 0 at $DIR/repeat.rs:5:18: 5:25 _3 = [const 42u32; 8]; // bb0[3]: scope 0 at $DIR/repeat.rs:6:18: 6:25
// ty::Const // ty::Const
// + ty: u32 // + ty: u32
// + val: Value(Scalar(0x0000002a)) // + val: Value(Scalar(0x0000002a))
// mir::Constant // mir::Constant
// + span: $DIR/repeat.rs:5:19: 5:21 // + span: $DIR/repeat.rs:6:19: 6:21
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) } // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
StorageLive(_4); // bb0[4]: scope 0 at $DIR/repeat.rs:5:26: 5:27 StorageLive(_4); // bb0[4]: scope 0 at $DIR/repeat.rs:6:26: 6:27
_4 = const 2usize; // bb0[5]: scope 0 at $DIR/repeat.rs:5:26: 5:27 _4 = const 2usize; // bb0[5]: scope 0 at $DIR/repeat.rs:6:26: 6:27
// ty::Const // ty::Const
// + ty: usize // + ty: usize
// + val: Value(Scalar(0x0000000000000002)) // + val: Value(Scalar(0x0000000000000002))
// mir::Constant // mir::Constant
// + span: $DIR/repeat.rs:5:26: 5:27 // + span: $DIR/repeat.rs:6:26: 6:27
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000002)) } // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000002)) }
_5 = const 8usize; // bb0[6]: scope 0 at $DIR/repeat.rs:5:18: 5:28 _5 = const 8usize; // bb0[6]: scope 0 at $DIR/repeat.rs:6:18: 6:28
// ty::Const // ty::Const
// + ty: usize // + ty: usize
// + val: Value(Scalar(0x0000000000000008)) // + val: Value(Scalar(0x0000000000000008))
// mir::Constant // mir::Constant
// + span: $DIR/repeat.rs:5:18: 5:28 // + span: $DIR/repeat.rs:6:18: 6:28
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000008)) } // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000008)) }
- _6 = Lt(_4, _5); // bb0[7]: scope 0 at $DIR/repeat.rs:5:18: 5:28 - _6 = Lt(_4, _5); // bb0[7]: scope 0 at $DIR/repeat.rs:6:18: 6:28
- assert(move _6, "index out of bounds: the len is move _5 but the index is _4") -> bb1; // bb0[8]: scope 0 at $DIR/repeat.rs:5:18: 5:28 - assert(move _6, "index out of bounds: the len is move _5 but the index is _4") -> bb1; // bb0[8]: scope 0 at $DIR/repeat.rs:6:18: 6:28
+ _6 = const true; // bb0[7]: scope 0 at $DIR/repeat.rs:5:18: 5:28 + _6 = const true; // bb0[7]: scope 0 at $DIR/repeat.rs:6:18: 6:28
+ // ty::Const + // ty::Const
+ // + ty: bool + // + ty: bool
+ // + val: Value(Scalar(0x01)) + // + val: Value(Scalar(0x01))
+ // mir::Constant + // mir::Constant
+ // + span: $DIR/repeat.rs:5:18: 5:28 + // + span: $DIR/repeat.rs:6:18: 6:28
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) } + // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
+ assert(const true, "index out of bounds: the len is move _5 but the index is _4") -> bb1; // bb0[8]: scope 0 at $DIR/repeat.rs:5:18: 5:28 + assert(const true, "index out of bounds: the len is move _5 but the index is _4") -> bb1; // bb0[8]: scope 0 at $DIR/repeat.rs:6:18: 6:28
+ // ty::Const + // ty::Const
+ // + ty: bool + // + ty: bool
+ // + val: Value(Scalar(0x01)) + // + val: Value(Scalar(0x01))
+ // mir::Constant + // mir::Constant
+ // + span: $DIR/repeat.rs:5:18: 5:28 + // + span: $DIR/repeat.rs:6:18: 6:28
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) } + // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
} }
bb1: { bb1: {
- _2 = _3[_4]; // bb1[0]: scope 0 at $DIR/repeat.rs:5:18: 5:28 - _2 = _3[_4]; // bb1[0]: scope 0 at $DIR/repeat.rs:6:18: 6:28
- _1 = Add(move _2, const 0u32); // bb1[1]: scope 0 at $DIR/repeat.rs:5:18: 5:32 - _1 = Add(move _2, const 0u32); // bb1[1]: scope 0 at $DIR/repeat.rs:6:18: 6:32
+ _2 = const 42u32; // bb1[0]: scope 0 at $DIR/repeat.rs:5:18: 5:28 + _2 = const 42u32; // bb1[0]: scope 0 at $DIR/repeat.rs:6:18: 6:28
// ty::Const // ty::Const
// + ty: u32 // + ty: u32
- // + val: Value(Scalar(0x00000000)) - // + val: Value(Scalar(0x00000000))
+ // + val: Value(Scalar(0x0000002a)) + // + val: Value(Scalar(0x0000002a))
// mir::Constant // mir::Constant
- // + span: $DIR/repeat.rs:5:31: 5:32 - // + span: $DIR/repeat.rs:6:31: 6:32
- // + literal: Const { ty: u32, val: Value(Scalar(0x00000000)) } - // + literal: Const { ty: u32, val: Value(Scalar(0x00000000)) }
+ // + span: $DIR/repeat.rs:5:18: 5:28 + // + span: $DIR/repeat.rs:6:18: 6:28
+ // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) } + // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
+ _1 = const 42u32; // bb1[1]: scope 0 at $DIR/repeat.rs:5:18: 5:32 + _1 = const 42u32; // bb1[1]: scope 0 at $DIR/repeat.rs:6:18: 6:32
+ // ty::Const + // ty::Const
+ // + ty: u32 + // + ty: u32
+ // + val: Value(Scalar(0x0000002a)) + // + val: Value(Scalar(0x0000002a))
+ // mir::Constant + // mir::Constant
+ // + span: $DIR/repeat.rs:5:18: 5:32 + // + span: $DIR/repeat.rs:6:18: 6:32
+ // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) } + // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
StorageDead(_2); // bb1[2]: scope 0 at $DIR/repeat.rs:5:31: 5:32 StorageDead(_2); // bb1[2]: scope 0 at $DIR/repeat.rs:6:31: 6:32
StorageDead(_4); // bb1[3]: scope 0 at $DIR/repeat.rs:5:32: 5:33 StorageDead(_4); // bb1[3]: scope 0 at $DIR/repeat.rs:6:32: 6:33
StorageDead(_3); // bb1[4]: scope 0 at $DIR/repeat.rs:5:32: 5:33 StorageDead(_3); // bb1[4]: scope 0 at $DIR/repeat.rs:6:32: 6:33
_0 = (); // bb1[5]: scope 0 at $DIR/repeat.rs:4:11: 6:2 _0 = (); // bb1[5]: scope 0 at $DIR/repeat.rs:5:11: 7:2
StorageDead(_1); // bb1[6]: scope 0 at $DIR/repeat.rs:6:1: 6:2 StorageDead(_1); // bb1[6]: scope 0 at $DIR/repeat.rs:7:1: 7:2
return; // bb1[7]: scope 0 at $DIR/repeat.rs:6:2: 6:2 return; // bb1[7]: scope 0 at $DIR/repeat.rs:7:2: 7:2
} }
} }
// EMIT_MIR rustc.main.ConstProp.diff // EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR rustc.main.ConstProp.diff
fn main() { fn main() {
(&[1u32, 2, 3] as &[u32])[1]; (&[1u32, 2, 3] as &[u32])[1];
} }
- // MIR for `main` before ConstProp
+ // MIR for `main` after ConstProp
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/slice_len.rs:4:11: 4:11
let _1: u32; // in scope 0 at $DIR/slice_len.rs:5:5: 5:33
let mut _2: &[u32]; // in scope 0 at $DIR/slice_len.rs:5:5: 5:30
let mut _3: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:5:6: 5:19
let _4: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:5:6: 5:19
let _5: [u32; 3]; // in scope 0 at $DIR/slice_len.rs:5:7: 5:19
let _6: usize; // in scope 0 at $DIR/slice_len.rs:5:31: 5:32
let mut _7: usize; // in scope 0 at $DIR/slice_len.rs:5:5: 5:33
let mut _8: bool; // in scope 0 at $DIR/slice_len.rs:5:5: 5:33
let mut _9: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:5:6: 5:19
bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
StorageLive(_2); // bb0[1]: scope 0 at $DIR/slice_len.rs:5:5: 5:30
StorageLive(_3); // bb0[2]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
StorageLive(_4); // bb0[3]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
_9 = const main::promoted[0]; // bb0[4]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
// ty::Const
// + ty: &[u32; 3]
// + val: Unevaluated(DefId(0:3 ~ slice_len[317d]::main[0]), [], Some(promoted[0]))
// mir::Constant
// + span: $DIR/slice_len.rs:5:6: 5:19
// + literal: Const { ty: &[u32; 3], val: Unevaluated(DefId(0:3 ~ slice_len[317d]::main[0]), [], Some(promoted[0])) }
_4 = _9; // bb0[5]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
_3 = _4; // bb0[6]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
_2 = move _3 as &[u32] (Pointer(Unsize)); // bb0[7]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
StorageDead(_3); // bb0[8]: scope 0 at $DIR/slice_len.rs:5:18: 5:19
StorageLive(_6); // bb0[9]: scope 0 at $DIR/slice_len.rs:5:31: 5:32
_6 = const 1usize; // bb0[10]: scope 0 at $DIR/slice_len.rs:5:31: 5:32
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000001))
// mir::Constant
// + span: $DIR/slice_len.rs:5:31: 5:32
// + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) }
- _7 = Len((*_2)); // bb0[11]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
- _8 = Lt(_6, _7); // bb0[12]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
- assert(move _8, "index out of bounds: the len is move _7 but the index is _6") -> bb1; // bb0[13]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
+ _7 = const 3usize; // bb0[11]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
+ // ty::Const
+ // + ty: usize
+ // + val: Value(Scalar(0x00000003))
+ // mir::Constant
+ // + span: $DIR/slice_len.rs:5:5: 5:33
+ // + literal: Const { ty: usize, val: Value(Scalar(0x00000003)) }
+ _8 = const true; // bb0[12]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
+ // ty::Const
+ // + ty: bool
+ // + val: Value(Scalar(0x01))
+ // mir::Constant
+ // + span: $DIR/slice_len.rs:5:5: 5:33
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
+ assert(const true, "index out of bounds: the len is move _7 but the index is _6") -> bb1; // bb0[13]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
+ // ty::Const
+ // + ty: bool
+ // + val: Value(Scalar(0x01))
+ // mir::Constant
+ // + span: $DIR/slice_len.rs:5:5: 5:33
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
}
bb1: {
- _1 = (*_2)[_6]; // bb1[0]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
+ _1 = const 2u32; // bb1[0]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
+ // ty::Const
+ // + ty: u32
+ // + val: Value(Scalar(0x00000002))
+ // mir::Constant
+ // + span: $DIR/slice_len.rs:5:5: 5:33
+ // + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) }
StorageDead(_6); // bb1[1]: scope 0 at $DIR/slice_len.rs:5:33: 5:34
StorageDead(_4); // bb1[2]: scope 0 at $DIR/slice_len.rs:5:33: 5:34
StorageDead(_2); // bb1[3]: scope 0 at $DIR/slice_len.rs:5:33: 5:34
StorageDead(_1); // bb1[4]: scope 0 at $DIR/slice_len.rs:5:33: 5:34
_0 = (); // bb1[5]: scope 0 at $DIR/slice_len.rs:4:11: 6:2
return; // bb1[6]: scope 0 at $DIR/slice_len.rs:6:2: 6:2
}
}
...@@ -2,82 +2,82 @@ ...@@ -2,82 +2,82 @@
+ // MIR for `main` after ConstProp + // MIR for `main` after ConstProp
fn main() -> () { fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/slice_len.rs:3:11: 3:11 let mut _0: (); // return place in scope 0 at $DIR/slice_len.rs:4:11: 4:11
let _1: u32; // in scope 0 at $DIR/slice_len.rs:4:5: 4:33 let _1: u32; // in scope 0 at $DIR/slice_len.rs:5:5: 5:33
let mut _2: &[u32]; // in scope 0 at $DIR/slice_len.rs:4:5: 4:30 let mut _2: &[u32]; // in scope 0 at $DIR/slice_len.rs:5:5: 5:30
let mut _3: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:4:6: 4:19 let mut _3: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:5:6: 5:19
let _4: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:4:6: 4:19 let _4: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:5:6: 5:19
let _5: [u32; 3]; // in scope 0 at $DIR/slice_len.rs:4:7: 4:19 let _5: [u32; 3]; // in scope 0 at $DIR/slice_len.rs:5:7: 5:19
let _6: usize; // in scope 0 at $DIR/slice_len.rs:4:31: 4:32 let _6: usize; // in scope 0 at $DIR/slice_len.rs:5:31: 5:32
let mut _7: usize; // in scope 0 at $DIR/slice_len.rs:4:5: 4:33 let mut _7: usize; // in scope 0 at $DIR/slice_len.rs:5:5: 5:33
let mut _8: bool; // in scope 0 at $DIR/slice_len.rs:4:5: 4:33 let mut _8: bool; // in scope 0 at $DIR/slice_len.rs:5:5: 5:33
let mut _9: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:4:6: 4:19 let mut _9: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:5:6: 5:19
bb0: { bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/slice_len.rs:4:5: 4:33 StorageLive(_1); // bb0[0]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
StorageLive(_2); // bb0[1]: scope 0 at $DIR/slice_len.rs:4:5: 4:30 StorageLive(_2); // bb0[1]: scope 0 at $DIR/slice_len.rs:5:5: 5:30
StorageLive(_3); // bb0[2]: scope 0 at $DIR/slice_len.rs:4:6: 4:19 StorageLive(_3); // bb0[2]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
StorageLive(_4); // bb0[3]: scope 0 at $DIR/slice_len.rs:4:6: 4:19 StorageLive(_4); // bb0[3]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
_9 = const main::promoted[0]; // bb0[4]: scope 0 at $DIR/slice_len.rs:4:6: 4:19 _9 = const main::promoted[0]; // bb0[4]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
// ty::Const // ty::Const
// + ty: &[u32; 3] // + ty: &[u32; 3]
// + val: Unevaluated(DefId(0:3 ~ slice_len[317d]::main[0]), [], Some(promoted[0])) // + val: Unevaluated(DefId(0:3 ~ slice_len[317d]::main[0]), [], Some(promoted[0]))
// mir::Constant // mir::Constant
// + span: $DIR/slice_len.rs:4:6: 4:19 // + span: $DIR/slice_len.rs:5:6: 5:19
// + literal: Const { ty: &[u32; 3], val: Unevaluated(DefId(0:3 ~ slice_len[317d]::main[0]), [], Some(promoted[0])) } // + literal: Const { ty: &[u32; 3], val: Unevaluated(DefId(0:3 ~ slice_len[317d]::main[0]), [], Some(promoted[0])) }
_4 = _9; // bb0[5]: scope 0 at $DIR/slice_len.rs:4:6: 4:19 _4 = _9; // bb0[5]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
_3 = _4; // bb0[6]: scope 0 at $DIR/slice_len.rs:4:6: 4:19 _3 = _4; // bb0[6]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
_2 = move _3 as &[u32] (Pointer(Unsize)); // bb0[7]: scope 0 at $DIR/slice_len.rs:4:6: 4:19 _2 = move _3 as &[u32] (Pointer(Unsize)); // bb0[7]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
StorageDead(_3); // bb0[8]: scope 0 at $DIR/slice_len.rs:4:18: 4:19 StorageDead(_3); // bb0[8]: scope 0 at $DIR/slice_len.rs:5:18: 5:19
StorageLive(_6); // bb0[9]: scope 0 at $DIR/slice_len.rs:4:31: 4:32 StorageLive(_6); // bb0[9]: scope 0 at $DIR/slice_len.rs:5:31: 5:32
_6 = const 1usize; // bb0[10]: scope 0 at $DIR/slice_len.rs:4:31: 4:32 _6 = const 1usize; // bb0[10]: scope 0 at $DIR/slice_len.rs:5:31: 5:32
// ty::Const // ty::Const
// + ty: usize // + ty: usize
// + val: Value(Scalar(0x0000000000000001)) // + val: Value(Scalar(0x0000000000000001))
// mir::Constant // mir::Constant
// + span: $DIR/slice_len.rs:4:31: 4:32 // + span: $DIR/slice_len.rs:5:31: 5:32
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) }
- _7 = Len((*_2)); // bb0[11]: scope 0 at $DIR/slice_len.rs:4:5: 4:33 - _7 = Len((*_2)); // bb0[11]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
- _8 = Lt(_6, _7); // bb0[12]: scope 0 at $DIR/slice_len.rs:4:5: 4:33 - _8 = Lt(_6, _7); // bb0[12]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
- assert(move _8, "index out of bounds: the len is move _7 but the index is _6") -> bb1; // bb0[13]: scope 0 at $DIR/slice_len.rs:4:5: 4:33 - assert(move _8, "index out of bounds: the len is move _7 but the index is _6") -> bb1; // bb0[13]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
+ _7 = const 3usize; // bb0[11]: scope 0 at $DIR/slice_len.rs:4:5: 4:33 + _7 = const 3usize; // bb0[11]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
+ // ty::Const + // ty::Const
+ // + ty: usize + // + ty: usize
+ // + val: Value(Scalar(0x0000000000000003)) + // + val: Value(Scalar(0x0000000000000003))
+ // mir::Constant + // mir::Constant
+ // + span: $DIR/slice_len.rs:4:5: 4:33 + // + span: $DIR/slice_len.rs:5:5: 5:33
+ // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000003)) } + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000003)) }
+ _8 = const true; // bb0[12]: scope 0 at $DIR/slice_len.rs:4:5: 4:33 + _8 = const true; // bb0[12]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
+ // ty::Const + // ty::Const
+ // + ty: bool + // + ty: bool
+ // + val: Value(Scalar(0x01)) + // + val: Value(Scalar(0x01))
+ // mir::Constant + // mir::Constant
+ // + span: $DIR/slice_len.rs:4:5: 4:33 + // + span: $DIR/slice_len.rs:5:5: 5:33
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) } + // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
+ assert(const true, "index out of bounds: the len is move _7 but the index is _6") -> bb1; // bb0[13]: scope 0 at $DIR/slice_len.rs:4:5: 4:33 + assert(const true, "index out of bounds: the len is move _7 but the index is _6") -> bb1; // bb0[13]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
+ // ty::Const + // ty::Const
+ // + ty: bool + // + ty: bool
+ // + val: Value(Scalar(0x01)) + // + val: Value(Scalar(0x01))
+ // mir::Constant + // mir::Constant
+ // + span: $DIR/slice_len.rs:4:5: 4:33 + // + span: $DIR/slice_len.rs:5:5: 5:33
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) } + // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
} }
bb1: { bb1: {
- _1 = (*_2)[_6]; // bb1[0]: scope 0 at $DIR/slice_len.rs:4:5: 4:33 - _1 = (*_2)[_6]; // bb1[0]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
+ _1 = const 2u32; // bb1[0]: scope 0 at $DIR/slice_len.rs:4:5: 4:33 + _1 = const 2u32; // bb1[0]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
+ // ty::Const + // ty::Const
+ // + ty: u32 + // + ty: u32
+ // + val: Value(Scalar(0x00000002)) + // + val: Value(Scalar(0x00000002))
+ // mir::Constant + // mir::Constant
+ // + span: $DIR/slice_len.rs:4:5: 4:33 + // + span: $DIR/slice_len.rs:5:5: 5:33
+ // + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) } + // + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) }
StorageDead(_6); // bb1[1]: scope 0 at $DIR/slice_len.rs:4:33: 4:34 StorageDead(_6); // bb1[1]: scope 0 at $DIR/slice_len.rs:5:33: 5:34
StorageDead(_4); // bb1[2]: scope 0 at $DIR/slice_len.rs:4:33: 4:34 StorageDead(_4); // bb1[2]: scope 0 at $DIR/slice_len.rs:5:33: 5:34
StorageDead(_2); // bb1[3]: scope 0 at $DIR/slice_len.rs:4:33: 4:34 StorageDead(_2); // bb1[3]: scope 0 at $DIR/slice_len.rs:5:33: 5:34
StorageDead(_1); // bb1[4]: scope 0 at $DIR/slice_len.rs:4:33: 4:34 StorageDead(_1); // bb1[4]: scope 0 at $DIR/slice_len.rs:5:33: 5:34
_0 = (); // bb1[5]: scope 0 at $DIR/slice_len.rs:3:11: 5:2 _0 = (); // bb1[5]: scope 0 at $DIR/slice_len.rs:4:11: 6:2
return; // bb1[6]: scope 0 at $DIR/slice_len.rs:5:2: 5:2 return; // bb1[6]: scope 0 at $DIR/slice_len.rs:6:2: 6:2
} }
} }
...@@ -13,6 +13,7 @@ trait Foo { ...@@ -13,6 +13,7 @@ trait Foo {
fn get(&self) -> [u8; 2]; fn get(&self) -> [u8; 2];
} }
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR rustc.{{impl}}-{{constant}}.SimplifyCfg-qualify-consts.after.mir // EMIT_MIR rustc.{{impl}}-{{constant}}.SimplifyCfg-qualify-consts.after.mir
impl Foo for [u8; 1+1] { impl Foo for [u8; 1+1] {
fn get(&self) -> [u8; 2] { fn get(&self) -> [u8; 2] {
......
// MIR for `<impl at $DIR/issue-41697.rs:18:1: 22:2>::{{constant}}#0` after SimplifyCfg-qualify-consts
<impl at $DIR/issue-41697.rs:18:1: 22:2>::{{constant}}#0: usize = {
let mut _0: usize; // return place in scope 0 at $DIR/issue-41697.rs:18:19: 18:22
let mut _1: (usize, bool); // in scope 0 at $DIR/issue-41697.rs:18:19: 18:22
bb0: {
_1 = CheckedAdd(const 1usize, const 1usize); // bb0[0]: scope 0 at $DIR/issue-41697.rs:18:19: 18:22
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000001))
// mir::Constant
// + span: $DIR/issue-41697.rs:18:19: 18:20
// + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) }
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000001))
// mir::Constant
// + span: $DIR/issue-41697.rs:18:21: 18:22
// + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) }
assert(!move (_1.1: bool), "attempt to add with overflow") -> [success: bb2, unwind: bb1]; // bb0[1]: scope 0 at $DIR/issue-41697.rs:18:19: 18:22
}
bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/issue-41697.rs:18:19: 18:22
}
bb2: {
_0 = move (_1.0: usize); // bb2[0]: scope 0 at $DIR/issue-41697.rs:18:19: 18:22
return; // bb2[1]: scope 0 at $DIR/issue-41697.rs:18:19: 18:22
}
}
// MIR for `<impl at $DIR/issue-41697.rs:17:1: 21:2>::{{constant}}#0` after SimplifyCfg-qualify-consts // MIR for `<impl at $DIR/issue-41697.rs:18:1: 22:2>::{{constant}}#0` after SimplifyCfg-qualify-consts
<impl at $DIR/issue-41697.rs:17:1: 21:2>::{{constant}}#0: usize = { <impl at $DIR/issue-41697.rs:18:1: 22:2>::{{constant}}#0: usize = {
let mut _0: usize; // return place in scope 0 at $DIR/issue-41697.rs:17:19: 17:22 let mut _0: usize; // return place in scope 0 at $DIR/issue-41697.rs:18:19: 18:22
let mut _1: (usize, bool); // in scope 0 at $DIR/issue-41697.rs:17:19: 17:22 let mut _1: (usize, bool); // in scope 0 at $DIR/issue-41697.rs:18:19: 18:22
bb0: { bb0: {
_1 = CheckedAdd(const 1usize, const 1usize); // bb0[0]: scope 0 at $DIR/issue-41697.rs:17:19: 17:22 _1 = CheckedAdd(const 1usize, const 1usize); // bb0[0]: scope 0 at $DIR/issue-41697.rs:18:19: 18:22
// ty::Const // ty::Const
// + ty: usize // + ty: usize
// + val: Value(Scalar(0x0000000000000001)) // + val: Value(Scalar(0x0000000000000001))
// mir::Constant // mir::Constant
// + span: $DIR/issue-41697.rs:17:19: 17:20 // + span: $DIR/issue-41697.rs:18:19: 18:20
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) }
// ty::Const // ty::Const
// + ty: usize // + ty: usize
// + val: Value(Scalar(0x0000000000000001)) // + val: Value(Scalar(0x0000000000000001))
// mir::Constant // mir::Constant
// + span: $DIR/issue-41697.rs:17:21: 17:22 // + span: $DIR/issue-41697.rs:18:21: 18:22
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) }
assert(!move (_1.1: bool), "attempt to add with overflow") -> [success: bb2, unwind: bb1]; // bb0[1]: scope 0 at $DIR/issue-41697.rs:17:19: 17:22 assert(!move (_1.1: bool), "attempt to add with overflow") -> [success: bb2, unwind: bb1]; // bb0[1]: scope 0 at $DIR/issue-41697.rs:18:19: 18:22
} }
bb1 (cleanup): { bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/issue-41697.rs:17:19: 17:22 resume; // bb1[0]: scope 0 at $DIR/issue-41697.rs:18:19: 18:22
} }
bb2: { bb2: {
_0 = move (_1.0: usize); // bb2[0]: scope 0 at $DIR/issue-41697.rs:17:19: 17:22 _0 = move (_1.0: usize); // bb2[0]: scope 0 at $DIR/issue-41697.rs:18:19: 18:22
return; // bb2[1]: scope 0 at $DIR/issue-41697.rs:17:19: 17:22 return; // bb2[1]: scope 0 at $DIR/issue-41697.rs:18:19: 18:22
} }
} }
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
fn use_x(_: usize) -> bool { true } fn use_x(_: usize) -> bool { true }
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR rustc.main.nll.0.mir // EMIT_MIR rustc.main.nll.0.mir
fn main() { fn main() {
let mut v = [1, 2, 3]; let mut v = [1, 2, 3];
......
// MIR for `main` 0 nll
| Free Region Mapping
| '_#0r | Global | ['_#0r, '_#1r]
| '_#1r | Local | ['_#1r]
|
| Inferred Region Values
| '_#0r | U0 | {bb0[0..=8], bb1[0], bb2[0..=8], bb3[0], bb4[0..=1], bb5[0..=3], bb6[0..=3], bb7[0..=2], bb8[0..=5], '_#0r, '_#1r}
| '_#1r | U0 | {bb0[0..=8], bb1[0], bb2[0..=8], bb3[0], bb4[0..=1], bb5[0..=3], bb6[0..=3], bb7[0..=2], bb8[0..=5], '_#1r}
| '_#2r | U0 | {bb2[0..=8], bb3[0], bb5[0..=2]}
| '_#3r | U0 | {bb2[1..=8], bb3[0], bb5[0..=2]}
| '_#4r | U0 | {bb2[4..=8], bb3[0], bb5[0..=2]}
|
| Inference Constraints
| '_#0r live at {bb0[0..=8], bb1[0], bb2[0..=8], bb3[0], bb4[0..=1], bb5[0..=3], bb6[0..=3], bb7[0..=2], bb8[0..=5]}
| '_#1r live at {bb0[0..=8], bb1[0], bb2[0..=8], bb3[0], bb4[0..=1], bb5[0..=3], bb6[0..=3], bb7[0..=2], bb8[0..=5]}
| '_#2r live at {bb2[0]}
| '_#3r live at {bb2[1..=3]}
| '_#4r live at {bb2[4..=8], bb3[0], bb5[0..=2]}
| '_#2r: '_#3r due to Assignment at Single(bb2[0])
| '_#3r: '_#4r due to Assignment at Single(bb2[3])
|
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/region-subtyping-basic.rs:14:11: 14:11
let mut _1: [usize; Const { ty: usize, val: Value(Scalar(0x00000003)) }]; // in scope 0 at $DIR/region-subtyping-basic.rs:15:9: 15:14
let _3: usize; // in scope 0 at $DIR/region-subtyping-basic.rs:16:16: 16:17
let mut _4: usize; // in scope 0 at $DIR/region-subtyping-basic.rs:16:14: 16:18
let mut _5: bool; // in scope 0 at $DIR/region-subtyping-basic.rs:16:14: 16:18
let mut _7: bool; // in scope 0 at $DIR/region-subtyping-basic.rs:18:8: 18:12
let _8: bool; // in scope 0 at $DIR/region-subtyping-basic.rs:19:9: 19:18
let mut _9: usize; // in scope 0 at $DIR/region-subtyping-basic.rs:19:15: 19:17
let _10: bool; // in scope 0 at $DIR/region-subtyping-basic.rs:21:9: 21:18
scope 1 {
debug v => _1; // in scope 1 at $DIR/region-subtyping-basic.rs:15:9: 15:14
let _2: &'_#3r usize; // in scope 1 at $DIR/region-subtyping-basic.rs:16:9: 16:10
scope 2 {
debug p => _2; // in scope 2 at $DIR/region-subtyping-basic.rs:16:9: 16:10
let _6: &'_#4r usize; // in scope 2 at $DIR/region-subtyping-basic.rs:17:9: 17:10
scope 3 {
debug q => _6; // in scope 3 at $DIR/region-subtyping-basic.rs:17:9: 17:10
}
}
}
bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/region-subtyping-basic.rs:15:9: 15:14
_1 = [const Const(Value(Scalar(0x00000001)): usize), const Const(Value(Scalar(0x00000002)): usize), const Const(Value(Scalar(0x00000003)): usize)]; // bb0[1]: scope 0 at $DIR/region-subtyping-basic.rs:15:17: 15:26
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000001))
// mir::Constant
// + span: $DIR/region-subtyping-basic.rs:15:18: 15:19
// + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) }
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000002))
// mir::Constant
// + span: $DIR/region-subtyping-basic.rs:15:21: 15:22
// + literal: Const { ty: usize, val: Value(Scalar(0x00000002)) }
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000003))
// mir::Constant
// + span: $DIR/region-subtyping-basic.rs:15:24: 15:25
// + literal: Const { ty: usize, val: Value(Scalar(0x00000003)) }
FakeRead(ForLet, _1); // bb0[2]: scope 0 at $DIR/region-subtyping-basic.rs:15:9: 15:14
StorageLive(_2); // bb0[3]: scope 1 at $DIR/region-subtyping-basic.rs:16:9: 16:10
StorageLive(_3); // bb0[4]: scope 1 at $DIR/region-subtyping-basic.rs:16:16: 16:17
_3 = const Const(Value(Scalar(0x00000000)): usize); // bb0[5]: scope 1 at $DIR/region-subtyping-basic.rs:16:16: 16:17
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000000))
// mir::Constant
// + span: $DIR/region-subtyping-basic.rs:16:16: 16:17
// + literal: Const { ty: usize, val: Value(Scalar(0x00000000)) }
_4 = Len(_1); // bb0[6]: scope 1 at $DIR/region-subtyping-basic.rs:16:14: 16:18
_5 = Lt(_3, _4); // bb0[7]: scope 1 at $DIR/region-subtyping-basic.rs:16:14: 16:18
assert(move _5, "index out of bounds: the len is move _4 but the index is _3") -> [success: bb2, unwind: bb1]; // bb0[8]: scope 1 at $DIR/region-subtyping-basic.rs:16:14: 16:18
}
bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/region-subtyping-basic.rs:14:1: 23:2
}
bb2: {
_2 = &'_#2r _1[_3]; // bb2[0]: scope 1 at $DIR/region-subtyping-basic.rs:16:13: 16:18
FakeRead(ForLet, _2); // bb2[1]: scope 1 at $DIR/region-subtyping-basic.rs:16:9: 16:10
StorageLive(_6); // bb2[2]: scope 2 at $DIR/region-subtyping-basic.rs:17:9: 17:10
_6 = _2; // bb2[3]: scope 2 at $DIR/region-subtyping-basic.rs:17:13: 17:14
FakeRead(ForLet, _6); // bb2[4]: scope 2 at $DIR/region-subtyping-basic.rs:17:9: 17:10
StorageLive(_7); // bb2[5]: scope 3 at $DIR/region-subtyping-basic.rs:18:8: 18:12
_7 = const Const(Value(Scalar(0x01)): bool); // bb2[6]: scope 3 at $DIR/region-subtyping-basic.rs:18:8: 18:12
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x01))
// mir::Constant
// + span: $DIR/region-subtyping-basic.rs:18:8: 18:12
// + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
FakeRead(ForMatchedPlace, _7); // bb2[7]: scope 3 at $DIR/region-subtyping-basic.rs:18:8: 18:12
switchInt(_7) -> [Const(Value(Scalar(0x00)): bool): bb4, otherwise: bb3]; // bb2[8]: scope 3 at $DIR/region-subtyping-basic.rs:18:5: 22:6
}
bb3: {
falseEdges -> [real: bb5, imaginary: bb4]; // bb3[0]: scope 3 at $DIR/region-subtyping-basic.rs:18:5: 22:6
}
bb4: {
StorageLive(_10); // bb4[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18
_10 = const Const(Value(Scalar(<ZST>)): fn(usize) -> bool {use_x})(const Const(Value(Scalar(0x00000016)): usize)) -> [return: bb7, unwind: bb1]; // bb4[1]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18
// ty::Const
// + ty: fn(usize) -> bool {use_x}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/region-subtyping-basic.rs:21:9: 21:14
// + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar(<ZST>)) }
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000016))
// mir::Constant
// + span: $DIR/region-subtyping-basic.rs:21:15: 21:17
// + literal: Const { ty: usize, val: Value(Scalar(0x00000016)) }
}
bb5: {
StorageLive(_8); // bb5[0]: scope 3 at $DIR/region-subtyping-basic.rs:19:9: 19:18
StorageLive(_9); // bb5[1]: scope 3 at $DIR/region-subtyping-basic.rs:19:15: 19:17
_9 = (*_6); // bb5[2]: scope 3 at $DIR/region-subtyping-basic.rs:19:15: 19:17
_8 = const Const(Value(Scalar(<ZST>)): fn(usize) -> bool {use_x})(move _9) -> [return: bb6, unwind: bb1]; // bb5[3]: scope 3 at $DIR/region-subtyping-basic.rs:19:9: 19:18
// ty::Const
// + ty: fn(usize) -> bool {use_x}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/region-subtyping-basic.rs:19:9: 19:14
// + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar(<ZST>)) }
}
bb6: {
StorageDead(_9); // bb6[0]: scope 3 at $DIR/region-subtyping-basic.rs:19:17: 19:18
StorageDead(_8); // bb6[1]: scope 3 at $DIR/region-subtyping-basic.rs:19:18: 19:19
_0 = (); // bb6[2]: scope 3 at $DIR/region-subtyping-basic.rs:18:13: 20:6
goto -> bb8; // bb6[3]: scope 3 at $DIR/region-subtyping-basic.rs:18:5: 22:6
}
bb7: {
StorageDead(_10); // bb7[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:18: 21:19
_0 = (); // bb7[1]: scope 3 at $DIR/region-subtyping-basic.rs:20:12: 22:6
goto -> bb8; // bb7[2]: scope 3 at $DIR/region-subtyping-basic.rs:18:5: 22:6
}
bb8: {
StorageDead(_6); // bb8[0]: scope 2 at $DIR/region-subtyping-basic.rs:23:1: 23:2
StorageDead(_3); // bb8[1]: scope 1 at $DIR/region-subtyping-basic.rs:23:1: 23:2
StorageDead(_2); // bb8[2]: scope 1 at $DIR/region-subtyping-basic.rs:23:1: 23:2
StorageDead(_1); // bb8[3]: scope 0 at $DIR/region-subtyping-basic.rs:23:1: 23:2
StorageDead(_7); // bb8[4]: scope 0 at $DIR/region-subtyping-basic.rs:23:1: 23:2
return; // bb8[5]: scope 0 at $DIR/region-subtyping-basic.rs:23:2: 23:2
}
}
...@@ -21,138 +21,138 @@ ...@@ -21,138 +21,138 @@
| '_#3r: '_#4r due to Assignment at Single(bb2[3]) | '_#3r: '_#4r due to Assignment at Single(bb2[3])
| |
fn main() -> () { fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/region-subtyping-basic.rs:13:11: 13:11 let mut _0: (); // return place in scope 0 at $DIR/region-subtyping-basic.rs:14:11: 14:11
let mut _1: [usize; Const { ty: usize, val: Value(Scalar(0x0000000000000003)) }]; // in scope 0 at $DIR/region-subtyping-basic.rs:14:9: 14:14 let mut _1: [usize; Const { ty: usize, val: Value(Scalar(0x0000000000000003)) }]; // in scope 0 at $DIR/region-subtyping-basic.rs:15:9: 15:14
let _3: usize; // in scope 0 at $DIR/region-subtyping-basic.rs:15:16: 15:17 let _3: usize; // in scope 0 at $DIR/region-subtyping-basic.rs:16:16: 16:17
let mut _4: usize; // in scope 0 at $DIR/region-subtyping-basic.rs:15:14: 15:18 let mut _4: usize; // in scope 0 at $DIR/region-subtyping-basic.rs:16:14: 16:18
let mut _5: bool; // in scope 0 at $DIR/region-subtyping-basic.rs:15:14: 15:18 let mut _5: bool; // in scope 0 at $DIR/region-subtyping-basic.rs:16:14: 16:18
let mut _7: bool; // in scope 0 at $DIR/region-subtyping-basic.rs:17:8: 17:12 let mut _7: bool; // in scope 0 at $DIR/region-subtyping-basic.rs:18:8: 18:12
let _8: bool; // in scope 0 at $DIR/region-subtyping-basic.rs:18:9: 18:18 let _8: bool; // in scope 0 at $DIR/region-subtyping-basic.rs:19:9: 19:18
let mut _9: usize; // in scope 0 at $DIR/region-subtyping-basic.rs:18:15: 18:17 let mut _9: usize; // in scope 0 at $DIR/region-subtyping-basic.rs:19:15: 19:17
let _10: bool; // in scope 0 at $DIR/region-subtyping-basic.rs:20:9: 20:18 let _10: bool; // in scope 0 at $DIR/region-subtyping-basic.rs:21:9: 21:18
scope 1 { scope 1 {
debug v => _1; // in scope 1 at $DIR/region-subtyping-basic.rs:14:9: 14:14 debug v => _1; // in scope 1 at $DIR/region-subtyping-basic.rs:15:9: 15:14
let _2: &'_#3r usize; // in scope 1 at $DIR/region-subtyping-basic.rs:15:9: 15:10 let _2: &'_#3r usize; // in scope 1 at $DIR/region-subtyping-basic.rs:16:9: 16:10
scope 2 { scope 2 {
debug p => _2; // in scope 2 at $DIR/region-subtyping-basic.rs:15:9: 15:10 debug p => _2; // in scope 2 at $DIR/region-subtyping-basic.rs:16:9: 16:10
let _6: &'_#4r usize; // in scope 2 at $DIR/region-subtyping-basic.rs:16:9: 16:10 let _6: &'_#4r usize; // in scope 2 at $DIR/region-subtyping-basic.rs:17:9: 17:10
scope 3 { scope 3 {
debug q => _6; // in scope 3 at $DIR/region-subtyping-basic.rs:16:9: 16:10 debug q => _6; // in scope 3 at $DIR/region-subtyping-basic.rs:17:9: 17:10
} }
} }
} }
bb0: { bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/region-subtyping-basic.rs:14:9: 14:14 StorageLive(_1); // bb0[0]: scope 0 at $DIR/region-subtyping-basic.rs:15:9: 15:14
_1 = [const Const(Value(Scalar(0x0000000000000001)): usize), const Const(Value(Scalar(0x0000000000000002)): usize), const Const(Value(Scalar(0x0000000000000003)): usize)]; // bb0[1]: scope 0 at $DIR/region-subtyping-basic.rs:14:17: 14:26 _1 = [const Const(Value(Scalar(0x0000000000000001)): usize), const Const(Value(Scalar(0x0000000000000002)): usize), const Const(Value(Scalar(0x0000000000000003)): usize)]; // bb0[1]: scope 0 at $DIR/region-subtyping-basic.rs:15:17: 15:26
// ty::Const // ty::Const
// + ty: usize // + ty: usize
// + val: Value(Scalar(0x0000000000000001)) // + val: Value(Scalar(0x0000000000000001))
// mir::Constant // mir::Constant
// + span: $DIR/region-subtyping-basic.rs:14:18: 14:19 // + span: $DIR/region-subtyping-basic.rs:15:18: 15:19
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) }
// ty::Const // ty::Const
// + ty: usize // + ty: usize
// + val: Value(Scalar(0x0000000000000002)) // + val: Value(Scalar(0x0000000000000002))
// mir::Constant // mir::Constant
// + span: $DIR/region-subtyping-basic.rs:14:21: 14:22 // + span: $DIR/region-subtyping-basic.rs:15:21: 15:22
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000002)) } // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000002)) }
// ty::Const // ty::Const
// + ty: usize // + ty: usize
// + val: Value(Scalar(0x0000000000000003)) // + val: Value(Scalar(0x0000000000000003))
// mir::Constant // mir::Constant
// + span: $DIR/region-subtyping-basic.rs:14:24: 14:25 // + span: $DIR/region-subtyping-basic.rs:15:24: 15:25
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000003)) } // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000003)) }
FakeRead(ForLet, _1); // bb0[2]: scope 0 at $DIR/region-subtyping-basic.rs:14:9: 14:14 FakeRead(ForLet, _1); // bb0[2]: scope 0 at $DIR/region-subtyping-basic.rs:15:9: 15:14
StorageLive(_2); // bb0[3]: scope 1 at $DIR/region-subtyping-basic.rs:15:9: 15:10 StorageLive(_2); // bb0[3]: scope 1 at $DIR/region-subtyping-basic.rs:16:9: 16:10
StorageLive(_3); // bb0[4]: scope 1 at $DIR/region-subtyping-basic.rs:15:16: 15:17 StorageLive(_3); // bb0[4]: scope 1 at $DIR/region-subtyping-basic.rs:16:16: 16:17
_3 = const Const(Value(Scalar(0x0000000000000000)): usize); // bb0[5]: scope 1 at $DIR/region-subtyping-basic.rs:15:16: 15:17 _3 = const Const(Value(Scalar(0x0000000000000000)): usize); // bb0[5]: scope 1 at $DIR/region-subtyping-basic.rs:16:16: 16:17
// ty::Const // ty::Const
// + ty: usize // + ty: usize
// + val: Value(Scalar(0x0000000000000000)) // + val: Value(Scalar(0x0000000000000000))
// mir::Constant // mir::Constant
// + span: $DIR/region-subtyping-basic.rs:15:16: 15:17 // + span: $DIR/region-subtyping-basic.rs:16:16: 16:17
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) }
_4 = Len(_1); // bb0[6]: scope 1 at $DIR/region-subtyping-basic.rs:15:14: 15:18 _4 = Len(_1); // bb0[6]: scope 1 at $DIR/region-subtyping-basic.rs:16:14: 16:18
_5 = Lt(_3, _4); // bb0[7]: scope 1 at $DIR/region-subtyping-basic.rs:15:14: 15:18 _5 = Lt(_3, _4); // bb0[7]: scope 1 at $DIR/region-subtyping-basic.rs:16:14: 16:18
assert(move _5, "index out of bounds: the len is move _4 but the index is _3") -> [success: bb2, unwind: bb1]; // bb0[8]: scope 1 at $DIR/region-subtyping-basic.rs:15:14: 15:18 assert(move _5, "index out of bounds: the len is move _4 but the index is _3") -> [success: bb2, unwind: bb1]; // bb0[8]: scope 1 at $DIR/region-subtyping-basic.rs:16:14: 16:18
} }
bb1 (cleanup): { bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/region-subtyping-basic.rs:13:1: 22:2 resume; // bb1[0]: scope 0 at $DIR/region-subtyping-basic.rs:14:1: 23:2
} }
bb2: { bb2: {
_2 = &'_#2r _1[_3]; // bb2[0]: scope 1 at $DIR/region-subtyping-basic.rs:15:13: 15:18 _2 = &'_#2r _1[_3]; // bb2[0]: scope 1 at $DIR/region-subtyping-basic.rs:16:13: 16:18
FakeRead(ForLet, _2); // bb2[1]: scope 1 at $DIR/region-subtyping-basic.rs:15:9: 15:10 FakeRead(ForLet, _2); // bb2[1]: scope 1 at $DIR/region-subtyping-basic.rs:16:9: 16:10
StorageLive(_6); // bb2[2]: scope 2 at $DIR/region-subtyping-basic.rs:16:9: 16:10 StorageLive(_6); // bb2[2]: scope 2 at $DIR/region-subtyping-basic.rs:17:9: 17:10
_6 = _2; // bb2[3]: scope 2 at $DIR/region-subtyping-basic.rs:16:13: 16:14 _6 = _2; // bb2[3]: scope 2 at $DIR/region-subtyping-basic.rs:17:13: 17:14
FakeRead(ForLet, _6); // bb2[4]: scope 2 at $DIR/region-subtyping-basic.rs:16:9: 16:10 FakeRead(ForLet, _6); // bb2[4]: scope 2 at $DIR/region-subtyping-basic.rs:17:9: 17:10
StorageLive(_7); // bb2[5]: scope 3 at $DIR/region-subtyping-basic.rs:17:8: 17:12 StorageLive(_7); // bb2[5]: scope 3 at $DIR/region-subtyping-basic.rs:18:8: 18:12
_7 = const Const(Value(Scalar(0x01)): bool); // bb2[6]: scope 3 at $DIR/region-subtyping-basic.rs:17:8: 17:12 _7 = const Const(Value(Scalar(0x01)): bool); // bb2[6]: scope 3 at $DIR/region-subtyping-basic.rs:18:8: 18:12
// ty::Const // ty::Const
// + ty: bool // + ty: bool
// + val: Value(Scalar(0x01)) // + val: Value(Scalar(0x01))
// mir::Constant // mir::Constant
// + span: $DIR/region-subtyping-basic.rs:17:8: 17:12 // + span: $DIR/region-subtyping-basic.rs:18:8: 18:12
// + literal: Const { ty: bool, val: Value(Scalar(0x01)) } // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
FakeRead(ForMatchedPlace, _7); // bb2[7]: scope 3 at $DIR/region-subtyping-basic.rs:17:8: 17:12 FakeRead(ForMatchedPlace, _7); // bb2[7]: scope 3 at $DIR/region-subtyping-basic.rs:18:8: 18:12
switchInt(_7) -> [Const(Value(Scalar(0x00)): bool): bb4, otherwise: bb3]; // bb2[8]: scope 3 at $DIR/region-subtyping-basic.rs:17:5: 21:6 switchInt(_7) -> [Const(Value(Scalar(0x00)): bool): bb4, otherwise: bb3]; // bb2[8]: scope 3 at $DIR/region-subtyping-basic.rs:18:5: 22:6
} }
bb3: { bb3: {
falseEdges -> [real: bb5, imaginary: bb4]; // bb3[0]: scope 3 at $DIR/region-subtyping-basic.rs:17:5: 21:6 falseEdges -> [real: bb5, imaginary: bb4]; // bb3[0]: scope 3 at $DIR/region-subtyping-basic.rs:18:5: 22:6
} }
bb4: { bb4: {
StorageLive(_10); // bb4[0]: scope 3 at $DIR/region-subtyping-basic.rs:20:9: 20:18 StorageLive(_10); // bb4[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18
_10 = const Const(Value(Scalar(<ZST>)): fn(usize) -> bool {use_x})(const Const(Value(Scalar(0x0000000000000016)): usize)) -> [return: bb7, unwind: bb1]; // bb4[1]: scope 3 at $DIR/region-subtyping-basic.rs:20:9: 20:18 _10 = const Const(Value(Scalar(<ZST>)): fn(usize) -> bool {use_x})(const Const(Value(Scalar(0x0000000000000016)): usize)) -> [return: bb7, unwind: bb1]; // bb4[1]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18
// ty::Const // ty::Const
// + ty: fn(usize) -> bool {use_x} // + ty: fn(usize) -> bool {use_x}
// + val: Value(Scalar(<ZST>)) // + val: Value(Scalar(<ZST>))
// mir::Constant // mir::Constant
// + span: $DIR/region-subtyping-basic.rs:20:9: 20:14 // + span: $DIR/region-subtyping-basic.rs:21:9: 21:14
// + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar(<ZST>)) } // + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar(<ZST>)) }
// ty::Const // ty::Const
// + ty: usize // + ty: usize
// + val: Value(Scalar(0x0000000000000016)) // + val: Value(Scalar(0x0000000000000016))
// mir::Constant // mir::Constant
// + span: $DIR/region-subtyping-basic.rs:20:15: 20:17 // + span: $DIR/region-subtyping-basic.rs:21:15: 21:17
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000016)) } // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000016)) }
} }
bb5: { bb5: {
StorageLive(_8); // bb5[0]: scope 3 at $DIR/region-subtyping-basic.rs:18:9: 18:18 StorageLive(_8); // bb5[0]: scope 3 at $DIR/region-subtyping-basic.rs:19:9: 19:18
StorageLive(_9); // bb5[1]: scope 3 at $DIR/region-subtyping-basic.rs:18:15: 18:17 StorageLive(_9); // bb5[1]: scope 3 at $DIR/region-subtyping-basic.rs:19:15: 19:17
_9 = (*_6); // bb5[2]: scope 3 at $DIR/region-subtyping-basic.rs:18:15: 18:17 _9 = (*_6); // bb5[2]: scope 3 at $DIR/region-subtyping-basic.rs:19:15: 19:17
_8 = const Const(Value(Scalar(<ZST>)): fn(usize) -> bool {use_x})(move _9) -> [return: bb6, unwind: bb1]; // bb5[3]: scope 3 at $DIR/region-subtyping-basic.rs:18:9: 18:18 _8 = const Const(Value(Scalar(<ZST>)): fn(usize) -> bool {use_x})(move _9) -> [return: bb6, unwind: bb1]; // bb5[3]: scope 3 at $DIR/region-subtyping-basic.rs:19:9: 19:18
// ty::Const // ty::Const
// + ty: fn(usize) -> bool {use_x} // + ty: fn(usize) -> bool {use_x}
// + val: Value(Scalar(<ZST>)) // + val: Value(Scalar(<ZST>))
// mir::Constant // mir::Constant
// + span: $DIR/region-subtyping-basic.rs:18:9: 18:14 // + span: $DIR/region-subtyping-basic.rs:19:9: 19:14
// + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar(<ZST>)) } // + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar(<ZST>)) }
} }
bb6: { bb6: {
StorageDead(_9); // bb6[0]: scope 3 at $DIR/region-subtyping-basic.rs:18:17: 18:18 StorageDead(_9); // bb6[0]: scope 3 at $DIR/region-subtyping-basic.rs:19:17: 19:18
StorageDead(_8); // bb6[1]: scope 3 at $DIR/region-subtyping-basic.rs:18:18: 18:19 StorageDead(_8); // bb6[1]: scope 3 at $DIR/region-subtyping-basic.rs:19:18: 19:19
_0 = (); // bb6[2]: scope 3 at $DIR/region-subtyping-basic.rs:17:13: 19:6 _0 = (); // bb6[2]: scope 3 at $DIR/region-subtyping-basic.rs:18:13: 20:6
goto -> bb8; // bb6[3]: scope 3 at $DIR/region-subtyping-basic.rs:17:5: 21:6 goto -> bb8; // bb6[3]: scope 3 at $DIR/region-subtyping-basic.rs:18:5: 22:6
} }
bb7: { bb7: {
StorageDead(_10); // bb7[0]: scope 3 at $DIR/region-subtyping-basic.rs:20:18: 20:19 StorageDead(_10); // bb7[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:18: 21:19
_0 = (); // bb7[1]: scope 3 at $DIR/region-subtyping-basic.rs:19:12: 21:6 _0 = (); // bb7[1]: scope 3 at $DIR/region-subtyping-basic.rs:20:12: 22:6
goto -> bb8; // bb7[2]: scope 3 at $DIR/region-subtyping-basic.rs:17:5: 21:6 goto -> bb8; // bb7[2]: scope 3 at $DIR/region-subtyping-basic.rs:18:5: 22:6
} }
bb8: { bb8: {
StorageDead(_6); // bb8[0]: scope 2 at $DIR/region-subtyping-basic.rs:22:1: 22:2 StorageDead(_6); // bb8[0]: scope 2 at $DIR/region-subtyping-basic.rs:23:1: 23:2
StorageDead(_3); // bb8[1]: scope 1 at $DIR/region-subtyping-basic.rs:22:1: 22:2 StorageDead(_3); // bb8[1]: scope 1 at $DIR/region-subtyping-basic.rs:23:1: 23:2
StorageDead(_2); // bb8[2]: scope 1 at $DIR/region-subtyping-basic.rs:22:1: 22:2 StorageDead(_2); // bb8[2]: scope 1 at $DIR/region-subtyping-basic.rs:23:1: 23:2
StorageDead(_1); // bb8[3]: scope 0 at $DIR/region-subtyping-basic.rs:22:1: 22:2 StorageDead(_1); // bb8[3]: scope 0 at $DIR/region-subtyping-basic.rs:23:1: 23:2
StorageDead(_7); // bb8[4]: scope 0 at $DIR/region-subtyping-basic.rs:22:1: 22:2 StorageDead(_7); // bb8[4]: scope 0 at $DIR/region-subtyping-basic.rs:23:1: 23:2
return; // bb8[5]: scope 0 at $DIR/region-subtyping-basic.rs:22:2: 22:2 return; // bb8[5]: scope 0 at $DIR/region-subtyping-basic.rs:23:2: 23:2
} }
} }
// ignore-wasm32-bare compiled with panic=abort by default // ignore-wasm32-bare compiled with panic=abort by default
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR rustc.main.SimplifyCfg-elaborate-drops.after.mir // EMIT_MIR rustc.main.SimplifyCfg-elaborate-drops.after.mir
fn main() { fn main() {
let mut x = Packed(Aligned(Droppy(0))); let mut x = Packed(Aligned(Droppy(0)));
......
// MIR for `main` after SimplifyCfg-elaborate-drops
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/packed-struct-drop-aligned.rs:5:11: 5:11
let mut _1: Packed; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:6:9: 6:14
let mut _2: Aligned; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:6:24: 6:42
let mut _3: Droppy; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:6:32: 6:41
let mut _4: Aligned; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:7:11: 7:29
let mut _5: Droppy; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:7:19: 7:28
let mut _6: Aligned; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:7:5: 7:8
scope 1 {
debug x => _1; // in scope 1 at $DIR/packed-struct-drop-aligned.rs:6:9: 6:14
}
bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/packed-struct-drop-aligned.rs:6:9: 6:14
StorageLive(_2); // bb0[1]: scope 0 at $DIR/packed-struct-drop-aligned.rs:6:24: 6:42
StorageLive(_3); // bb0[2]: scope 0 at $DIR/packed-struct-drop-aligned.rs:6:32: 6:41
_3 = Droppy(const 0usize,); // bb0[3]: scope 0 at $DIR/packed-struct-drop-aligned.rs:6:32: 6:41
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000000))
// mir::Constant
// + span: $DIR/packed-struct-drop-aligned.rs:6:39: 6:40
// + literal: Const { ty: usize, val: Value(Scalar(0x00000000)) }
_2 = Aligned(move _3,); // bb0[4]: scope 0 at $DIR/packed-struct-drop-aligned.rs:6:24: 6:42
StorageDead(_3); // bb0[5]: scope 0 at $DIR/packed-struct-drop-aligned.rs:6:41: 6:42
_1 = Packed(move _2,); // bb0[6]: scope 0 at $DIR/packed-struct-drop-aligned.rs:6:17: 6:43
StorageDead(_2); // bb0[7]: scope 0 at $DIR/packed-struct-drop-aligned.rs:6:42: 6:43
StorageLive(_4); // bb0[8]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:11: 7:29
StorageLive(_5); // bb0[9]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:19: 7:28
_5 = Droppy(const 0usize,); // bb0[10]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:19: 7:28
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000000))
// mir::Constant
// + span: $DIR/packed-struct-drop-aligned.rs:7:26: 7:27
// + literal: Const { ty: usize, val: Value(Scalar(0x00000000)) }
_4 = Aligned(move _5,); // bb0[11]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:11: 7:29
StorageDead(_5); // bb0[12]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:28: 7:29
StorageLive(_6); // bb0[13]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:5: 7:8
_6 = move (_1.0: Aligned); // bb0[14]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:5: 7:8
drop(_6) -> [return: bb4, unwind: bb3]; // bb0[15]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:5: 7:8
}
bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/packed-struct-drop-aligned.rs:5:1: 8:2
}
bb2: {
StorageDead(_1); // bb2[0]: scope 0 at $DIR/packed-struct-drop-aligned.rs:8:1: 8:2
return; // bb2[1]: scope 0 at $DIR/packed-struct-drop-aligned.rs:8:2: 8:2
}
bb3 (cleanup): {
(_1.0: Aligned) = move _4; // bb3[0]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:5: 7:8
drop(_1) -> bb1; // bb3[1]: scope 0 at $DIR/packed-struct-drop-aligned.rs:8:1: 8:2
}
bb4: {
StorageDead(_6); // bb4[0]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:5: 7:8
(_1.0: Aligned) = move _4; // bb4[1]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:5: 7:8
StorageDead(_4); // bb4[2]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:28: 7:29
_0 = (); // bb4[3]: scope 0 at $DIR/packed-struct-drop-aligned.rs:5:11: 8:2
drop(_1) -> [return: bb2, unwind: bb1]; // bb4[4]: scope 0 at $DIR/packed-struct-drop-aligned.rs:8:1: 8:2
}
}
// MIR for `main` after SimplifyCfg-elaborate-drops // MIR for `main` after SimplifyCfg-elaborate-drops
fn main() -> () { fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/packed-struct-drop-aligned.rs:4:11: 4:11 let mut _0: (); // return place in scope 0 at $DIR/packed-struct-drop-aligned.rs:5:11: 5:11
let mut _1: Packed; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:5:9: 5:14 let mut _1: Packed; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:6:9: 6:14
let mut _2: Aligned; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:5:24: 5:42 let mut _2: Aligned; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:6:24: 6:42
let mut _3: Droppy; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:5:32: 5:41 let mut _3: Droppy; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:6:32: 6:41
let mut _4: Aligned; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:6:11: 6:29 let mut _4: Aligned; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:7:11: 7:29
let mut _5: Droppy; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:6:19: 6:28 let mut _5: Droppy; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:7:19: 7:28
let mut _6: Aligned; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:6:5: 6:8 let mut _6: Aligned; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:7:5: 7:8
scope 1 { scope 1 {
debug x => _1; // in scope 1 at $DIR/packed-struct-drop-aligned.rs:5:9: 5:14 debug x => _1; // in scope 1 at $DIR/packed-struct-drop-aligned.rs:6:9: 6:14
} }
bb0: { bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/packed-struct-drop-aligned.rs:5:9: 5:14 StorageLive(_1); // bb0[0]: scope 0 at $DIR/packed-struct-drop-aligned.rs:6:9: 6:14
StorageLive(_2); // bb0[1]: scope 0 at $DIR/packed-struct-drop-aligned.rs:5:24: 5:42 StorageLive(_2); // bb0[1]: scope 0 at $DIR/packed-struct-drop-aligned.rs:6:24: 6:42
StorageLive(_3); // bb0[2]: scope 0 at $DIR/packed-struct-drop-aligned.rs:5:32: 5:41 StorageLive(_3); // bb0[2]: scope 0 at $DIR/packed-struct-drop-aligned.rs:6:32: 6:41
_3 = Droppy(const 0usize,); // bb0[3]: scope 0 at $DIR/packed-struct-drop-aligned.rs:5:32: 5:41 _3 = Droppy(const 0usize,); // bb0[3]: scope 0 at $DIR/packed-struct-drop-aligned.rs:6:32: 6:41
// ty::Const // ty::Const
// + ty: usize // + ty: usize
// + val: Value(Scalar(0x0000000000000000)) // + val: Value(Scalar(0x0000000000000000))
// mir::Constant // mir::Constant
// + span: $DIR/packed-struct-drop-aligned.rs:5:39: 5:40 // + span: $DIR/packed-struct-drop-aligned.rs:6:39: 6:40
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) }
_2 = Aligned(move _3,); // bb0[4]: scope 0 at $DIR/packed-struct-drop-aligned.rs:5:24: 5:42 _2 = Aligned(move _3,); // bb0[4]: scope 0 at $DIR/packed-struct-drop-aligned.rs:6:24: 6:42
StorageDead(_3); // bb0[5]: scope 0 at $DIR/packed-struct-drop-aligned.rs:5:41: 5:42 StorageDead(_3); // bb0[5]: scope 0 at $DIR/packed-struct-drop-aligned.rs:6:41: 6:42
_1 = Packed(move _2,); // bb0[6]: scope 0 at $DIR/packed-struct-drop-aligned.rs:5:17: 5:43 _1 = Packed(move _2,); // bb0[6]: scope 0 at $DIR/packed-struct-drop-aligned.rs:6:17: 6:43
StorageDead(_2); // bb0[7]: scope 0 at $DIR/packed-struct-drop-aligned.rs:5:42: 5:43 StorageDead(_2); // bb0[7]: scope 0 at $DIR/packed-struct-drop-aligned.rs:6:42: 6:43
StorageLive(_4); // bb0[8]: scope 1 at $DIR/packed-struct-drop-aligned.rs:6:11: 6:29 StorageLive(_4); // bb0[8]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:11: 7:29
StorageLive(_5); // bb0[9]: scope 1 at $DIR/packed-struct-drop-aligned.rs:6:19: 6:28 StorageLive(_5); // bb0[9]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:19: 7:28
_5 = Droppy(const 0usize,); // bb0[10]: scope 1 at $DIR/packed-struct-drop-aligned.rs:6:19: 6:28 _5 = Droppy(const 0usize,); // bb0[10]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:19: 7:28
// ty::Const // ty::Const
// + ty: usize // + ty: usize
// + val: Value(Scalar(0x0000000000000000)) // + val: Value(Scalar(0x0000000000000000))
// mir::Constant // mir::Constant
// + span: $DIR/packed-struct-drop-aligned.rs:6:26: 6:27 // + span: $DIR/packed-struct-drop-aligned.rs:7:26: 7:27
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) }
_4 = Aligned(move _5,); // bb0[11]: scope 1 at $DIR/packed-struct-drop-aligned.rs:6:11: 6:29 _4 = Aligned(move _5,); // bb0[11]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:11: 7:29
StorageDead(_5); // bb0[12]: scope 1 at $DIR/packed-struct-drop-aligned.rs:6:28: 6:29 StorageDead(_5); // bb0[12]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:28: 7:29
StorageLive(_6); // bb0[13]: scope 1 at $DIR/packed-struct-drop-aligned.rs:6:5: 6:8 StorageLive(_6); // bb0[13]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:5: 7:8
_6 = move (_1.0: Aligned); // bb0[14]: scope 1 at $DIR/packed-struct-drop-aligned.rs:6:5: 6:8 _6 = move (_1.0: Aligned); // bb0[14]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:5: 7:8
drop(_6) -> [return: bb4, unwind: bb3]; // bb0[15]: scope 1 at $DIR/packed-struct-drop-aligned.rs:6:5: 6:8 drop(_6) -> [return: bb4, unwind: bb3]; // bb0[15]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:5: 7:8
} }
bb1 (cleanup): { bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/packed-struct-drop-aligned.rs:4:1: 7:2 resume; // bb1[0]: scope 0 at $DIR/packed-struct-drop-aligned.rs:5:1: 8:2
} }
bb2: { bb2: {
StorageDead(_1); // bb2[0]: scope 0 at $DIR/packed-struct-drop-aligned.rs:7:1: 7:2 StorageDead(_1); // bb2[0]: scope 0 at $DIR/packed-struct-drop-aligned.rs:8:1: 8:2
return; // bb2[1]: scope 0 at $DIR/packed-struct-drop-aligned.rs:7:2: 7:2 return; // bb2[1]: scope 0 at $DIR/packed-struct-drop-aligned.rs:8:2: 8:2
} }
bb3 (cleanup): { bb3 (cleanup): {
(_1.0: Aligned) = move _4; // bb3[0]: scope 1 at $DIR/packed-struct-drop-aligned.rs:6:5: 6:8 (_1.0: Aligned) = move _4; // bb3[0]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:5: 7:8
drop(_1) -> bb1; // bb3[1]: scope 0 at $DIR/packed-struct-drop-aligned.rs:7:1: 7:2 drop(_1) -> bb1; // bb3[1]: scope 0 at $DIR/packed-struct-drop-aligned.rs:8:1: 8:2
} }
bb4: { bb4: {
StorageDead(_6); // bb4[0]: scope 1 at $DIR/packed-struct-drop-aligned.rs:6:5: 6:8 StorageDead(_6); // bb4[0]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:5: 7:8
(_1.0: Aligned) = move _4; // bb4[1]: scope 1 at $DIR/packed-struct-drop-aligned.rs:6:5: 6:8 (_1.0: Aligned) = move _4; // bb4[1]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:5: 7:8
StorageDead(_4); // bb4[2]: scope 1 at $DIR/packed-struct-drop-aligned.rs:6:28: 6:29 StorageDead(_4); // bb4[2]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:28: 7:29
_0 = (); // bb4[3]: scope 0 at $DIR/packed-struct-drop-aligned.rs:4:11: 7:2 _0 = (); // bb4[3]: scope 0 at $DIR/packed-struct-drop-aligned.rs:5:11: 8:2
drop(_1) -> [return: bb2, unwind: bb1]; // bb4[4]: scope 0 at $DIR/packed-struct-drop-aligned.rs:7:1: 7:2 drop(_1) -> [return: bb2, unwind: bb1]; // bb4[4]: scope 0 at $DIR/packed-struct-drop-aligned.rs:8:1: 8:2
} }
} }
// Test that we don't generate unnecessarily large MIR for very simple matches // Test that we don't generate unnecessarily large MIR for very simple matches
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR rustc.match_bool.mir_map.0.mir // EMIT_MIR rustc.match_bool.mir_map.0.mir
fn match_bool(x: bool) -> usize { fn match_bool(x: bool) -> usize {
match x { match x {
......
// MIR for `match_bool` 0 mir_map
fn match_bool(_1: bool) -> usize {
debug x => _1; // in scope 0 at $DIR/simple-match.rs:5:15: 5:16
let mut _0: usize; // return place in scope 0 at $DIR/simple-match.rs:5:27: 5:32
bb0: {
FakeRead(ForMatchedPlace, _1); // bb0[0]: scope 0 at $DIR/simple-match.rs:6:11: 6:12
switchInt(_1) -> [false: bb3, otherwise: bb2]; // bb0[1]: scope 0 at $DIR/simple-match.rs:7:9: 7:13
}
bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/simple-match.rs:5:1: 10:2
}
bb2: {
falseEdges -> [real: bb4, imaginary: bb3]; // bb2[0]: scope 0 at $DIR/simple-match.rs:7:9: 7:13
}
bb3: {
_0 = const 20usize; // bb3[0]: scope 0 at $DIR/simple-match.rs:8:14: 8:16
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000014))
// mir::Constant
// + span: $DIR/simple-match.rs:8:14: 8:16
// + literal: Const { ty: usize, val: Value(Scalar(0x00000014)) }
goto -> bb5; // bb3[1]: scope 0 at $DIR/simple-match.rs:6:5: 9:6
}
bb4: {
_0 = const 10usize; // bb4[0]: scope 0 at $DIR/simple-match.rs:7:17: 7:19
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x0000000a))
// mir::Constant
// + span: $DIR/simple-match.rs:7:17: 7:19
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000a)) }
goto -> bb5; // bb4[1]: scope 0 at $DIR/simple-match.rs:6:5: 9:6
}
bb5: {
goto -> bb6; // bb5[0]: scope 0 at $DIR/simple-match.rs:10:2: 10:2
}
bb6: {
return; // bb6[0]: scope 0 at $DIR/simple-match.rs:10:2: 10:2
}
}
// MIR for `match_bool` 0 mir_map // MIR for `match_bool` 0 mir_map
fn match_bool(_1: bool) -> usize { fn match_bool(_1: bool) -> usize {
debug x => _1; // in scope 0 at $DIR/simple-match.rs:4:15: 4:16 debug x => _1; // in scope 0 at $DIR/simple-match.rs:5:15: 5:16
let mut _0: usize; // return place in scope 0 at $DIR/simple-match.rs:4:27: 4:32 let mut _0: usize; // return place in scope 0 at $DIR/simple-match.rs:5:27: 5:32
bb0: { bb0: {
FakeRead(ForMatchedPlace, _1); // bb0[0]: scope 0 at $DIR/simple-match.rs:5:11: 5:12 FakeRead(ForMatchedPlace, _1); // bb0[0]: scope 0 at $DIR/simple-match.rs:6:11: 6:12
switchInt(_1) -> [false: bb3, otherwise: bb2]; // bb0[1]: scope 0 at $DIR/simple-match.rs:6:9: 6:13 switchInt(_1) -> [false: bb3, otherwise: bb2]; // bb0[1]: scope 0 at $DIR/simple-match.rs:7:9: 7:13
} }
bb1 (cleanup): { bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/simple-match.rs:4:1: 9:2 resume; // bb1[0]: scope 0 at $DIR/simple-match.rs:5:1: 10:2
} }
bb2: { bb2: {
falseEdges -> [real: bb4, imaginary: bb3]; // bb2[0]: scope 0 at $DIR/simple-match.rs:6:9: 6:13 falseEdges -> [real: bb4, imaginary: bb3]; // bb2[0]: scope 0 at $DIR/simple-match.rs:7:9: 7:13
} }
bb3: { bb3: {
_0 = const 20usize; // bb3[0]: scope 0 at $DIR/simple-match.rs:7:14: 7:16 _0 = const 20usize; // bb3[0]: scope 0 at $DIR/simple-match.rs:8:14: 8:16
// ty::Const // ty::Const
// + ty: usize // + ty: usize
// + val: Value(Scalar(0x0000000000000014)) // + val: Value(Scalar(0x0000000000000014))
// mir::Constant // mir::Constant
// + span: $DIR/simple-match.rs:7:14: 7:16 // + span: $DIR/simple-match.rs:8:14: 8:16
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000014)) } // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000014)) }
goto -> bb5; // bb3[1]: scope 0 at $DIR/simple-match.rs:5:5: 8:6 goto -> bb5; // bb3[1]: scope 0 at $DIR/simple-match.rs:6:5: 9:6
} }
bb4: { bb4: {
_0 = const 10usize; // bb4[0]: scope 0 at $DIR/simple-match.rs:6:17: 6:19 _0 = const 10usize; // bb4[0]: scope 0 at $DIR/simple-match.rs:7:17: 7:19
// ty::Const // ty::Const
// + ty: usize // + ty: usize
// + val: Value(Scalar(0x000000000000000a)) // + val: Value(Scalar(0x000000000000000a))
// mir::Constant // mir::Constant
// + span: $DIR/simple-match.rs:6:17: 6:19 // + span: $DIR/simple-match.rs:7:17: 7:19
// + literal: Const { ty: usize, val: Value(Scalar(0x000000000000000a)) } // + literal: Const { ty: usize, val: Value(Scalar(0x000000000000000a)) }
goto -> bb5; // bb4[1]: scope 0 at $DIR/simple-match.rs:5:5: 8:6 goto -> bb5; // bb4[1]: scope 0 at $DIR/simple-match.rs:6:5: 9:6
} }
bb5: { bb5: {
goto -> bb6; // bb5[0]: scope 0 at $DIR/simple-match.rs:9:2: 9:2 goto -> bb6; // bb5[0]: scope 0 at $DIR/simple-match.rs:10:2: 10:2
} }
bb6: { bb6: {
return; // bb6[0]: scope 0 at $DIR/simple-match.rs:9:2: 9:2 return; // bb6[0]: scope 0 at $DIR/simple-match.rs:10:2: 10:2
} }
} }
// compile-flags: -Zmir-opt-level=0 // compile-flags: -Zmir-opt-level=0
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR rustc.ptr-drop_in_place.[std__string__String].AddMovesForPackedDrops.before.mir // EMIT_MIR rustc.ptr-drop_in_place.[std__string__String].AddMovesForPackedDrops.before.mir
fn main() { fn main() {
let _fn = std::ptr::drop_in_place::<[String]> as unsafe fn(_); let _fn = std::ptr::drop_in_place::<[String]> as unsafe fn(_);
......
// MIR for `std::intrinsics::drop_in_place` before AddMovesForPackedDrops
fn std::intrinsics::drop_in_place(_1: *mut [std::string::String]) -> () {
let mut _0: (); // return place in scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
let mut _2: usize; // in scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
let mut _3: usize; // in scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
let mut _4: usize; // in scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
let mut _5: *mut std::string::String; // in scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
let mut _6: bool; // in scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
let mut _7: *mut std::string::String; // in scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
let mut _8: bool; // in scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
let mut _9: *mut std::string::String; // in scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
let mut _10: *mut std::string::String; // in scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
let mut _11: *mut std::string::String; // in scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
let mut _12: bool; // in scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
let mut _13: *mut std::string::String; // in scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
let mut _14: bool; // in scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
let mut _15: *mut [std::string::String]; // in scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
bb0: {
goto -> bb15; // bb0[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
}
bb1: {
return; // bb1[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
}
bb2 (cleanup): {
resume; // bb2[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
}
bb3 (cleanup): {
_5 = &raw mut (*_1)[_4]; // bb3[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
_4 = Add(move _4, const 1usize); // bb3[1]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000001))
// mir::Constant
// + span: $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
// + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) }
drop((*_5)) -> bb4; // bb3[2]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
}
bb4 (cleanup): {
_6 = Eq(_4, _3); // bb4[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
switchInt(move _6) -> [false: bb3, otherwise: bb2]; // bb4[1]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
}
bb5: {
_7 = &raw mut (*_1)[_4]; // bb5[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
_4 = Add(move _4, const 1usize); // bb5[1]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000001))
// mir::Constant
// + span: $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
// + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) }
drop((*_7)) -> [return: bb6, unwind: bb4]; // bb5[2]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
}
bb6: {
_8 = Eq(_4, _3); // bb6[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
switchInt(move _8) -> [false: bb5, otherwise: bb1]; // bb6[1]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
}
bb7: {
_4 = const 0usize; // bb7[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000000))
// mir::Constant
// + span: $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
// + literal: Const { ty: usize, val: Value(Scalar(0x00000000)) }
goto -> bb6; // bb7[1]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
}
bb8: {
goto -> bb7; // bb8[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
}
bb9 (cleanup): {
_11 = _9; // bb9[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
_9 = Offset(move _9, const 1usize); // bb9[1]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000001))
// mir::Constant
// + span: $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
// + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) }
drop((*_11)) -> bb10; // bb9[2]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
}
bb10 (cleanup): {
_12 = Eq(_9, _10); // bb10[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
switchInt(move _12) -> [false: bb9, otherwise: bb2]; // bb10[1]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
}
bb11: {
_13 = _9; // bb11[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
_9 = Offset(move _9, const 1usize); // bb11[1]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000001))
// mir::Constant
// + span: $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
// + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) }
drop((*_13)) -> [return: bb12, unwind: bb10]; // bb11[2]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
}
bb12: {
_14 = Eq(_9, _10); // bb12[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
switchInt(move _14) -> [false: bb11, otherwise: bb1]; // bb12[1]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
}
bb13: {
_15 = &raw mut (*_1); // bb13[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
_9 = move _15 as *mut std::string::String (Misc); // bb13[1]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
_10 = Offset(_9, move _3); // bb13[2]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
goto -> bb12; // bb13[3]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
}
bb14: {
goto -> bb13; // bb14[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
}
bb15: {
_2 = SizeOf(std::string::String); // bb15[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
_3 = Len((*_1)); // bb15[1]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
switchInt(move _2) -> [0usize: bb8, otherwise: bb14]; // bb15[2]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
}
}
// Test that we don't ICE when trying to dump MIR for unusual item types and // Test that we don't ICE when trying to dump MIR for unusual item types and
// that we don't create filenames containing `<` and `>` // that we don't create filenames containing `<` and `>`
// EMIT_MIR_FOR_EACH_BIT_WIDTH
struct A; struct A;
// EMIT_MIR rustc.{{impl}}-ASSOCIATED_CONSTANT.mir_map.0.mir // EMIT_MIR rustc.{{impl}}-ASSOCIATED_CONSTANT.mir_map.0.mir
......
// MIR for `E::V::{{constant}}#0` 0 mir_map
E::V::{{constant}}#0: isize = {
let mut _0: isize; // return place in scope 0 at $DIR/unusual-item-types.rs:22:9: 22:10
bb0: {
_0 = const 5isize; // bb0[0]: scope 0 at $DIR/unusual-item-types.rs:22:9: 22:10
// ty::Const
// + ty: isize
// + val: Value(Scalar(0x00000005))
// mir::Constant
// + span: $DIR/unusual-item-types.rs:22:9: 22:10
// + literal: Const { ty: isize, val: Value(Scalar(0x00000005)) }
return; // bb0[1]: scope 0 at $DIR/unusual-item-types.rs:22:9: 22:10
}
bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/unusual-item-types.rs:22:9: 22:10
}
}
// MIR for `Test::X` 0 mir_map // MIR for `Test::X` 0 mir_map
fn Test::X(_1: usize) -> Test { fn Test::X(_1: usize) -> Test {
let mut _0: Test; // return place in scope 0 at $DIR/unusual-item-types.rs:14:5: 14:13 let mut _0: Test; // return place in scope 0 at $DIR/unusual-item-types.rs:16:5: 16:13
bb0: { bb0: {
((_0 as X).0: usize) = move _1; // bb0[0]: scope 0 at $DIR/unusual-item-types.rs:14:5: 14:13 ((_0 as X).0: usize) = move _1; // bb0[0]: scope 0 at $DIR/unusual-item-types.rs:16:5: 16:13
discriminant(_0) = 0; // bb0[1]: scope 0 at $DIR/unusual-item-types.rs:14:5: 14:13 discriminant(_0) = 0; // bb0[1]: scope 0 at $DIR/unusual-item-types.rs:16:5: 16:13
return; // bb0[2]: scope 0 at $DIR/unusual-item-types.rs:14:5: 14:13 return; // bb0[2]: scope 0 at $DIR/unusual-item-types.rs:16:5: 16:13
} }
} }
// MIR for `<impl at $DIR/unusual-item-types.rs:7:1: 9:2>::ASSOCIATED_CONSTANT` 0 mir_map // MIR for `<impl at $DIR/unusual-item-types.rs:9:1: 11:2>::ASSOCIATED_CONSTANT` 0 mir_map
const <impl at $DIR/unusual-item-types.rs:7:1: 9:2>::ASSOCIATED_CONSTANT: i32 = { const <impl at $DIR/unusual-item-types.rs:9:1: 11:2>::ASSOCIATED_CONSTANT: i32 = {
let mut _0: i32; // return place in scope 0 at $DIR/unusual-item-types.rs:8:32: 8:35 let mut _0: i32; // return place in scope 0 at $DIR/unusual-item-types.rs:10:32: 10:35
bb0: { bb0: {
_0 = const 2i32; // bb0[0]: scope 0 at $DIR/unusual-item-types.rs:8:38: 8:39 _0 = const 2i32; // bb0[0]: scope 0 at $DIR/unusual-item-types.rs:10:38: 10:39
// ty::Const // ty::Const
// + ty: i32 // + ty: i32
// + val: Value(Scalar(0x00000002)) // + val: Value(Scalar(0x00000002))
// mir::Constant // mir::Constant
// + span: $DIR/unusual-item-types.rs:8:38: 8:39 // + span: $DIR/unusual-item-types.rs:10:38: 10:39
// + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) } // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
return; // bb0[1]: scope 0 at $DIR/unusual-item-types.rs:8:5: 8:40 return; // bb0[1]: scope 0 at $DIR/unusual-item-types.rs:10:5: 10:40
} }
bb1 (cleanup): { bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/unusual-item-types.rs:8:5: 8:40 resume; // bb1[0]: scope 0 at $DIR/unusual-item-types.rs:10:5: 10:40
} }
} }
// MIR for `E::V::{{constant}}#0` 0 mir_map // MIR for `E::V::{{constant}}#0` 0 mir_map
E::V::{{constant}}#0: isize = { E::V::{{constant}}#0: isize = {
let mut _0: isize; // return place in scope 0 at $DIR/unusual-item-types.rs:20:9: 20:10 let mut _0: isize; // return place in scope 0 at $DIR/unusual-item-types.rs:22:9: 22:10
bb0: { bb0: {
_0 = const 5isize; // bb0[0]: scope 0 at $DIR/unusual-item-types.rs:20:9: 20:10 _0 = const 5isize; // bb0[0]: scope 0 at $DIR/unusual-item-types.rs:22:9: 22:10
// ty::Const // ty::Const
// + ty: isize // + ty: isize
// + val: Value(Scalar(0x0000000000000005)) // + val: Value(Scalar(0x0000000000000005))
// mir::Constant // mir::Constant
// + span: $DIR/unusual-item-types.rs:20:9: 20:10 // + span: $DIR/unusual-item-types.rs:22:9: 22:10
// + literal: Const { ty: isize, val: Value(Scalar(0x0000000000000005)) } // + literal: Const { ty: isize, val: Value(Scalar(0x0000000000000005)) }
return; // bb0[1]: scope 0 at $DIR/unusual-item-types.rs:20:9: 20:10 return; // bb0[1]: scope 0 at $DIR/unusual-item-types.rs:22:9: 22:10
} }
bb1 (cleanup): { bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/unusual-item-types.rs:20:9: 20:10 resume; // bb1[0]: scope 0 at $DIR/unusual-item-types.rs:22:9: 22:10
} }
} }
// MIR for `Test::X` 0 mir_map
fn Test::X(_1: usize) -> Test {
let mut _0: Test; // return place in scope 0 at $DIR/unusual-item-types.rs:16:5: 16:13
bb0: {
((_0 as X).0: usize) = move _1; // bb0[0]: scope 0 at $DIR/unusual-item-types.rs:16:5: 16:13
discriminant(_0) = 0; // bb0[1]: scope 0 at $DIR/unusual-item-types.rs:16:5: 16:13
return; // bb0[2]: scope 0 at $DIR/unusual-item-types.rs:16:5: 16:13
}
}
// MIR for `std::intrinsics::drop_in_place` before AddMovesForPackedDrops
fn std::intrinsics::drop_in_place(_1: *mut std::vec::Vec<i32>) -> () {
let mut _0: (); // return place in scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
let mut _2: &mut std::vec::Vec<i32>; // in scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
let mut _3: (); // in scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
bb0: {
goto -> bb7; // bb0[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
}
bb1: {
return; // bb1[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
}
bb2 (cleanup): {
resume; // bb2[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
}
bb3: {
goto -> bb1; // bb3[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
}
bb4 (cleanup): {
goto -> bb2; // bb4[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
}
bb5 (cleanup): {
drop(((*_1).0: alloc::raw_vec::RawVec<i32>)) -> bb4; // bb5[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
}
bb6: {
drop(((*_1).0: alloc::raw_vec::RawVec<i32>)) -> [return: bb3, unwind: bb4]; // bb6[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
}
bb7: {
_2 = &mut (*_1); // bb7[0]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
_3 = const <std::vec::Vec<i32> as std::ops::Drop>::drop(move _2) -> [return: bb6, unwind: bb5]; // bb7[1]: scope 0 at $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
// ty::Const
// + ty: for<'r> fn(&'r mut std::vec::Vec<i32>) {<std::vec::Vec<i32> as std::ops::Drop>::drop}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $SRC_DIR/libcore/ptr/mod.rs:LL:COL: 181:2
// + literal: Const { ty: for<'r> fn(&'r mut std::vec::Vec<i32>) {<std::vec::Vec<i32> as std::ops::Drop>::drop}, val: Value(Scalar(<ZST>)) }
}
}
// MIR for `<impl at $DIR/unusual-item-types.rs:9:1: 11:2>::ASSOCIATED_CONSTANT` 0 mir_map
const <impl at $DIR/unusual-item-types.rs:9:1: 11:2>::ASSOCIATED_CONSTANT: i32 = {
let mut _0: i32; // return place in scope 0 at $DIR/unusual-item-types.rs:10:32: 10:35
bb0: {
_0 = const 2i32; // bb0[0]: scope 0 at $DIR/unusual-item-types.rs:10:38: 10:39
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000002))
// mir::Constant
// + span: $DIR/unusual-item-types.rs:10:38: 10:39
// + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
return; // bb0[1]: scope 0 at $DIR/unusual-item-types.rs:10:5: 10:40
}
bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/unusual-item-types.rs:10:5: 10:40
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册