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

--bless all mir-opt tests.

上级 39b62533
// EMIT_MIR rustc.address_of_reborrow.SimplifyCfg-initial.after.mir
fn address_of_reborrow() {
let y = &[0; 10];
let mut z = &mut [0; 10];
......@@ -35,6 +37,7 @@ fn address_of_reborrow() {
}
// The normal borrows here should be preserved
// EMIT_MIR rustc.borrow_and_cast.SimplifyCfg-initial.after.mir
fn borrow_and_cast(mut x: i32) {
let p = &x as *const i32;
let q = &mut x as *const i32;
......@@ -42,71 +45,3 @@ fn borrow_and_cast(mut x: i32) {
}
fn main() {}
// START rustc.address_of_reborrow.SimplifyCfg-initial.after.mir
// bb0: {
// ...
// _5 = &raw const (*_1); // & to *const casts
// ...
// _7 = &raw const (*_1);
// ...
// _11 = &raw const (*_1);
// ...
// _14 = &raw const (*_1);
// ...
// _16 = &raw const (*_1);
// ...
// _17 = &raw const (*_1); // & to *const coercions
// ...
// _18 = &raw const (*_1);
// ...
// _20 = &raw const (*_1);
// ...
// _22 = &raw const (*_1);
// ...
// _24 = &raw const (*_2); // &mut to *const casts
// ...
// _26 = &raw const (*_2);
// ...
// _30 = &raw const (*_2);
// ...
// _33 = &raw const (*_2);
// ...
// _34 = &raw const (*_2); // &mut to *const coercions
// ...
// _35 = &raw const (*_2);
// ...
// _37 = &raw const (*_2);
// ...
// _39 = &raw const (*_2);
// ...
// _41 = &raw mut (*_2); // &mut to *mut casts
// ...
// _43 = &raw mut (*_2);
// ...
// _47 = &raw mut (*_2);
// ...
// _50 = &raw mut (*_2);
// ...
// _51 = &raw mut (*_2); // &mut to *mut coercions
// ...
// _52 = &raw mut (*_2);
// ...
// _54 = &raw mut (*_2);
// ...
// _56 = &raw mut (*_2);
// ...
// }
// END rustc.address_of_reborrow.SimplifyCfg-initial.after.mir
// START rustc.borrow_and_cast.EraseRegions.after.mir
// bb0: {
// ...
// _4 = &_1;
// ...
// _7 = &mut _1;
// ...
// _10 = &mut _1;
// ...
// }
// END rustc.borrow_and_cast.EraseRegions.after.mir
// MIR for `borrow_and_cast` after SimplifyCfg-initial
fn borrow_and_cast(_1: i32) -> () {
debug x => _1; // in scope 0 at $DIR/address-of.rs:41:20: 41:25
let mut _0: (); // return place in scope 0 at $DIR/address-of.rs:41:32: 41:32
let _2: *const i32; // in scope 0 at $DIR/address-of.rs:42:9: 42:10
let _3: &i32; // in scope 0 at $DIR/address-of.rs:42:13: 42:15
let _5: &mut i32; // in scope 0 at $DIR/address-of.rs:43:13: 43:19
let mut _7: &mut i32; // in scope 0 at $DIR/address-of.rs:44:13: 44:19
scope 1 {
debug p => _2; // in scope 1 at $DIR/address-of.rs:42:9: 42:10
let _4: *const i32; // in scope 1 at $DIR/address-of.rs:43:9: 43:10
scope 2 {
debug q => _4; // in scope 2 at $DIR/address-of.rs:43:9: 43:10
let _6: *mut i32; // in scope 2 at $DIR/address-of.rs:44:9: 44:10
scope 3 {
debug r => _6; // in scope 3 at $DIR/address-of.rs:44:9: 44:10
}
}
}
bb0: {
StorageLive(_2); // bb0[0]: scope 0 at $DIR/address-of.rs:42:9: 42:10
StorageLive(_3); // bb0[1]: scope 0 at $DIR/address-of.rs:42:13: 42:15
_3 = &_1; // bb0[2]: scope 0 at $DIR/address-of.rs:42:13: 42:15
_2 = &raw const (*_3); // bb0[3]: scope 0 at $DIR/address-of.rs:42:13: 42:15
FakeRead(ForLet, _2); // bb0[4]: scope 0 at $DIR/address-of.rs:42:9: 42:10
StorageDead(_3); // bb0[5]: scope 0 at $DIR/address-of.rs:42:29: 42:30
StorageLive(_4); // bb0[6]: scope 1 at $DIR/address-of.rs:43:9: 43:10
StorageLive(_5); // bb0[7]: scope 1 at $DIR/address-of.rs:43:13: 43:19
_5 = &mut _1; // bb0[8]: scope 1 at $DIR/address-of.rs:43:13: 43:19
_4 = &raw const (*_5); // bb0[9]: scope 1 at $DIR/address-of.rs:43:13: 43:19
FakeRead(ForLet, _4); // bb0[10]: scope 1 at $DIR/address-of.rs:43:9: 43:10
StorageDead(_5); // bb0[11]: scope 1 at $DIR/address-of.rs:43:33: 43:34
StorageLive(_6); // bb0[12]: scope 2 at $DIR/address-of.rs:44:9: 44:10
StorageLive(_7); // bb0[13]: scope 2 at $DIR/address-of.rs:44:13: 44:19
_7 = &mut _1; // bb0[14]: scope 2 at $DIR/address-of.rs:44:13: 44:19
_6 = &raw mut (*_7); // bb0[15]: scope 2 at $DIR/address-of.rs:44:13: 44:19
FakeRead(ForLet, _6); // bb0[16]: scope 2 at $DIR/address-of.rs:44:9: 44:10
StorageDead(_7); // bb0[17]: scope 2 at $DIR/address-of.rs:44:31: 44:32
_0 = (); // bb0[18]: scope 0 at $DIR/address-of.rs:41:32: 45:2
StorageDead(_6); // bb0[19]: scope 2 at $DIR/address-of.rs:45:1: 45:2
StorageDead(_4); // bb0[20]: scope 1 at $DIR/address-of.rs:45:1: 45:2
StorageDead(_2); // bb0[21]: scope 0 at $DIR/address-of.rs:45:1: 45:2
return; // bb0[22]: scope 0 at $DIR/address-of.rs:45:2: 45:2
}
}
......@@ -7,35 +7,10 @@ unsafe fn foo(z: *mut usize) -> u32 {
99
}
// EMIT_MIR rustc.main.SimplifyCfg-elaborate-drops.after.mir
fn main() {
let mut x = [42, 43, 44];
let mut y = 1;
let z: *mut usize = &mut y;
x[y] = unsafe { foo(z) };
}
// END RUST SOURCE
// START rustc.main.SimplifyCfg-elaborate-drops.after.mir
// bb0: {
// ...
// _4 = &mut _2;
// _3 = &raw mut (*_4);
// ...
// _6 = _3;
// _5 = const foo(move _6) -> bb1;
// }
//
// bb1: {
// ...
// _7 = _2;
// _8 = Len(_1);
// _9 = Lt(_7, _8);
// assert(move _9, "index out of bounds: the len is move _8 but the index is _7") -> bb2;
// }
//
// bb2: {
// _1[_7] = move _5;
// ...
// return;
// }
// END rustc.main.SimplifyCfg-elaborate-drops.after.mir
// MIR for `main` after SimplifyCfg-elaborate-drops
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/array-index-is-temporary.rs:11:11: 11:11
let mut _1: [u32; 3]; // in scope 0 at $DIR/array-index-is-temporary.rs:12:9: 12:14
let mut _4: &mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:14:25: 14:31
let mut _5: u32; // in scope 0 at $DIR/array-index-is-temporary.rs:15:12: 15:29
let mut _6: *mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:15:25: 15:26
let _7: usize; // in scope 0 at $DIR/array-index-is-temporary.rs:15:7: 15:8
let mut _8: usize; // 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:15:5: 15:9
scope 1 {
debug x => _1; // in scope 1 at $DIR/array-index-is-temporary.rs:12:9: 12:14
let mut _2: usize; // in scope 1 at $DIR/array-index-is-temporary.rs:13:9: 13:14
scope 2 {
debug y => _2; // in scope 2 at $DIR/array-index-is-temporary.rs:13:9: 13: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
scope 3 {
debug z => _3; // in scope 3 at $DIR/array-index-is-temporary.rs:14:9: 14:10
scope 4 {
}
}
}
}
bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/array-index-is-temporary.rs:12:9: 12:14
_1 = [const 42u32, const 43u32, const 44u32]; // bb0[1]: scope 0 at $DIR/array-index-is-temporary.rs:12:17: 12:29
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x0000002a))
// mir::Constant
// + span: $DIR/array-index-is-temporary.rs:12:18: 12: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:12:22: 12: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:12:26: 12:28
// + 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
_2 = const 1usize; // bb0[3]: scope 1 at $DIR/array-index-is-temporary.rs:13:17: 13:18
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x0000000000000001))
// mir::Constant
// + span: $DIR/array-index-is-temporary.rs:13:17: 13:18
// + 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(_4); // bb0[5]: 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:14:25: 14:31
_3 = &raw mut (*_4); // bb0[7]: scope 2 at $DIR/array-index-is-temporary.rs:14:25: 14:31
StorageDead(_4); // bb0[8]: scope 2 at $DIR/array-index-is-temporary.rs:14:31: 14:32
StorageLive(_5); // bb0[9]: scope 3 at $DIR/array-index-is-temporary.rs:15:12: 15:29
StorageLive(_6); // bb0[10]: 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:15:25: 15:26
_5 = const foo(move _6) -> bb1; // bb0[12]: scope 4 at $DIR/array-index-is-temporary.rs:15:21: 15:27
// ty::Const
// + ty: unsafe fn(*mut usize) -> u32 {foo}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/array-index-is-temporary.rs:15:21: 15: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:15:26: 15:27
StorageLive(_7); // bb1[1]: 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:15:7: 15:8
_8 = Len(_1); // bb1[3]: 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: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:15:5: 15:9
}
bb2: {
_1[_7] = move _5; // bb2[0]: scope 3 at $DIR/array-index-is-temporary.rs:15:5: 15:29
StorageDead(_5); // bb2[1]: scope 3 at $DIR/array-index-is-temporary.rs:15:28: 15:29
StorageDead(_7); // bb2[2]: scope 3 at $DIR/array-index-is-temporary.rs:15:29: 15:30
_0 = (); // bb2[3]: scope 0 at $DIR/array-index-is-temporary.rs:11:11: 16:2
StorageDead(_3); // bb2[4]: scope 2 at $DIR/array-index-is-temporary.rs:16:1: 16:2
StorageDead(_2); // bb2[5]: scope 1 at $DIR/array-index-is-temporary.rs:16:1: 16:2
StorageDead(_1); // bb2[6]: scope 0 at $DIR/array-index-is-temporary.rs:16:1: 16:2
return; // bb2[7]: scope 0 at $DIR/array-index-is-temporary.rs:16:2: 16:2
}
}
......@@ -2,6 +2,7 @@
#![feature(box_syntax)]
// EMIT_MIR rustc.main.ElaborateDrops.before.mir
fn main() {
let x = box S::new();
drop(x);
......@@ -18,60 +19,3 @@ fn drop(&mut self) {
println!("splat!");
}
}
// END RUST SOURCE
// START rustc.main.ElaborateDrops.before.mir
// let mut _0: ();
// let _1: std::boxed::Box<S>;
// let mut _2: std::boxed::Box<S>;
// let _3: ();
// let mut _4: std::boxed::Box<S>;
// scope 1 {
// debug x => _1;
// }
// bb0: {
// StorageLive(_1);
// StorageLive(_2);
// _2 = Box(S);
// (*_2) = const S::new() -> [return: bb2, unwind: bb3];
// }
//
// bb1 (cleanup): {
// resume;
// }
//
// bb2: {
// _1 = move _2;
// drop(_2) -> bb4;
// }
//
// bb3 (cleanup): {
// drop(_2) -> bb1;
// }
//
// bb4: {
// StorageDead(_2);
// StorageLive(_3);
// StorageLive(_4);
// _4 = move _1;
// _3 = const std::mem::drop::<std::boxed::Box<S>>(move _4) -> [return: bb5, unwind: bb7];
// }
//
// bb5: {
// StorageDead(_4);
// StorageDead(_3);
// _0 = ();
// drop(_1) -> bb8;
// }
// bb6 (cleanup): {
// drop(_1) -> bb1;
// }
// bb7 (cleanup): {
// drop(_4) -> bb6;
// }
// bb8: {
// StorageDead(_1);
// return;
// }
// }
// END rustc.main.ElaborateDrops.before.mir
// MIR for `main` before ElaborateDrops
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/box_expr.rs:6:11: 6:11
let _1: std::boxed::Box<S>; // in scope 0 at $DIR/box_expr.rs:7:9: 7:10
let mut _2: std::boxed::Box<S>; // in scope 0 at $DIR/box_expr.rs:7:13: 7:25
let _3: (); // in scope 0 at $DIR/box_expr.rs:8:5: 8:12
let mut _4: std::boxed::Box<S>; // in scope 0 at $DIR/box_expr.rs:8:10: 8:11
scope 1 {
debug x => _1; // in scope 1 at $DIR/box_expr.rs:7:9: 7:10
}
bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/box_expr.rs:7:9: 7:10
StorageLive(_2); // bb0[1]: scope 0 at $DIR/box_expr.rs:7:13: 7:25
_2 = Box(S); // bb0[2]: scope 0 at $DIR/box_expr.rs:7:13: 7:25
(*_2) = const S::new() -> [return: bb2, unwind: bb3]; // bb0[3]: scope 0 at $DIR/box_expr.rs:7:17: 7:25
// ty::Const
// + ty: fn() -> S {S::new}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/box_expr.rs:7:17: 7:23
// + literal: Const { ty: fn() -> S {S::new}, val: Value(Scalar(<ZST>)) }
}
bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/box_expr.rs:6:1: 9:2
}
bb2: {
_1 = move _2; // bb2[0]: scope 0 at $DIR/box_expr.rs:7:13: 7:25
drop(_2) -> bb4; // bb2[1]: scope 0 at $DIR/box_expr.rs:7:24: 7:25
}
bb3 (cleanup): {
drop(_2) -> bb1; // bb3[0]: scope 0 at $DIR/box_expr.rs:7:24: 7:25
}
bb4: {
StorageDead(_2); // bb4[0]: scope 0 at $DIR/box_expr.rs:7:24: 7:25
StorageLive(_3); // bb4[1]: scope 1 at $DIR/box_expr.rs:8:5: 8:12
StorageLive(_4); // bb4[2]: scope 1 at $DIR/box_expr.rs:8:10: 8:11
_4 = move _1; // bb4[3]: scope 1 at $DIR/box_expr.rs:8:10: 8:11
_3 = const std::mem::drop::<std::boxed::Box<S>>(move _4) -> [return: bb5, unwind: bb7]; // bb4[4]: scope 1 at $DIR/box_expr.rs:8:5: 8:12
// ty::Const
// + ty: fn(std::boxed::Box<S>) {std::mem::drop::<std::boxed::Box<S>>}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/box_expr.rs:8:5: 8:9
// + literal: Const { ty: fn(std::boxed::Box<S>) {std::mem::drop::<std::boxed::Box<S>>}, val: Value(Scalar(<ZST>)) }
}
bb5: {
StorageDead(_4); // bb5[0]: scope 1 at $DIR/box_expr.rs:8:11: 8:12
StorageDead(_3); // bb5[1]: scope 1 at $DIR/box_expr.rs:8:12: 8:13
_0 = (); // bb5[2]: scope 0 at $DIR/box_expr.rs:6:11: 9:2
drop(_1) -> bb8; // bb5[3]: scope 0 at $DIR/box_expr.rs:9:1: 9:2
}
bb6 (cleanup): {
drop(_1) -> bb1; // bb6[0]: scope 0 at $DIR/box_expr.rs:9:1: 9:2
}
bb7 (cleanup): {
drop(_4) -> bb6; // bb7[0]: scope 1 at $DIR/box_expr.rs:8:11: 8:12
}
bb8: {
StorageDead(_1); // bb8[0]: scope 0 at $DIR/box_expr.rs:9:1: 9:2
return; // bb8[1]: scope 0 at $DIR/box_expr.rs:9:2: 9:2
}
}
// compile-flags: -Z mir-opt-level=0
// EMIT_MIR rustc.main.SimplifyCfg-elaborate-drops.after.mir
fn main() {
let x = b"foo";
let y = [5u8, b'x'];
}
// END RUST SOURCE
// START rustc.main.SimplifyCfg-elaborate-drops.after.mir
// ...
// _1 = const b"foo";
// ...
// _2 = [const 5u8, const 120u8];
// ...
// END rustc.main.SimplifyCfg-elaborate-drops.after.mir
// MIR for `main` after SimplifyCfg-elaborate-drops
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/byte_slice.rs:4:11: 4:11
let _1: &[u8; 3]; // in scope 0 at $DIR/byte_slice.rs:5:9: 5:10
scope 1 {
debug x => _1; // in scope 1 at $DIR/byte_slice.rs:5:9: 5:10
let _2: [u8; 2]; // in scope 1 at $DIR/byte_slice.rs:6:9: 6:10
scope 2 {
debug y => _2; // in scope 2 at $DIR/byte_slice.rs:6:9: 6:10
}
}
bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/byte_slice.rs:5:9: 5:10
_1 = const b"foo"; // bb0[1]: scope 0 at $DIR/byte_slice.rs:5:13: 5:19
// ty::Const
// + ty: &[u8; 3]
// + val: Value(Scalar(alloc0+0))
// mir::Constant
// + span: $DIR/byte_slice.rs:5:13: 5:19
// + literal: Const { ty: &[u8; 3], val: Value(Scalar(alloc0+0)) }
StorageLive(_2); // bb0[2]: scope 1 at $DIR/byte_slice.rs:6:9: 6:10
_2 = [const 5u8, const 120u8]; // bb0[3]: scope 1 at $DIR/byte_slice.rs:6:13: 6:24
// ty::Const
// + ty: u8
// + val: Value(Scalar(0x05))
// mir::Constant
// + span: $DIR/byte_slice.rs:6:14: 6:17
// + literal: Const { ty: u8, val: Value(Scalar(0x05)) }
// ty::Const
// + ty: u8
// + val: Value(Scalar(0x78))
// mir::Constant
// + span: $DIR/byte_slice.rs:6:19: 6:23
// + literal: Const { ty: u8, val: Value(Scalar(0x78)) }
_0 = (); // bb0[4]: scope 0 at $DIR/byte_slice.rs:4:11: 7:2
StorageDead(_2); // bb0[5]: scope 1 at $DIR/byte_slice.rs:7:1: 7:2
StorageDead(_1); // bb0[6]: scope 0 at $DIR/byte_slice.rs:7:1: 7:2
return; // bb0[7]: scope 0 at $DIR/byte_slice.rs:7:2: 7:2
}
}
alloc0 (size: 3, align: 1) {
66 6f 6f │ foo
}
// EMIT_MIR rustc.norm2.InstCombine.diff
fn norm2(x: [f32; 2]) -> f32 {
let a = x[0];
let b = x[1];
......@@ -7,17 +9,3 @@
fn main() {
assert_eq!(norm2([3.0, 4.0]), 5.0*5.0);
}
// END RUST SOURCE
// START rustc.norm2.InstCombine.before.mir
// _4 = Len(_1);
// ...
// _8 = Len(_1);
// END rustc.norm2.InstCombine.before.mir
// START rustc.norm2.InstCombine.after.mir
// _4 = const 2usize;
// ...
// _8 = const 2usize;
// END rustc.norm2.InstCombine.after.mir
- // 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:3:10: 3:11
let mut _0: f32; // return place in scope 0 at $DIR/combine_array_len.rs:3:26: 3:29
let _2: f32; // in scope 0 at $DIR/combine_array_len.rs:4:9: 4:10
let _3: usize; // in scope 0 at $DIR/combine_array_len.rs:4:15: 4:16
let mut _4: usize; // 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:4:13: 4:17
let _7: usize; // in scope 0 at $DIR/combine_array_len.rs:5:15: 5:16
let mut _8: usize; // 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:5:13: 5:17
let mut _10: f32; // in scope 0 at $DIR/combine_array_len.rs:6:5: 6:8
let mut _11: f32; // in scope 0 at $DIR/combine_array_len.rs:6:5: 6:6
let mut _12: f32; // in scope 0 at $DIR/combine_array_len.rs:6:7: 6:8
let mut _13: f32; // in scope 0 at $DIR/combine_array_len.rs:6:11: 6:14
let mut _14: f32; // in scope 0 at $DIR/combine_array_len.rs:6:11: 6:12
let mut _15: f32; // in scope 0 at $DIR/combine_array_len.rs:6:13: 6:14
scope 1 {
debug a => _2; // in scope 1 at $DIR/combine_array_len.rs:4:9: 4:10
let _6: f32; // in scope 1 at $DIR/combine_array_len.rs:5:9: 5:10
scope 2 {
debug b => _6; // in scope 2 at $DIR/combine_array_len.rs:5:9: 5:10
}
}
bb0: {
StorageLive(_2); // bb0[0]: scope 0 at $DIR/combine_array_len.rs:4:9: 4:10
StorageLive(_3); // bb0[1]: 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:4:15: 4:16
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x0000000000000000))
// mir::Constant
// + span: $DIR/combine_array_len.rs:4:15: 4:16
// + 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 = const 2usize; // bb0[3]: scope 0 at $DIR/combine_array_len.rs:4:13: 4:17
+ // ty::Const
+ // + ty: usize
+ // + val: Value(Scalar(0x0000000000000002))
+ // mir::Constant
+ // + span: $DIR/combine_array_len.rs:4:13: 4:17
+ // + 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
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
}
bb1: {
_2 = _1[_3]; // bb1[0]: scope 0 at $DIR/combine_array_len.rs:4:13: 4:17
StorageDead(_3); // bb1[1]: scope 0 at $DIR/combine_array_len.rs:4:17: 4:18
StorageLive(_6); // bb1[2]: scope 1 at $DIR/combine_array_len.rs:5:9: 5:10
StorageLive(_7); // bb1[3]: 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:5:15: 5:16
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x0000000000000001))
// mir::Constant
// + span: $DIR/combine_array_len.rs:5:15: 5:16
// + 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 = const 2usize; // bb1[5]: scope 1 at $DIR/combine_array_len.rs:5:13: 5:17
+ // ty::Const
+ // + ty: usize
+ // + val: Value(Scalar(0x0000000000000002))
+ // mir::Constant
+ // + span: $DIR/combine_array_len.rs:5:13: 5:17
+ // + 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
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
}
bb2: {
_6 = _1[_7]; // bb2[0]: scope 1 at $DIR/combine_array_len.rs:5:13: 5:17
StorageDead(_7); // bb2[1]: scope 1 at $DIR/combine_array_len.rs:5:17: 5:18
StorageLive(_10); // bb2[2]: scope 2 at $DIR/combine_array_len.rs:6:5: 6:8
StorageLive(_11); // bb2[3]: scope 2 at $DIR/combine_array_len.rs:6:5: 6:6
_11 = _2; // bb2[4]: scope 2 at $DIR/combine_array_len.rs:6:5: 6:6
StorageLive(_12); // bb2[5]: scope 2 at $DIR/combine_array_len.rs:6:7: 6:8
_12 = _2; // bb2[6]: scope 2 at $DIR/combine_array_len.rs:6:7: 6:8
_10 = Mul(move _11, move _12); // bb2[7]: scope 2 at $DIR/combine_array_len.rs:6:5: 6:8
StorageDead(_12); // bb2[8]: scope 2 at $DIR/combine_array_len.rs:6:7: 6:8
StorageDead(_11); // bb2[9]: scope 2 at $DIR/combine_array_len.rs:6:7: 6:8
StorageLive(_13); // bb2[10]: scope 2 at $DIR/combine_array_len.rs:6:11: 6:14
StorageLive(_14); // bb2[11]: scope 2 at $DIR/combine_array_len.rs:6:11: 6:12
_14 = _6; // bb2[12]: scope 2 at $DIR/combine_array_len.rs:6:11: 6:12
StorageLive(_15); // bb2[13]: scope 2 at $DIR/combine_array_len.rs:6:13: 6:14
_15 = _6; // bb2[14]: scope 2 at $DIR/combine_array_len.rs:6:13: 6:14
_13 = Mul(move _14, move _15); // bb2[15]: scope 2 at $DIR/combine_array_len.rs:6:11: 6:14
StorageDead(_15); // bb2[16]: scope 2 at $DIR/combine_array_len.rs:6:13: 6:14
StorageDead(_14); // bb2[17]: scope 2 at $DIR/combine_array_len.rs:6:13: 6:14
_0 = Add(move _10, move _13); // bb2[18]: scope 2 at $DIR/combine_array_len.rs:6:5: 6:14
StorageDead(_13); // bb2[19]: scope 2 at $DIR/combine_array_len.rs:6:13: 6:14
StorageDead(_10); // bb2[20]: scope 2 at $DIR/combine_array_len.rs:6:13: 6:14
StorageDead(_6); // bb2[21]: scope 1 at $DIR/combine_array_len.rs:7:1: 7:2
StorageDead(_2); // bb2[22]: scope 0 at $DIR/combine_array_len.rs:7:1: 7:2
return; // bb2[23]: scope 0 at $DIR/combine_array_len.rs:7:2: 7:2
}
}
// EMIT_MIR rustc.test.CopyPropagation.diff
fn test(x: u32) -> u32 {
let y = x;
y
......@@ -7,23 +9,3 @@ fn main() {
// Make sure the function actually gets instantiated.
test(0);
}
// END RUST SOURCE
// START rustc.test.CopyPropagation.before.mir
// bb0: {
// ...
// _2 = _1;
// ...
// _0 = _2;
// ...
// return;
// }
// END rustc.test.CopyPropagation.before.mir
// START rustc.test.CopyPropagation.after.mir
// bb0: {
// ...
// _0 = _1;
// ...
// return;
// }
// END rustc.test.CopyPropagation.after.mir
- // MIR for `test` before CopyPropagation
+ // MIR for `test` after CopyPropagation
fn test(_1: u32) -> u32 {
debug x => _1; // in scope 0 at $DIR/copy_propagation.rs:3:9: 3:10
let mut _0: u32; // return place in scope 0 at $DIR/copy_propagation.rs:3:20: 3:23
let _2: u32; // in scope 0 at $DIR/copy_propagation.rs:4:9: 4:10
scope 1 {
- debug y => _2; // in scope 1 at $DIR/copy_propagation.rs:4:9: 4:10
+ debug y => _1; // in scope 1 at $DIR/copy_propagation.rs:4:9: 4:10
}
bb0: {
- StorageLive(_2); // bb0[0]: scope 0 at $DIR/copy_propagation.rs:4:9: 4:10
- _2 = _1; // bb0[1]: scope 0 at $DIR/copy_propagation.rs:4:13: 4:14
- _0 = _2; // bb0[2]: scope 1 at $DIR/copy_propagation.rs:5:5: 5:6
- StorageDead(_2); // bb0[3]: scope 0 at $DIR/copy_propagation.rs:6:1: 6:2
+ nop; // bb0[0]: scope 0 at $DIR/copy_propagation.rs:4:9: 4:10
+ nop; // bb0[1]: scope 0 at $DIR/copy_propagation.rs:4:13: 4:14
+ _0 = _1; // bb0[2]: scope 1 at $DIR/copy_propagation.rs:5:5: 5:6
+ nop; // bb0[3]: scope 0 at $DIR/copy_propagation.rs:6:1: 6:2
return; // bb0[4]: scope 0 at $DIR/copy_propagation.rs:6:2: 6:2
}
}
......@@ -5,21 +5,25 @@ fn dummy(x: u8) -> u8 {
x
}
// EMIT_MIR rustc.foo.CopyPropagation.diff
fn foo(mut x: u8) {
// calling `dummy` to make an use of `x` that copyprop cannot eliminate
x = dummy(x); // this will assign a local to `x`
}
// EMIT_MIR rustc.bar.CopyPropagation.diff
fn bar(mut x: u8) {
dummy(x);
x = 5;
}
// EMIT_MIR rustc.baz.CopyPropagation.diff
fn baz(mut x: i32) {
// self-assignment to a function argument should be eliminated
x = x;
}
// EMIT_MIR rustc.arg_src.CopyPropagation.diff
fn arg_src(mut x: i32) -> i32 {
let y = x;
x = 123; // Don't propagate this assignment to `y`
......@@ -33,100 +37,3 @@ fn main() {
baz(0);
arg_src(0);
}
// END RUST SOURCE
// START rustc.foo.CopyPropagation.before.mir
// bb0: {
// ...
// _3 = _1;
// _2 = const dummy(move _3) -> bb1;
// }
// bb1: {
// ...
// _1 = move _2;
// ...
// }
// END rustc.foo.CopyPropagation.before.mir
// START rustc.foo.CopyPropagation.after.mir
// bb0: {
// ...
// _3 = _1;
// _2 = const dummy(move _3) -> bb1;
// }
// bb1: {
// ...
// _1 = move _2;
// ...
// }
// END rustc.foo.CopyPropagation.after.mir
// START rustc.bar.CopyPropagation.before.mir
// bb0: {
// StorageLive(_2);
// StorageLive(_3);
// _3 = _1;
// _2 = const dummy(move _3) -> bb1;
// }
// bb1: {
// StorageDead(_3);
// StorageDead(_2);
// _1 = const 5u8;
// ...
// return;
// }
// END rustc.bar.CopyPropagation.before.mir
// START rustc.bar.CopyPropagation.after.mir
// bb0: {
// ...
// _3 = _1;
// _2 = const dummy(move _3) -> bb1;
// }
// bb1: {
// ...
// _1 = const 5u8;
// ...
// return;
// }
// END rustc.bar.CopyPropagation.after.mir
// START rustc.baz.CopyPropagation.before.mir
// bb0: {
// StorageLive(_2);
// _2 = _1;
// _1 = move _2;
// StorageDead(_2);
// ...
// return;
// }
// END rustc.baz.CopyPropagation.before.mir
// START rustc.baz.CopyPropagation.after.mir
// bb0: {
// ...
// _2 = _1;
// _1 = move _2;
// ...
// return;
// }
// END rustc.baz.CopyPropagation.after.mir
// START rustc.arg_src.CopyPropagation.before.mir
// bb0: {
// ...
// _2 = _1;
// ...
// _1 = const 123i32;
// ...
// _0 = _2;
// ...
// return;
// }
// END rustc.arg_src.CopyPropagation.before.mir
// START rustc.arg_src.CopyPropagation.after.mir
// bb0: {
// ...
// _2 = _1;
// ...
// _1 = const 123i32;
// ...
// _0 = _2;
// ...
// return;
// }
// END rustc.arg_src.CopyPropagation.after.mir
- // MIR for `arg_src` before CopyPropagation
+ // MIR for `arg_src` after CopyPropagation
fn arg_src(_1: i32) -> i32 {
debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:27:12: 27:17
let mut _0: i32; // return place in scope 0 at $DIR/copy_propagation_arg.rs:27:27: 27:30
let _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:28:9: 28:10
scope 1 {
debug y => _2; // in scope 1 at $DIR/copy_propagation_arg.rs:28:9: 28:10
}
bb0: {
StorageLive(_2); // bb0[0]: scope 0 at $DIR/copy_propagation_arg.rs:28:9: 28:10
_2 = _1; // bb0[1]: scope 0 at $DIR/copy_propagation_arg.rs:28:13: 28:14
_1 = const 123i32; // bb0[2]: scope 1 at $DIR/copy_propagation_arg.rs:29:5: 29:12
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x0000007b))
// mir::Constant
// + span: $DIR/copy_propagation_arg.rs:29:5: 29:12
// + literal: Const { ty: i32, val: Value(Scalar(0x0000007b)) }
_0 = _2; // bb0[3]: scope 1 at $DIR/copy_propagation_arg.rs:30:5: 30:6
StorageDead(_2); // bb0[4]: scope 0 at $DIR/copy_propagation_arg.rs:31:1: 31:2
return; // bb0[5]: scope 0 at $DIR/copy_propagation_arg.rs:31:2: 31:2
}
}
- // MIR for `bar` before CopyPropagation
+ // MIR for `bar` after CopyPropagation
fn bar(_1: u8) -> () {
debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:15:8: 15:13
let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:15:19: 15:19
let _2: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:16:5: 16:13
let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:16:11: 16:12
bb0: {
StorageLive(_2); // bb0[0]: scope 0 at $DIR/copy_propagation_arg.rs:16:5: 16:13
StorageLive(_3); // bb0[1]: scope 0 at $DIR/copy_propagation_arg.rs:16:11: 16:12
_3 = _1; // bb0[2]: scope 0 at $DIR/copy_propagation_arg.rs:16:11: 16:12
_2 = const dummy(move _3) -> bb1; // bb0[3]: scope 0 at $DIR/copy_propagation_arg.rs:16:5: 16:13
// ty::Const
// + ty: fn(u8) -> u8 {dummy}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/copy_propagation_arg.rs:16:5: 16:10
// + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value(Scalar(<ZST>)) }
}
bb1: {
StorageDead(_3); // bb1[0]: scope 0 at $DIR/copy_propagation_arg.rs:16:12: 16:13
StorageDead(_2); // bb1[1]: scope 0 at $DIR/copy_propagation_arg.rs:16:13: 16:14
_1 = const 5u8; // bb1[2]: scope 0 at $DIR/copy_propagation_arg.rs:17:5: 17:10
// ty::Const
// + ty: u8
// + val: Value(Scalar(0x05))
// mir::Constant
// + span: $DIR/copy_propagation_arg.rs:17:5: 17:10
// + literal: Const { ty: u8, val: Value(Scalar(0x05)) }
nop; // bb1[3]: scope 0 at $DIR/copy_propagation_arg.rs:15:19: 18:2
return; // bb1[4]: scope 0 at $DIR/copy_propagation_arg.rs:18:2: 18:2
}
}
- // MIR for `baz` before CopyPropagation
+ // MIR for `baz` after CopyPropagation
fn baz(_1: i32) -> () {
debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:21:8: 21:13
let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:21:20: 21:20
let mut _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10
bb0: {
StorageLive(_2); // bb0[0]: scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10
_2 = _1; // bb0[1]: scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10
_1 = move _2; // bb0[2]: scope 0 at $DIR/copy_propagation_arg.rs:23:5: 23:10
StorageDead(_2); // bb0[3]: scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10
nop; // bb0[4]: scope 0 at $DIR/copy_propagation_arg.rs:21:20: 24:2
return; // bb0[5]: scope 0 at $DIR/copy_propagation_arg.rs:24:2: 24:2
}
}
- // MIR for `foo` before CopyPropagation
+ // MIR for `foo` after CopyPropagation
fn foo(_1: u8) -> () {
debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:9:8: 9:13
let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:9:19: 9:19
let mut _2: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:11:9: 11:17
let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:11:15: 11:16
bb0: {
StorageLive(_2); // bb0[0]: scope 0 at $DIR/copy_propagation_arg.rs:11:9: 11:17
StorageLive(_3); // bb0[1]: scope 0 at $DIR/copy_propagation_arg.rs:11:15: 11:16
_3 = _1; // bb0[2]: scope 0 at $DIR/copy_propagation_arg.rs:11:15: 11:16
_2 = const dummy(move _3) -> bb1; // bb0[3]: scope 0 at $DIR/copy_propagation_arg.rs:11:9: 11:17
// ty::Const
// + ty: fn(u8) -> u8 {dummy}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/copy_propagation_arg.rs:11:9: 11:14
// + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value(Scalar(<ZST>)) }
}
bb1: {
StorageDead(_3); // bb1[0]: scope 0 at $DIR/copy_propagation_arg.rs:11:16: 11:17
_1 = move _2; // bb1[1]: scope 0 at $DIR/copy_propagation_arg.rs:11:5: 11:17
StorageDead(_2); // bb1[2]: scope 0 at $DIR/copy_propagation_arg.rs:11:16: 11:17
nop; // bb1[3]: scope 0 at $DIR/copy_propagation_arg.rs:9:19: 12:2
return; // bb1[4]: scope 0 at $DIR/copy_propagation_arg.rs:12:2: 12:2
}
}
......@@ -4,6 +4,7 @@ struct Baz {
z: bool,
}
// EMIT_MIR rustc.bar.Deaggregator.diff
fn bar(a: usize) -> Baz {
Baz { x: a, y: 0.0, z: false }
}
......@@ -12,27 +13,3 @@ fn main() {
// Make sure the function actually gets instantiated.
bar(0);
}
// END RUST SOURCE
// START rustc.bar.Deaggregator.before.mir
// bb0: {
// ...
// _2 = _1;
// ...
// _0 = Baz { x: move _2, y: const 0f32, z: const false };
// ...
// return;
// }
// END rustc.bar.Deaggregator.before.mir
// START rustc.bar.Deaggregator.after.mir
// bb0: {
// ...
// _2 = _1;
// ...
// (_0.0: usize) = move _2;
// (_0.1: f32) = const 0f32;
// (_0.2: bool) = const false;
// ...
// return;
// }
// END rustc.bar.Deaggregator.after.mir
- // MIR for `bar` before Deaggregator
+ // MIR for `bar` after Deaggregator
fn bar(_1: usize) -> Baz {
debug a => _1; // in scope 0 at $DIR/deaggregator_test.rs:8:8: 8:9
let mut _0: Baz; // return place in scope 0 at $DIR/deaggregator_test.rs:8:21: 8:24
let mut _2: usize; // in scope 0 at $DIR/deaggregator_test.rs:9:14: 9:15
bb0: {
StorageLive(_2); // bb0[0]: scope 0 at $DIR/deaggregator_test.rs:9:14: 9:15
_2 = _1; // bb0[1]: scope 0 at $DIR/deaggregator_test.rs:9:14: 9:15
- _0 = Baz { x: move _2, y: const 0f32, z: const false }; // bb0[2]: scope 0 at $DIR/deaggregator_test.rs:9:5: 9:35
+ (_0.0: usize) = move _2; // bb0[2]: scope 0 at $DIR/deaggregator_test.rs:9:5: 9:35
+ (_0.1: f32) = const 0f32; // bb0[3]: scope 0 at $DIR/deaggregator_test.rs:9:5: 9:35
// ty::Const
// + ty: f32
// + val: Value(Scalar(0x00000000))
// mir::Constant
// + span: $DIR/deaggregator_test.rs:9:20: 9:23
// + literal: Const { ty: f32, val: Value(Scalar(0x00000000)) }
+ (_0.2: bool) = const false; // bb0[4]: scope 0 at $DIR/deaggregator_test.rs:9:5: 9:35
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x00))
// mir::Constant
// + span: $DIR/deaggregator_test.rs:9:28: 9:33
// + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
- StorageDead(_2); // bb0[3]: scope 0 at $DIR/deaggregator_test.rs:9:34: 9:35
- return; // bb0[4]: scope 0 at $DIR/deaggregator_test.rs:10:2: 10:2
+ StorageDead(_2); // bb0[5]: scope 0 at $DIR/deaggregator_test.rs:9:34: 9:35
+ return; // bb0[6]: scope 0 at $DIR/deaggregator_test.rs:10:2: 10:2
}
}
......@@ -3,6 +3,7 @@ enum Baz {
Foo { x: usize },
}
// EMIT_MIR rustc.bar.Deaggregator.diff
fn bar(a: usize) -> Baz {
Baz::Foo { x: a }
}
......@@ -14,24 +15,3 @@ fn main() {
Baz::Foo { x } => println!("{}", x),
};
}
// END RUST SOURCE
// START rustc.bar.Deaggregator.before.mir
// bb0: {
// StorageLive(_2);
// _2 = _1;
// _0 = Baz::Foo { x: move _2 };
// StorageDead(_2);
// return;
// }
// END rustc.bar.Deaggregator.before.mir
// START rustc.bar.Deaggregator.after.mir
// bb0: {
// StorageLive(_2);
// _2 = _1;
// ((_0 as Foo).0: usize) = move _2;
// discriminant(_0) = 1;
// StorageDead(_2);
// return;
// }
// END rustc.bar.Deaggregator.after.mir
- // MIR for `bar` before Deaggregator
+ // MIR for `bar` after Deaggregator
fn bar(_1: usize) -> Baz {
debug a => _1; // in scope 0 at $DIR/deaggregator_test_enum.rs:7:8: 7:9
let mut _0: Baz; // return place in scope 0 at $DIR/deaggregator_test_enum.rs:7:21: 7:24
let mut _2: usize; // in scope 0 at $DIR/deaggregator_test_enum.rs:8:19: 8:20
bb0: {
StorageLive(_2); // bb0[0]: scope 0 at $DIR/deaggregator_test_enum.rs:8:19: 8:20
_2 = _1; // bb0[1]: scope 0 at $DIR/deaggregator_test_enum.rs:8:19: 8:20
- _0 = Baz::Foo { x: move _2 }; // bb0[2]: scope 0 at $DIR/deaggregator_test_enum.rs:8:5: 8:22
- StorageDead(_2); // bb0[3]: scope 0 at $DIR/deaggregator_test_enum.rs:8:21: 8:22
- return; // bb0[4]: scope 0 at $DIR/deaggregator_test_enum.rs:9:2: 9:2
+ ((_0 as Foo).0: usize) = move _2; // bb0[2]: scope 0 at $DIR/deaggregator_test_enum.rs:8:5: 8:22
+ discriminant(_0) = 1; // bb0[3]: scope 0 at $DIR/deaggregator_test_enum.rs:8:5: 8:22
+ StorageDead(_2); // bb0[4]: scope 0 at $DIR/deaggregator_test_enum.rs:8:21: 8:22
+ return; // bb0[5]: scope 0 at $DIR/deaggregator_test_enum.rs:9:2: 9:2
}
}
......@@ -5,6 +5,7 @@ enum Foo {
B(i32),
}
// EMIT_MIR rustc.test1.Deaggregator.diff
fn test1(x: bool, y: i32) -> Foo {
if x {
Foo::A(y)
......@@ -17,40 +18,3 @@ fn main() {
// Make sure the function actually gets instantiated.
test1(false, 0);
}
// END RUST SOURCE
// START rustc.test1.Deaggregator.before.mir
// bb1: {
// StorageLive(_5);
// _5 = _2;
// _0 = Foo::B(move _5,);
// StorageDead(_5);
// goto -> bb3;
// }
// bb2: {
// StorageLive(_4);
// _4 = _2;
// _0 = Foo::A(move _4,);
// StorageDead(_4);
// goto -> bb3;
// }
// END rustc.test1.Deaggregator.before.mir
// START rustc.test1.Deaggregator.after.mir
// bb1: {
// StorageLive(_5);
// _5 = _2;
// ((_0 as B).0: i32) = move _5;
// discriminant(_0) = 1;
// StorageDead(_5);
// goto -> bb3;
// }
// bb2: {
// StorageLive(_4);
// _4 = _2;
// ((_0 as A).0: i32) = move _4;
// discriminant(_0) = 0;
// StorageDead(_4);
// goto -> bb3;
// }
// END rustc.test1.Deaggregator.after.mir
//
- // MIR for `test1` before Deaggregator
+ // MIR for `test1` after Deaggregator
fn test1(_1: bool, _2: i32) -> Foo {
debug x => _1; // in scope 0 at $DIR/deaggregator_test_enum_2.rs:9:10: 9:11
debug y => _2; // in scope 0 at $DIR/deaggregator_test_enum_2.rs:9:19: 9:20
let mut _0: Foo; // return place in scope 0 at $DIR/deaggregator_test_enum_2.rs:9:30: 9:33
let mut _3: bool; // in scope 0 at $DIR/deaggregator_test_enum_2.rs:10:8: 10:9
let mut _4: i32; // in scope 0 at $DIR/deaggregator_test_enum_2.rs:11:16: 11:17
let mut _5: i32; // in scope 0 at $DIR/deaggregator_test_enum_2.rs:13:16: 13:17
bb0: {
StorageLive(_3); // bb0[0]: scope 0 at $DIR/deaggregator_test_enum_2.rs:10:8: 10:9
_3 = _1; // bb0[1]: scope 0 at $DIR/deaggregator_test_enum_2.rs:10:8: 10:9
switchInt(_3) -> [false: bb1, otherwise: bb2]; // bb0[2]: scope 0 at $DIR/deaggregator_test_enum_2.rs:10:5: 14:6
}
bb1: {
StorageLive(_5); // bb1[0]: scope 0 at $DIR/deaggregator_test_enum_2.rs:13:16: 13:17
_5 = _2; // bb1[1]: scope 0 at $DIR/deaggregator_test_enum_2.rs:13:16: 13:17
- _0 = Foo::B(move _5,); // bb1[2]: scope 0 at $DIR/deaggregator_test_enum_2.rs:13:9: 13:18
- StorageDead(_5); // bb1[3]: scope 0 at $DIR/deaggregator_test_enum_2.rs:13:17: 13:18
- goto -> bb3; // bb1[4]: scope 0 at $DIR/deaggregator_test_enum_2.rs:10:5: 14:6
+ ((_0 as B).0: i32) = move _5; // bb1[2]: scope 0 at $DIR/deaggregator_test_enum_2.rs:13:9: 13:18
+ discriminant(_0) = 1; // bb1[3]: scope 0 at $DIR/deaggregator_test_enum_2.rs:13:9: 13:18
+ StorageDead(_5); // bb1[4]: scope 0 at $DIR/deaggregator_test_enum_2.rs:13:17: 13:18
+ goto -> bb3; // bb1[5]: scope 0 at $DIR/deaggregator_test_enum_2.rs:10:5: 14:6
}
bb2: {
StorageLive(_4); // bb2[0]: scope 0 at $DIR/deaggregator_test_enum_2.rs:11:16: 11:17
_4 = _2; // bb2[1]: scope 0 at $DIR/deaggregator_test_enum_2.rs:11:16: 11:17
- _0 = Foo::A(move _4,); // bb2[2]: scope 0 at $DIR/deaggregator_test_enum_2.rs:11:9: 11:18
- StorageDead(_4); // bb2[3]: scope 0 at $DIR/deaggregator_test_enum_2.rs:11:17: 11:18
- goto -> bb3; // bb2[4]: scope 0 at $DIR/deaggregator_test_enum_2.rs:10:5: 14:6
+ ((_0 as A).0: i32) = move _4; // bb2[2]: scope 0 at $DIR/deaggregator_test_enum_2.rs:11:9: 11:18
+ discriminant(_0) = 0; // bb2[3]: scope 0 at $DIR/deaggregator_test_enum_2.rs:11:9: 11:18
+ StorageDead(_4); // bb2[4]: scope 0 at $DIR/deaggregator_test_enum_2.rs:11:17: 11:18
+ goto -> bb3; // bb2[5]: scope 0 at $DIR/deaggregator_test_enum_2.rs:10:5: 14:6
}
bb3: {
StorageDead(_3); // bb3[0]: scope 0 at $DIR/deaggregator_test_enum_2.rs:15:1: 15:2
return; // bb3[1]: scope 0 at $DIR/deaggregator_test_enum_2.rs:15:2: 15:2
}
}
......@@ -5,6 +5,7 @@ enum Foo {
B,
}
// EMIT_MIR rustc.test.Deaggregator.diff
fn test(x: i32) -> [Foo; 2] {
[Foo::A(x), Foo::A(x)]
}
......@@ -13,37 +14,3 @@ fn main() {
// Make sure the function actually gets instantiated.
test(0);
}
// END RUST SOURCE
// START rustc.test.Deaggregator.before.mir
// bb0: {
// ...
// _3 = _1;
// ...
// _2 = Foo::A(move _3,);
// ...
// _5 = _1;
// _4 = Foo::A(move _5,);
// ...
// _0 = [move _2, move _4];
// ...
// return;
// }
// END rustc.test.Deaggregator.before.mir
// START rustc.test.Deaggregator.after.mir
// bb0: {
// ...
// _3 = _1;
// ...
// ((_2 as A).0: i32) = move _3;
// discriminant(_2) = 0;
// ...
// _5 = _1;
// ((_4 as A).0: i32) = move _5;
// discriminant(_4) = 0;
// ...
// _0 = [move _2, move _4];
// ...
// return;
// }
// END rustc.test.Deaggregator.after.mir
- // MIR for `test` before Deaggregator
+ // MIR for `test` after Deaggregator
fn test(_1: i32) -> [Foo; 2] {
debug x => _1; // in scope 0 at $DIR/deaggregator_test_multiple.rs:9:9: 9:10
let mut _0: [Foo; 2]; // return place in scope 0 at $DIR/deaggregator_test_multiple.rs:9:20: 9:28
let mut _2: Foo; // in scope 0 at $DIR/deaggregator_test_multiple.rs:10:6: 10:15
let mut _3: i32; // in scope 0 at $DIR/deaggregator_test_multiple.rs:10:13: 10:14
let mut _4: Foo; // in scope 0 at $DIR/deaggregator_test_multiple.rs:10:17: 10:26
let mut _5: i32; // in scope 0 at $DIR/deaggregator_test_multiple.rs:10:24: 10:25
bb0: {
StorageLive(_2); // bb0[0]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:6: 10:15
StorageLive(_3); // bb0[1]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:13: 10:14
_3 = _1; // bb0[2]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:13: 10:14
- _2 = Foo::A(move _3,); // bb0[3]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:6: 10:15
- StorageDead(_3); // bb0[4]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:14: 10:15
- StorageLive(_4); // bb0[5]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:17: 10:26
- StorageLive(_5); // bb0[6]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:24: 10:25
- _5 = _1; // bb0[7]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:24: 10:25
- _4 = Foo::A(move _5,); // bb0[8]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:17: 10:26
- StorageDead(_5); // bb0[9]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:25: 10:26
- _0 = [move _2, move _4]; // bb0[10]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:5: 10:27
- StorageDead(_4); // bb0[11]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:26: 10:27
- StorageDead(_2); // bb0[12]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:26: 10:27
- return; // bb0[13]: scope 0 at $DIR/deaggregator_test_multiple.rs:11:2: 11:2
+ ((_2 as A).0: i32) = move _3; // bb0[3]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:6: 10:15
+ discriminant(_2) = 0; // bb0[4]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:6: 10:15
+ StorageDead(_3); // bb0[5]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:14: 10:15
+ StorageLive(_4); // bb0[6]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:17: 10:26
+ StorageLive(_5); // bb0[7]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:24: 10:25
+ _5 = _1; // bb0[8]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:24: 10:25
+ ((_4 as A).0: i32) = move _5; // bb0[9]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:17: 10:26
+ discriminant(_4) = 0; // bb0[10]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:17: 10:26
+ StorageDead(_5); // bb0[11]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:25: 10:26
+ _0 = [move _2, move _4]; // bb0[12]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:5: 10:27
+ StorageDead(_4); // bb0[13]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:26: 10:27
+ StorageDead(_2); // bb0[14]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:26: 10:27
+ return; // bb0[15]: scope 0 at $DIR/deaggregator_test_multiple.rs:11:2: 11:2
}
}
// Test that simple or-patterns don't get expanded to exponentially large CFGs
// ignore-tidy-linelength
#![feature(or_patterns)]
// EMIT_MIR rustc.match_tuple.SimplifyCfg-initial.after.mir
fn match_tuple(x: (u32, bool, Option<i32>, u32)) -> u32 {
match x {
(y @ (1 | 4), true | false, Some(1 | 8) | None, z @ (6..=9 | 13..=16)) => y ^ z,
......@@ -12,65 +11,3 @@ fn match_tuple(x: (u32, bool, Option<i32>, u32)) -> u32 {
}
fn main() {}
// END RUST SOURCE
// START rustc.match_tuple.SimplifyCfg-initial.after.mir
// scope 1 {
// debug y => _7;
// debug z => _8;
// }
// bb0: {
// FakeRead(ForMatchedPlace, _1);
// switchInt((_1.0: u32)) -> [1u32: bb2, 4u32: bb2, otherwise: bb1];
// }
// bb1: {
// _0 = const 0u32;
// goto -> bb10;
// }
// bb2: {
// _2 = discriminant((_1.2: std::option::Option<i32>));
// switchInt(move _2) -> [0isize: bb4, 1isize: bb3, otherwise: bb1];
// }
// bb3: {
// switchInt((((_1.2: std::option::Option<i32>) as Some).0: i32)) -> [1i32: bb4, 8i32: bb4, otherwise: bb1];
// }
// bb4: {
// _5 = Le(const 6u32, (_1.3: u32));
// switchInt(move _5) -> [false: bb6, otherwise: bb5];
// }
// bb5: {
// _6 = Le((_1.3: u32), const 9u32);
// switchInt(move _6) -> [false: bb6, otherwise: bb8];
// }
// bb6: {
// _3 = Le(const 13u32, (_1.3: u32));
// switchInt(move _3) -> [false: bb1, otherwise: bb7];
// }
// bb7: {
// _4 = Le((_1.3: u32), const 16u32);
// switchInt(move _4) -> [false: bb1, otherwise: bb8];
// }
// bb8: {
// falseEdges -> [real: bb9, imaginary: bb1];
// }
// bb9: {
// StorageLive(_7);
// _7 = (_1.0: u32);
// StorageLive(_8);
// _8 = (_1.3: u32);
// StorageLive(_9);
// _9 = _7;
// StorageLive(_10);
// _10 = _8;
// _0 = BitXor(move _9, move _10);
// StorageDead(_10);
// StorageDead(_9);
// StorageDead(_8);
// StorageDead(_7);
// goto -> bb10;
// }
// bb10: {
// return;
// }
// END rustc.match_tuple.SimplifyCfg-initial.after.mir
// MIR for `match_tuple` after SimplifyCfg-initial
fn match_tuple(_1: (u32, bool, std::option::Option<i32>, u32)) -> u32 {
debug x => _1; // in scope 0 at $DIR/exponential-or.rs:6:16: 6:17
let mut _0: u32; // return place in scope 0 at $DIR/exponential-or.rs:6:53: 6:56
let mut _2: isize; // in scope 0 at $DIR/exponential-or.rs:8:37: 8:48
let mut _3: bool; // in scope 0 at $DIR/exponential-or.rs:8:70: 8:77
let mut _4: bool; // in scope 0 at $DIR/exponential-or.rs:8:70: 8:77
let mut _5: bool; // in scope 0 at $DIR/exponential-or.rs:8:62: 8:67
let mut _6: bool; // in scope 0 at $DIR/exponential-or.rs:8:62: 8:67
let _7: u32; // in scope 0 at $DIR/exponential-or.rs:8:10: 8:21
let _8: u32; // in scope 0 at $DIR/exponential-or.rs:8:57: 8:78
let mut _9: u32; // in scope 0 at $DIR/exponential-or.rs:8:83: 8:84
let mut _10: u32; // in scope 0 at $DIR/exponential-or.rs:8:87: 8:88
scope 1 {
debug y => _7; // in scope 1 at $DIR/exponential-or.rs:8:10: 8:21
debug z => _8; // in scope 1 at $DIR/exponential-or.rs:8:57: 8:78
}
bb0: {
FakeRead(ForMatchedPlace, _1); // bb0[0]: scope 0 at $DIR/exponential-or.rs:7:11: 7:12
switchInt((_1.0: u32)) -> [1u32: bb2, 4u32: bb2, otherwise: bb1]; // bb0[1]: scope 0 at $DIR/exponential-or.rs:8:15: 8:16
}
bb1: {
_0 = const 0u32; // bb1[0]: scope 0 at $DIR/exponential-or.rs:9:14: 9:15
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x00000000))
// mir::Constant
// + span: $DIR/exponential-or.rs:9:14: 9:15
// + literal: Const { ty: u32, val: Value(Scalar(0x00000000)) }
goto -> bb10; // bb1[1]: scope 0 at $DIR/exponential-or.rs:7:5: 10:6
}
bb2: {
_2 = discriminant((_1.2: std::option::Option<i32>)); // bb2[0]: scope 0 at $DIR/exponential-or.rs:8:37: 8:48
switchInt(move _2) -> [0isize: bb4, 1isize: bb3, otherwise: bb1]; // bb2[1]: scope 0 at $DIR/exponential-or.rs:8:37: 8:48
}
bb3: {
switchInt((((_1.2: std::option::Option<i32>) as Some).0: i32)) -> [1i32: bb4, 8i32: bb4, otherwise: bb1]; // bb3[0]: scope 0 at $DIR/exponential-or.rs:8:42: 8:43
}
bb4: {
_5 = Le(const 6u32, (_1.3: u32)); // bb4[0]: scope 0 at $DIR/exponential-or.rs:8:62: 8:67
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x00000006))
// mir::Constant
// + span: $DIR/exponential-or.rs:8:62: 8:67
// + literal: Const { ty: u32, val: Value(Scalar(0x00000006)) }
switchInt(move _5) -> [false: bb6, otherwise: bb5]; // bb4[1]: scope 0 at $DIR/exponential-or.rs:8:62: 8:67
}
bb5: {
_6 = Le((_1.3: u32), const 9u32); // bb5[0]: scope 0 at $DIR/exponential-or.rs:8:62: 8:67
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x00000009))
// mir::Constant
// + span: $DIR/exponential-or.rs:8:62: 8:67
// + literal: Const { ty: u32, val: Value(Scalar(0x00000009)) }
switchInt(move _6) -> [false: bb6, otherwise: bb8]; // bb5[1]: scope 0 at $DIR/exponential-or.rs:8:62: 8:67
}
bb6: {
_3 = Le(const 13u32, (_1.3: u32)); // bb6[0]: scope 0 at $DIR/exponential-or.rs:8:70: 8:77
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x0000000d))
// mir::Constant
// + span: $DIR/exponential-or.rs:8:70: 8:77
// + literal: Const { ty: u32, val: Value(Scalar(0x0000000d)) }
switchInt(move _3) -> [false: bb1, otherwise: bb7]; // bb6[1]: scope 0 at $DIR/exponential-or.rs:8:70: 8:77
}
bb7: {
_4 = Le((_1.3: u32), const 16u32); // bb7[0]: scope 0 at $DIR/exponential-or.rs:8:70: 8:77
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x00000010))
// mir::Constant
// + span: $DIR/exponential-or.rs:8:70: 8:77
// + literal: Const { ty: u32, val: Value(Scalar(0x00000010)) }
switchInt(move _4) -> [false: bb1, otherwise: bb8]; // bb7[1]: scope 0 at $DIR/exponential-or.rs:8:70: 8:77
}
bb8: {
falseEdges -> [real: bb9, imaginary: bb1]; // bb8[0]: scope 0 at $DIR/exponential-or.rs:8:9: 8:79
}
bb9: {
StorageLive(_7); // bb9[0]: scope 0 at $DIR/exponential-or.rs:8:10: 8:21
_7 = (_1.0: u32); // bb9[1]: scope 0 at $DIR/exponential-or.rs:8:10: 8:21
StorageLive(_8); // bb9[2]: scope 0 at $DIR/exponential-or.rs:8:57: 8:78
_8 = (_1.3: u32); // bb9[3]: scope 0 at $DIR/exponential-or.rs:8:57: 8:78
StorageLive(_9); // bb9[4]: scope 1 at $DIR/exponential-or.rs:8:83: 8:84
_9 = _7; // bb9[5]: scope 1 at $DIR/exponential-or.rs:8:83: 8:84
StorageLive(_10); // bb9[6]: scope 1 at $DIR/exponential-or.rs:8:87: 8:88
_10 = _8; // bb9[7]: scope 1 at $DIR/exponential-or.rs:8:87: 8:88
_0 = BitXor(move _9, move _10); // bb9[8]: scope 1 at $DIR/exponential-or.rs:8:83: 8:88
StorageDead(_10); // bb9[9]: scope 1 at $DIR/exponential-or.rs:8:87: 8:88
StorageDead(_9); // bb9[10]: scope 1 at $DIR/exponential-or.rs:8:87: 8:88
StorageDead(_8); // bb9[11]: scope 0 at $DIR/exponential-or.rs:8:88: 8:89
StorageDead(_7); // bb9[12]: scope 0 at $DIR/exponential-or.rs:8:88: 8:89
goto -> bb10; // bb9[13]: scope 0 at $DIR/exponential-or.rs:7:5: 10:6
}
bb10: {
return; // bb10[0]: scope 0 at $DIR/exponential-or.rs:11:2: 11:2
}
}
......@@ -3,45 +3,9 @@
// Regression test for #58892, generator drop shims should not have blocks
// spuriously marked as cleanup
// EMIT_MIR rustc.main-{{closure}}.generator_drop.0.mir
fn main() {
let gen = || {
yield;
};
}
// END RUST SOURCE
// START rustc.main-{{closure}}.generator_drop.0.mir
// bb0: {
// _7 = discriminant((*_1));
// switchInt(move _7) -> [0u32: bb4, 3u32: bb7, otherwise: bb8];
// }
// bb1: {
// StorageDead(_4);
// StorageDead(_3);
// goto -> bb5;
// }
// bb2: {
// return;
// }
// bb3: {
// return;
// }
// bb4: {
// goto -> bb6;
// }
// bb5: {
// goto -> bb2;
// }
// bb6: {
// goto -> bb3;
// }
// bb7: {
// StorageLive(_3);
// StorageLive(_4);
// goto -> bb1;
// }
// bb8: {
// return;
// }
// END rustc.main-{{closure}}.generator_drop.0.mir
// MIR for `main::{{closure}}#0` 0 generator_drop
// generator_layout = GeneratorLayout { field_tys: [], variant_fields: [[], [], [], []], storage_conflicts: BitMatrix { num_rows: 0, num_columns: 0, words: [], marker: PhantomData } }
fn main::{{closure}}#0(_1: *mut [generator@$DIR/generator-drop-cleanup.rs:8:15: 10:6 {()}]) -> () {
let mut _0: (); // return place in scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
let mut _2: (); // in scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
let _3: (); // in scope 0 at $DIR/generator-drop-cleanup.rs:9:9: 9:14
let mut _4: (); // in scope 0 at $DIR/generator-drop-cleanup.rs:9:9: 9:14
let mut _5: (); // in scope 0 at $DIR/generator-drop-cleanup.rs:8:18: 8:18
let mut _6: (); // in scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
let mut _7: isize; // in scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
bb0: {
_7 = discriminant((*_1)); // bb0[0]: scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
switchInt(move _7) -> [0u32: bb4, 3u32: bb7, otherwise: bb8]; // bb0[1]: scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
}
bb1: {
StorageDead(_4); // bb1[0]: scope 0 at $DIR/generator-drop-cleanup.rs:9:13: 9:14
StorageDead(_3); // bb1[1]: scope 0 at $DIR/generator-drop-cleanup.rs:9:14: 9:15
goto -> bb5; // bb1[2]: scope 0 at $DIR/generator-drop-cleanup.rs:10:5: 10:6
}
bb2: {
return; // bb2[0]: scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
}
bb3: {
return; // bb3[0]: scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
}
bb4: {
goto -> bb6; // bb4[0]: scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
}
bb5: {
goto -> bb2; // bb5[0]: scope 0 at $DIR/generator-drop-cleanup.rs:10:5: 10:6
}
bb6: {
goto -> bb3; // bb6[0]: scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
}
bb7: {
StorageLive(_3); // bb7[0]: scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
StorageLive(_4); // bb7[1]: scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
goto -> bb1; // bb7[2]: scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
}
bb8: {
return; // bb8[0]: scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
}
}
......@@ -17,6 +17,7 @@ fn drop(&mut self) {}
fn take<T>(_x: T) {}
// EMIT_MIR rustc.main-{{closure}}.StateTransform.before.mir
fn main() {
let _gen = || {
let a = Foo(5);
......@@ -26,89 +27,3 @@ fn main() {
take(b);
};
}
// END RUST SOURCE
// START rustc.main-{{closure}}.StateTransform.before.mir
// ...
// let _3: Foo;
// ...
// let mut _8: Foo;
// ...
// let mut _10: Bar;
// scope 1 {
// debug a => _3;
// let _4: Bar;
// scope 2 {
// debug b => _4;
// }
// }
// bb0: {
// StorageLive(_3);
// _3 = Foo(const 5i32,);
// StorageLive(_4);
// _4 = Bar(const 6i32,);
// ...
// _5 = yield(move _6) -> [resume: bb2, drop: bb4];
// }
// bb1 (cleanup): {
// resume;
// }
// bb2: {
// ...
// StorageLive(_7);
// StorageLive(_8);
// _8 = move _3;
// _7 = const take::<Foo>(move _8) -> [return: bb7, unwind: bb9];
// }
// bb3 (cleanup): {
// StorageDead(_3);
// drop(_1) -> bb1;
// }
// bb4: {
// ...
// StorageDead(_4);
// drop(_3) -> [return: bb5, unwind: bb3];
// }
// bb5: {
// StorageDead(_3);
// drop(_1) -> [return: bb6, unwind: bb1];
// }
// bb6: {
// generator_drop;
// }
// bb7: {
// StorageDead(_8);
// StorageDead(_7);
// StorageLive(_9);
// StorageLive(_10);
// _10 = move _4;
// _9 = const take::<Bar>(move _10) -> [return: bb10, unwind: bb11];
// }
// bb8 (cleanup): {
// StorageDead(_4);
// StorageDead(_3);
// drop(_1) -> bb1;
// }
// bb9 (cleanup): {
// StorageDead(_8);
// StorageDead(_7);
// goto -> bb8;
// }
// bb10: {
// StorageDead(_10);
// StorageDead(_9);
// ...
// StorageDead(_4);
// StorageDead(_3);
// drop(_1) -> [return: bb12, unwind: bb1];
// }
// bb11 (cleanup): {
// StorageDead(_10);
// StorageDead(_9);
// goto -> bb8;
// }
// bb12: {
// return;
// }
// END rustc.main-{{closure}}.StateTransform.before.mir
// MIR for `main::{{closure}}#0` before StateTransform
fn main::{{closure}}#0(_1: [generator@$DIR/generator-storage-dead-unwind.rs:22:16: 28:6 {Foo, Bar, ()}], _2: ()) -> ()
yields ()
{
let mut _0: (); // return place in scope 0 at $DIR/generator-storage-dead-unwind.rs:22:19: 22:19
let _3: Foo; // in scope 0 at $DIR/generator-storage-dead-unwind.rs:23:13: 23:14
let _5: (); // in scope 0 at $DIR/generator-storage-dead-unwind.rs:25:9: 25:14
let mut _6: (); // in scope 0 at $DIR/generator-storage-dead-unwind.rs:25:9: 25:14
let _7: (); // in scope 0 at $DIR/generator-storage-dead-unwind.rs:26:9: 26:16
let mut _8: Foo; // in scope 0 at $DIR/generator-storage-dead-unwind.rs:26:14: 26:15
let _9: (); // in scope 0 at $DIR/generator-storage-dead-unwind.rs:27:9: 27:16
let mut _10: Bar; // in scope 0 at $DIR/generator-storage-dead-unwind.rs:27:14: 27:15
scope 1 {
debug a => _3; // in scope 1 at $DIR/generator-storage-dead-unwind.rs:23:13: 23:14
let _4: Bar; // in scope 1 at $DIR/generator-storage-dead-unwind.rs:24:13: 24:14
scope 2 {
debug b => _4; // in scope 2 at $DIR/generator-storage-dead-unwind.rs:24:13: 24:14
}
}
bb0: {
StorageLive(_3); // bb0[0]: scope 0 at $DIR/generator-storage-dead-unwind.rs:23:13: 23:14
_3 = Foo(const 5i32,); // bb0[1]: scope 0 at $DIR/generator-storage-dead-unwind.rs:23:17: 23:23
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000005))
// mir::Constant
// + span: $DIR/generator-storage-dead-unwind.rs:23:21: 23:22
// + literal: Const { ty: i32, val: Value(Scalar(0x00000005)) }
StorageLive(_4); // bb0[2]: scope 1 at $DIR/generator-storage-dead-unwind.rs:24:13: 24:14
_4 = Bar(const 6i32,); // bb0[3]: scope 1 at $DIR/generator-storage-dead-unwind.rs:24:17: 24:23
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000006))
// mir::Constant
// + span: $DIR/generator-storage-dead-unwind.rs:24:21: 24:22
// + literal: Const { ty: i32, val: Value(Scalar(0x00000006)) }
StorageLive(_5); // bb0[4]: scope 2 at $DIR/generator-storage-dead-unwind.rs:25:9: 25:14
StorageLive(_6); // bb0[5]: scope 2 at $DIR/generator-storage-dead-unwind.rs:25:9: 25:14
_6 = (); // bb0[6]: scope 2 at $DIR/generator-storage-dead-unwind.rs:25:9: 25:14
_5 = yield(move _6) -> [resume: bb2, drop: bb4]; // bb0[7]: scope 2 at $DIR/generator-storage-dead-unwind.rs:25:9: 25:14
}
bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/generator-storage-dead-unwind.rs:22:16: 28:6
}
bb2: {
StorageDead(_6); // bb2[0]: scope 2 at $DIR/generator-storage-dead-unwind.rs:25:13: 25:14
StorageDead(_5); // bb2[1]: scope 2 at $DIR/generator-storage-dead-unwind.rs:25:14: 25:15
StorageLive(_7); // bb2[2]: scope 2 at $DIR/generator-storage-dead-unwind.rs:26:9: 26:16
StorageLive(_8); // bb2[3]: scope 2 at $DIR/generator-storage-dead-unwind.rs:26:14: 26:15
_8 = move _3; // bb2[4]: scope 2 at $DIR/generator-storage-dead-unwind.rs:26:14: 26:15
_7 = const take::<Foo>(move _8) -> [return: bb7, unwind: bb9]; // bb2[5]: scope 2 at $DIR/generator-storage-dead-unwind.rs:26:9: 26:16
// ty::Const
// + ty: fn(Foo) {take::<Foo>}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/generator-storage-dead-unwind.rs:26:9: 26:13
// + literal: Const { ty: fn(Foo) {take::<Foo>}, val: Value(Scalar(<ZST>)) }
}
bb3 (cleanup): {
StorageDead(_3); // bb3[0]: scope 0 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
drop(_1) -> bb1; // bb3[1]: scope 0 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
}
bb4: {
StorageDead(_6); // bb4[0]: scope 2 at $DIR/generator-storage-dead-unwind.rs:25:13: 25:14
StorageDead(_5); // bb4[1]: scope 2 at $DIR/generator-storage-dead-unwind.rs:25:14: 25:15
StorageDead(_4); // bb4[2]: scope 1 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
drop(_3) -> [return: bb5, unwind: bb3]; // bb4[3]: scope 0 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
}
bb5: {
StorageDead(_3); // bb5[0]: scope 0 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
drop(_1) -> [return: bb6, unwind: bb1]; // bb5[1]: scope 0 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
}
bb6: {
generator_drop; // bb6[0]: scope 0 at $DIR/generator-storage-dead-unwind.rs:22:16: 28:6
}
bb7: {
StorageDead(_8); // bb7[0]: scope 2 at $DIR/generator-storage-dead-unwind.rs:26:15: 26:16
StorageDead(_7); // bb7[1]: scope 2 at $DIR/generator-storage-dead-unwind.rs:26:16: 26:17
StorageLive(_9); // bb7[2]: scope 2 at $DIR/generator-storage-dead-unwind.rs:27:9: 27:16
StorageLive(_10); // bb7[3]: scope 2 at $DIR/generator-storage-dead-unwind.rs:27:14: 27:15
_10 = move _4; // bb7[4]: scope 2 at $DIR/generator-storage-dead-unwind.rs:27:14: 27:15
_9 = const take::<Bar>(move _10) -> [return: bb10, unwind: bb11]; // bb7[5]: scope 2 at $DIR/generator-storage-dead-unwind.rs:27:9: 27:16
// ty::Const
// + ty: fn(Bar) {take::<Bar>}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/generator-storage-dead-unwind.rs:27:9: 27:13
// + literal: Const { ty: fn(Bar) {take::<Bar>}, val: Value(Scalar(<ZST>)) }
}
bb8 (cleanup): {
StorageDead(_4); // bb8[0]: scope 1 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
StorageDead(_3); // bb8[1]: scope 0 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
drop(_1) -> bb1; // bb8[2]: scope 0 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
}
bb9 (cleanup): {
StorageDead(_8); // bb9[0]: scope 2 at $DIR/generator-storage-dead-unwind.rs:26:15: 26:16
StorageDead(_7); // bb9[1]: scope 2 at $DIR/generator-storage-dead-unwind.rs:26:16: 26:17
goto -> bb8; // bb9[2]: scope 2 at $DIR/generator-storage-dead-unwind.rs:1:1: 1:1
}
bb10: {
StorageDead(_10); // bb10[0]: scope 2 at $DIR/generator-storage-dead-unwind.rs:27:15: 27:16
StorageDead(_9); // bb10[1]: scope 2 at $DIR/generator-storage-dead-unwind.rs:27:16: 27:17
_0 = (); // bb10[2]: scope 0 at $DIR/generator-storage-dead-unwind.rs:22:19: 28:6
StorageDead(_4); // bb10[3]: scope 1 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
StorageDead(_3); // bb10[4]: scope 0 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
drop(_1) -> [return: bb12, unwind: bb1]; // bb10[5]: scope 0 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
}
bb11 (cleanup): {
StorageDead(_10); // bb11[0]: scope 2 at $DIR/generator-storage-dead-unwind.rs:27:15: 27:16
StorageDead(_9); // bb11[1]: scope 2 at $DIR/generator-storage-dead-unwind.rs:27:16: 27:17
goto -> bb8; // bb11[2]: scope 2 at $DIR/generator-storage-dead-unwind.rs:1:1: 1:1
}
bb12: {
return; // bb12[0]: scope 0 at $DIR/generator-storage-dead-unwind.rs:28:6: 28:6
}
}
......@@ -13,6 +13,7 @@ fn drop(&mut self) {}
fn callee() {}
// EMIT_MIR rustc.main-{{closure}}.generator_resume.0.mir
fn main() {
let _gen = |_x: u8| {
let _d = HasDrop;
......@@ -22,13 +23,3 @@ fn main() {
}
};
}
// END RUST SOURCE
// START rustc.main-{{closure}}.generator_resume.0.mir
// bb0: {
// ...
// switchInt(move _11) -> [0u32: bb1, 3u32: bb5, otherwise: bb6];
// }
// ...
// END rustc.main-{{closure}}.generator_resume.0.mir
// MIR for `main::{{closure}}#0` 0 generator_resume
// generator_layout = GeneratorLayout { field_tys: [HasDrop], variant_fields: [[], [], [], [_0]], storage_conflicts: BitMatrix { num_rows: 1, num_columns: 1, words: [1], marker: PhantomData } }
fn main::{{closure}}#0(_1: std::pin::Pin<&mut [generator@$DIR/generator-tiny.rs:18:16: 24:6 {u8, HasDrop, ()}]>, _2: u8) -> std::ops::GeneratorState<(), ()> {
debug _x => _10; // in scope 0 at $DIR/generator-tiny.rs:18:17: 18:19
let mut _0: std::ops::GeneratorState<(), ()>; // return place in scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
let _3: HasDrop; // in scope 0 at $DIR/generator-tiny.rs:19:13: 19:15
let mut _4: !; // in scope 0 at $DIR/generator-tiny.rs:20:9: 23:10
let mut _5: (); // in scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
let _6: u8; // in scope 0 at $DIR/generator-tiny.rs:21:13: 21:18
let mut _7: (); // in scope 0 at $DIR/generator-tiny.rs:21:13: 21:18
let _8: (); // in scope 0 at $DIR/generator-tiny.rs:22:13: 22:21
let mut _9: (); // in scope 0 at $DIR/generator-tiny.rs:18:25: 18:25
let _10: u8; // in scope 0 at $DIR/generator-tiny.rs:18:17: 18:19
let mut _11: isize; // in scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
scope 1 {
debug _d => (((*(_1.0: &mut [generator@$DIR/generator-tiny.rs:18:16: 24:6 {u8, HasDrop, ()}])) as variant#3).0: HasDrop); // in scope 1 at $DIR/generator-tiny.rs:19:13: 19:15
}
bb0: {
_11 = discriminant((*(_1.0: &mut [generator@$DIR/generator-tiny.rs:18:16: 24:6 {u8, HasDrop, ()}]))); // bb0[0]: scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
switchInt(move _11) -> [0u32: bb1, 3u32: bb5, otherwise: bb6]; // bb0[1]: scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
}
bb1: {
_10 = move _2; // bb1[0]: scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
nop; // bb1[1]: scope 0 at $DIR/generator-tiny.rs:19:13: 19:15
(((*(_1.0: &mut [generator@$DIR/generator-tiny.rs:18:16: 24:6 {u8, HasDrop, ()}])) as variant#3).0: HasDrop) = HasDrop; // bb1[2]: scope 0 at $DIR/generator-tiny.rs:19:18: 19:25
StorageLive(_4); // bb1[3]: scope 1 at $DIR/generator-tiny.rs:20:9: 23:10
goto -> bb2; // bb1[4]: scope 1 at $DIR/generator-tiny.rs:20:9: 23:10
}
bb2: {
StorageLive(_6); // bb2[0]: scope 1 at $DIR/generator-tiny.rs:21:13: 21:18
StorageLive(_7); // bb2[1]: scope 1 at $DIR/generator-tiny.rs:21:13: 21:18
_7 = (); // bb2[2]: scope 1 at $DIR/generator-tiny.rs:21:13: 21:18
_0 = std::ops::GeneratorState::<(), ()>::Yielded(move _7,); // bb2[3]: scope 1 at $DIR/generator-tiny.rs:21:13: 21:18
discriminant((*(_1.0: &mut [generator@$DIR/generator-tiny.rs:18:16: 24:6 {u8, HasDrop, ()}]))) = 3; // bb2[4]: scope 1 at $DIR/generator-tiny.rs:21:13: 21:18
return; // bb2[5]: scope 1 at $DIR/generator-tiny.rs:21:13: 21:18
}
bb3: {
StorageDead(_7); // bb3[0]: scope 1 at $DIR/generator-tiny.rs:21:17: 21:18
StorageDead(_6); // bb3[1]: scope 1 at $DIR/generator-tiny.rs:21:18: 21:19
StorageLive(_8); // bb3[2]: scope 1 at $DIR/generator-tiny.rs:22:13: 22:21
_8 = const callee() -> bb4; // bb3[3]: scope 1 at $DIR/generator-tiny.rs:22:13: 22:21
// ty::Const
// + ty: fn() {callee}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/generator-tiny.rs:22:13: 22:19
// + literal: Const { ty: fn() {callee}, val: Value(Scalar(<ZST>)) }
}
bb4: {
StorageDead(_8); // bb4[0]: scope 1 at $DIR/generator-tiny.rs:22:21: 22:22
_5 = (); // bb4[1]: scope 1 at $DIR/generator-tiny.rs:20:14: 23:10
goto -> bb2; // bb4[2]: scope 1 at $DIR/generator-tiny.rs:20:9: 23:10
}
bb5: {
StorageLive(_4); // bb5[0]: scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
StorageLive(_6); // bb5[1]: scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
StorageLive(_7); // bb5[2]: scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
_6 = move _2; // bb5[3]: scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
goto -> bb3; // bb5[4]: scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
}
bb6: {
unreachable; // bb6[0]: scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
}
}
// Test graphviz output
// compile-flags: -Z dump-mir-graphviz
// ignore-tidy-linelength
// EMIT_MIR rustc.main.mir_map.0.dot
fn main() {}
// END RUST SOURCE
// START rustc.main.mir_map.0.dot
// digraph Mir_0_3 { // The name here MUST be an ASCII identifier.
// graph [fontname="monospace"];
// node [fontname="monospace"];
// edge [fontname="monospace"];
// label=<fn main() -&gt; ()<br align="left"/>>;
// bb0__0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">0</td></tr><tr><td align="left" balign="left">_0 = ()<br/></td></tr><tr><td align="left">goto</td></tr></table>>];
// bb1__0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">1</td></tr><tr><td align="left">resume</td></tr></table>>];
// bb2__0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">2</td></tr><tr><td align="left">return</td></tr></table>>];
// bb0__0_3 -> bb2__0_3 [label=""];
// }
// END rustc.main.mir_map.0.dot
digraph Mir_0_3 {
graph [fontname="monospace"];
node [fontname="monospace"];
edge [fontname="monospace"];
label=<fn main() -&gt; ()<br align="left"/>>;
bb0__0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">0</td></tr><tr><td align="left" balign="left">_0 = ()<br/></td></tr><tr><td align="left">goto</td></tr></table>>];
bb1__0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">1</td></tr><tr><td align="left">resume</td></tr></table>>];
bb2__0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">2</td></tr><tr><td align="left">return</td></tr></table>>];
bb0__0_3 -> bb2__0_3 [label=""];
}
// check that we don't StorageDead booleans before they are used
// EMIT_MIR rustc.main.SimplifyCfg-initial.after.mir
fn main() {
let mut should_break = false;
loop {
......@@ -9,42 +10,3 @@ fn main() {
should_break = true;
}
}
// END RUST SOURCE
// START rustc.main.SimplifyCfg-initial.after.mir
// bb0: {
// StorageLive(_1);
// _1 = const false;
// FakeRead(ForLet, _1);
// goto -> bb2;
// }
// bb1 (cleanup): {
// resume;
// }
// bb2: {
// falseUnwind -> [real: bb3, cleanup: bb1];
// }
// bb3: {
// StorageLive(_3);
// StorageLive(_4);
// _4 = _1;
// FakeRead(ForMatchedPlace, _4);
// switchInt(_4) -> [false: bb5, otherwise: bb4];
// }
// ...
// bb5: {
// _3 = ();
// StorageDead(_4);
// StorageDead(_3);
// _1 = const true;
// _2 = ();
// goto -> bb2;
// }
// bb6: {
// _0 = ();
// StorageDead(_4);
// StorageDead(_3);
// StorageDead(_1);
// return;
// }
// END rustc.main.SimplifyCfg-initial.after.mir
// MIR for `main` after SimplifyCfg-initial
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/issue-38669.rs:4:11: 4:11
let mut _1: bool; // in scope 0 at $DIR/issue-38669.rs:5:9: 5:25
let mut _2: (); // in scope 0 at $DIR/issue-38669.rs:4:1: 12:2
let _3: (); // in scope 0 at $DIR/issue-38669.rs:7:9: 9:10
let mut _4: bool; // in scope 0 at $DIR/issue-38669.rs:7:12: 7:24
let mut _5: !; // in scope 0 at $DIR/issue-38669.rs:7:25: 9:10
scope 1 {
debug should_break => _1; // in scope 1 at $DIR/issue-38669.rs:5:9: 5:25
}
bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/issue-38669.rs:5:9: 5:25
_1 = const false; // bb0[1]: scope 0 at $DIR/issue-38669.rs:5:28: 5:33
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x00))
// mir::Constant
// + span: $DIR/issue-38669.rs:5:28: 5:33
// + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
FakeRead(ForLet, _1); // bb0[2]: scope 0 at $DIR/issue-38669.rs:5:9: 5:25
goto -> bb2; // bb0[3]: scope 1 at $DIR/issue-38669.rs:6:5: 11:6
}
bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/issue-38669.rs:4:1: 12:2
}
bb2: {
falseUnwind -> [real: bb3, cleanup: bb1]; // bb2[0]: scope 1 at $DIR/issue-38669.rs:6:5: 11:6
}
bb3: {
StorageLive(_3); // bb3[0]: scope 1 at $DIR/issue-38669.rs:7:9: 9:10
StorageLive(_4); // bb3[1]: scope 1 at $DIR/issue-38669.rs:7:12: 7:24
_4 = _1; // bb3[2]: scope 1 at $DIR/issue-38669.rs:7:12: 7:24
FakeRead(ForMatchedPlace, _4); // bb3[3]: scope 1 at $DIR/issue-38669.rs:7:12: 7:24
switchInt(_4) -> [false: bb5, otherwise: bb4]; // bb3[4]: scope 1 at $DIR/issue-38669.rs:7:9: 9:10
}
bb4: {
falseEdges -> [real: bb6, imaginary: bb5]; // bb4[0]: scope 1 at $DIR/issue-38669.rs:7:9: 9:10
}
bb5: {
_3 = (); // bb5[0]: scope 1 at $DIR/issue-38669.rs:7:9: 9:10
StorageDead(_4); // bb5[1]: scope 1 at $DIR/issue-38669.rs:9:9: 9:10
StorageDead(_3); // bb5[2]: scope 1 at $DIR/issue-38669.rs:9:9: 9:10
_1 = const true; // bb5[3]: scope 1 at $DIR/issue-38669.rs:10:9: 10:28
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x01))
// mir::Constant
// + span: $DIR/issue-38669.rs:10:24: 10:28
// + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
_2 = (); // bb5[4]: scope 1 at $DIR/issue-38669.rs:6:10: 11:6
goto -> bb2; // bb5[5]: scope 1 at $DIR/issue-38669.rs:6:5: 11:6
}
bb6: {
_0 = (); // bb6[0]: scope 1 at $DIR/issue-38669.rs:8:13: 8:18
StorageDead(_4); // bb6[1]: scope 1 at $DIR/issue-38669.rs:9:9: 9:10
StorageDead(_3); // bb6[2]: scope 1 at $DIR/issue-38669.rs:9:9: 9:10
StorageDead(_1); // bb6[3]: scope 0 at $DIR/issue-38669.rs:12:1: 12:2
return; // bb6[4]: scope 0 at $DIR/issue-38669.rs:12:2: 12:2
}
}
......@@ -2,12 +2,15 @@
// check that we don't emit multiple drop flags when they are not needed.
// EMIT_MIR rustc.main.ElaborateDrops.after.mir
fn main() {
let x = S.other(S.id());
}
// no_mangle to make sure this gets instantiated even in an executable.
#[no_mangle]
// EMIT_MIR rustc.test.ElaborateDrops.after.mir
pub fn test() {
let u = S;
let mut v = S;
......@@ -25,34 +28,3 @@ impl S {
fn id(self) -> Self { self }
fn other(self, s: Self) {}
}
// END RUST SOURCE
// START rustc.main.ElaborateDrops.after.mir
// let mut _0: ();
// let _1: ();
// let mut _2: S;
// let mut _3: S;
// let mut _4: S;
// let mut _5: bool;
// scope 1 {
// debug x => _1;
// }
// ...
// bb0: {
// END rustc.main.ElaborateDrops.after.mir
// START rustc.test.ElaborateDrops.after.mir
// let mut _0: ();
// let _1: S;
// let _3: ();
// let mut _4: S;
// let mut _5: S;
// let mut _6: bool;
// ...
// debug u => _1;
// ...
// let mut _2: S;
// ...
// debug v => _2;
// ...
// bb0: {
// END rustc.test.ElaborateDrops.after.mir
// MIR for `main` after ElaborateDrops
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/issue-41110.rs:7:11: 7:11
let _1: (); // in scope 0 at $DIR/issue-41110.rs:8:9: 8:10
let mut _2: S; // in scope 0 at $DIR/issue-41110.rs:8:13: 8:14
let mut _3: S; // in scope 0 at $DIR/issue-41110.rs:8:21: 8:27
let mut _4: S; // in scope 0 at $DIR/issue-41110.rs:8:21: 8:22
let mut _5: bool; // in scope 0 at $DIR/issue-41110.rs:8:27: 8:28
scope 1 {
debug x => _1; // in scope 1 at $DIR/issue-41110.rs:8:9: 8:10
}
bb0: {
_5 = const false; // bb0[0]: scope 0 at $DIR/issue-41110.rs:8:9: 8:10
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x00))
// mir::Constant
// + span: $DIR/issue-41110.rs:8:9: 8:10
// + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
StorageLive(_1); // bb0[1]: scope 0 at $DIR/issue-41110.rs:8:9: 8:10
StorageLive(_2); // bb0[2]: scope 0 at $DIR/issue-41110.rs:8:13: 8:14
_5 = const true; // bb0[3]: scope 0 at $DIR/issue-41110.rs:8:13: 8:14
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x01))
// mir::Constant
// + span: $DIR/issue-41110.rs:8:13: 8:14
// + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
_2 = S; // bb0[4]: scope 0 at $DIR/issue-41110.rs:8:13: 8:14
StorageLive(_3); // bb0[5]: scope 0 at $DIR/issue-41110.rs:8:21: 8:27
StorageLive(_4); // bb0[6]: scope 0 at $DIR/issue-41110.rs:8:21: 8:22
_4 = S; // bb0[7]: scope 0 at $DIR/issue-41110.rs:8:21: 8:22
_3 = const S::id(move _4) -> [return: bb2, unwind: bb4]; // bb0[8]: scope 0 at $DIR/issue-41110.rs:8:21: 8:27
// ty::Const
// + ty: fn(S) -> S {S::id}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/issue-41110.rs:8:23: 8:25
// + literal: Const { ty: fn(S) -> S {S::id}, val: Value(Scalar(<ZST>)) }
}
bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/issue-41110.rs:7:1: 9:2
}
bb2: {
StorageDead(_4); // bb2[0]: scope 0 at $DIR/issue-41110.rs:8:26: 8:27
_5 = const false; // bb2[1]: scope 0 at $DIR/issue-41110.rs:8:13: 8:28
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x00))
// mir::Constant
// + span: $DIR/issue-41110.rs:8:13: 8:28
// + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
_1 = const S::other(move _2, move _3) -> [return: bb6, unwind: bb5]; // bb2[2]: scope 0 at $DIR/issue-41110.rs:8:13: 8:28
// ty::Const
// + ty: fn(S, S) {S::other}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/issue-41110.rs:8:15: 8:20
// + literal: Const { ty: fn(S, S) {S::other}, val: Value(Scalar(<ZST>)) }
}
bb3 (cleanup): {
goto -> bb9; // bb3[0]: scope 0 at $DIR/issue-41110.rs:8:27: 8:28
}
bb4 (cleanup): {
goto -> bb3; // bb4[0]: scope 0 at $DIR/issue-41110.rs:8:26: 8:27
}
bb5 (cleanup): {
goto -> bb3; // bb5[0]: scope 0 at $DIR/issue-41110.rs:8:27: 8:28
}
bb6: {
StorageDead(_3); // bb6[0]: scope 0 at $DIR/issue-41110.rs:8:27: 8:28
_5 = const false; // bb6[1]: scope 0 at $DIR/issue-41110.rs:8:27: 8:28
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x00))
// mir::Constant
// + span: $DIR/issue-41110.rs:8:27: 8:28
// + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
StorageDead(_2); // bb6[2]: scope 0 at $DIR/issue-41110.rs:8:27: 8:28
_0 = (); // bb6[3]: scope 0 at $DIR/issue-41110.rs:7:11: 9:2
StorageDead(_1); // bb6[4]: scope 0 at $DIR/issue-41110.rs:9:1: 9:2
return; // bb6[5]: scope 0 at $DIR/issue-41110.rs:9:2: 9:2
}
bb7 (cleanup): {
drop(_2) -> bb1; // bb7[0]: scope 0 at $DIR/issue-41110.rs:8:27: 8:28
}
bb8 (cleanup): {
_5 = const false; // bb8[0]: scope 0 at $DIR/issue-41110.rs:8:27: 8:28
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x00))
// mir::Constant
// + span: $DIR/issue-41110.rs:8:27: 8:28
// + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
goto -> bb7; // bb8[1]: scope 0 at $DIR/issue-41110.rs:8:27: 8:28
}
bb9 (cleanup): {
switchInt(_5) -> [false: bb1, otherwise: bb8]; // bb9[0]: scope 0 at $DIR/issue-41110.rs:8:27: 8:28
}
}
// MIR for `test` after ElaborateDrops
fn test() -> () {
let mut _0: (); // return place in scope 0 at $DIR/issue-41110.rs:14:15: 14:15
let _1: S; // in scope 0 at $DIR/issue-41110.rs:15:9: 15:10
let _3: (); // in scope 0 at $DIR/issue-41110.rs:17:5: 17:12
let mut _4: S; // in scope 0 at $DIR/issue-41110.rs:17:10: 17:11
let mut _5: S; // in scope 0 at $DIR/issue-41110.rs:18:9: 18:10
let mut _6: bool; // in scope 0 at $DIR/issue-41110.rs:19:1: 19:2
scope 1 {
debug u => _1; // in scope 1 at $DIR/issue-41110.rs:15:9: 15:10
let mut _2: S; // in scope 1 at $DIR/issue-41110.rs:16:9: 16:14
scope 2 {
debug v => _2; // in scope 2 at $DIR/issue-41110.rs:16:9: 16:14
}
}
bb0: {
_6 = const false; // bb0[0]: scope 0 at $DIR/issue-41110.rs:15:9: 15:10
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x00))
// mir::Constant
// + span: $DIR/issue-41110.rs:15:9: 15:10
// + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
StorageLive(_1); // bb0[1]: scope 0 at $DIR/issue-41110.rs:15:9: 15:10
_6 = const true; // bb0[2]: scope 0 at $DIR/issue-41110.rs:15:13: 15:14
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x01))
// mir::Constant
// + span: $DIR/issue-41110.rs:15:13: 15:14
// + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
_1 = S; // bb0[3]: scope 0 at $DIR/issue-41110.rs:15:13: 15:14
StorageLive(_2); // bb0[4]: scope 1 at $DIR/issue-41110.rs:16:9: 16:14
_2 = S; // bb0[5]: scope 1 at $DIR/issue-41110.rs:16:17: 16:18
StorageLive(_3); // bb0[6]: scope 2 at $DIR/issue-41110.rs:17:5: 17:12
StorageLive(_4); // bb0[7]: scope 2 at $DIR/issue-41110.rs:17:10: 17:11
_4 = move _2; // bb0[8]: scope 2 at $DIR/issue-41110.rs:17:10: 17:11
_3 = const std::mem::drop::<S>(move _4) -> [return: bb2, unwind: bb5]; // bb0[9]: scope 2 at $DIR/issue-41110.rs:17:5: 17:12
// ty::Const
// + ty: fn(S) {std::mem::drop::<S>}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/issue-41110.rs:17:5: 17:9
// + literal: Const { ty: fn(S) {std::mem::drop::<S>}, val: Value(Scalar(<ZST>)) }
}
bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/issue-41110.rs:14:1: 19:2
}
bb2: {
StorageDead(_4); // bb2[0]: scope 2 at $DIR/issue-41110.rs:17:11: 17:12
StorageDead(_3); // bb2[1]: scope 2 at $DIR/issue-41110.rs:17:12: 17:13
StorageLive(_5); // bb2[2]: scope 2 at $DIR/issue-41110.rs:18:9: 18:10
_6 = const false; // bb2[3]: scope 2 at $DIR/issue-41110.rs:18:9: 18:10
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x00))
// mir::Constant
// + span: $DIR/issue-41110.rs:18:9: 18:10
// + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
_5 = move _1; // bb2[4]: scope 2 at $DIR/issue-41110.rs:18:9: 18:10
goto -> bb12; // bb2[5]: scope 2 at $DIR/issue-41110.rs:18:5: 18:6
}
bb3 (cleanup): {
goto -> bb15; // bb3[0]: scope 0 at $DIR/issue-41110.rs:19:1: 19:2
}
bb4 (cleanup): {
goto -> bb3; // bb4[0]: scope 1 at $DIR/issue-41110.rs:19:1: 19:2
}
bb5 (cleanup): {
goto -> bb4; // bb5[0]: scope 2 at $DIR/issue-41110.rs:17:11: 17:12
}
bb6: {
goto -> bb8; // bb6[0]: scope 2 at $DIR/issue-41110.rs:18:9: 18:10
}
bb7 (cleanup): {
goto -> bb4; // bb7[0]: scope 2 at $DIR/issue-41110.rs:18:9: 18:10
}
bb8: {
StorageDead(_5); // bb8[0]: scope 2 at $DIR/issue-41110.rs:18:9: 18:10
_0 = (); // bb8[1]: scope 0 at $DIR/issue-41110.rs:14:15: 19:2
drop(_2) -> [return: bb9, unwind: bb3]; // bb8[2]: scope 1 at $DIR/issue-41110.rs:19:1: 19:2
}
bb9: {
StorageDead(_2); // bb9[0]: scope 1 at $DIR/issue-41110.rs:19:1: 19:2
goto -> bb10; // bb9[1]: scope 0 at $DIR/issue-41110.rs:19:1: 19:2
}
bb10: {
_6 = const false; // bb10[0]: scope 0 at $DIR/issue-41110.rs:19:1: 19:2
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x00))
// mir::Constant
// + span: $DIR/issue-41110.rs:19:1: 19:2
// + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
StorageDead(_1); // bb10[1]: scope 0 at $DIR/issue-41110.rs:19:1: 19:2
return; // bb10[2]: scope 0 at $DIR/issue-41110.rs:19:2: 19:2
}
bb11 (cleanup): {
_2 = move _5; // bb11[0]: scope 2 at $DIR/issue-41110.rs:18:5: 18:6
goto -> bb7; // bb11[1]: scope 2 at $DIR/issue-41110.rs:18:5: 18:6
}
bb12: {
_2 = move _5; // bb12[0]: scope 2 at $DIR/issue-41110.rs:18:5: 18:6
goto -> bb6; // bb12[1]: scope 2 at $DIR/issue-41110.rs:18:5: 18:6
}
bb13 (cleanup): {
drop(_1) -> bb1; // bb13[0]: scope 0 at $DIR/issue-41110.rs:19:1: 19:2
}
bb14 (cleanup): {
_6 = const false; // bb14[0]: scope 0 at $DIR/issue-41110.rs:19:1: 19:2
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x00))
// mir::Constant
// + span: $DIR/issue-41110.rs:19:1: 19:2
// + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
goto -> bb13; // bb14[1]: scope 0 at $DIR/issue-41110.rs:19:1: 19:2
}
bb15 (cleanup): {
switchInt(_6) -> [false: bb1, otherwise: bb14]; // bb15[0]: scope 0 at $DIR/issue-41110.rs:19:1: 19:2
}
}
......@@ -13,7 +13,8 @@ trait Foo {
fn get(&self) -> [u8; 2];
}
impl Foo for [u8; 2] {
// EMIT_MIR rustc.{{impl}}-{{constant}}.SimplifyCfg-qualify-consts.after.mir
impl Foo for [u8; 1+1] {
fn get(&self) -> [u8; 2] {
*self
}
......
// MIR for `<impl at $DIR/issue-41697.rs:17:1: 21:2>::{{constant}}#0` after SimplifyCfg-qualify-consts
<impl at $DIR/issue-41697.rs:17:1: 21:2>::{{constant}}#0: usize = {
let mut _0: usize; // return place 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:17:19: 17:22
bb0: {
_1 = CheckedAdd(const 1usize, const 1usize); // bb0[0]: scope 0 at $DIR/issue-41697.rs:17:19: 17:22
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x0000000000000001))
// mir::Constant
// + span: $DIR/issue-41697.rs:17:19: 17:20
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) }
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x0000000000000001))
// mir::Constant
// + span: $DIR/issue-41697.rs:17:21: 17:22
// + 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
}
bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/issue-41697.rs:17:19: 17:22
}
bb2: {
_0 = move (_1.0: usize); // bb2[0]: scope 0 at $DIR/issue-41697.rs:17:19: 17:22
return; // bb2[1]: scope 0 at $DIR/issue-41697.rs:17:19: 17:22
}
}
// check that we clear the "ADT master drop flag" even when there are
// no fields to be dropped.
// EMIT_MIR rustc.main.ElaborateDrops.after.mir
fn main() {
let e;
if cond() {
......@@ -20,159 +21,3 @@ enum E {
F(K),
G(Box<E>)
}
// END RUST SOURCE
// fn main() -> () {
// let mut _0: ();
// scope 1 {
// let _1: E;
// debug e => _1;
// scope 2 {
// let _6: K;
// debug _k => _6;
// }
// }
// let mut _2: bool;
// let mut _3: ();
// let mut _4: E;
// let mut _5: K;
// let mut _7: isize;
// let mut _8: bool; // drop flag for `e`
// let mut _9: bool;
// let mut _10: bool;
// let mut _11: isize;
// let mut _12: isize;
//
// bb0: {
// _8 = const false;
// _10 = const false;
// _9 = const false;
// StorageLive(_1);
// StorageLive(_2);
// _2 = const cond() -> [return: bb3, unwind: bb2];
// }
//
// bb1: {
// resume;
// }
//
// bb2: {
// goto -> bb1;
// }
//
// bb3: {
// switchInt(_2) -> [0u8: bb5, otherwise: bb4];
// }
//
// bb4: {
// StorageLive(_4);
// StorageLive(_5);
// _5 = K::{{constructor}};
// _4 = E::F(_5,);
// StorageDead(_5);
// goto -> bb15;
// }
//
// bb5: {
// _0 = ();
// goto -> bb12;
// }
//
// bb6: {
// goto -> bb2;
// }
//
// bb7: {
// goto -> bb8;
// }
//
// bb8: {
// StorageDead(_4);
// _7 = discriminant(_1);
// switchInt(_7) -> [0isize: bb10, otherwise: bb9];
// }
//
// bb9: {
// _0 = ();
// goto -> bb11;
// }
//
// bb10: {
// StorageLive(_6);
// _10 = const false;
// _6 = ((_1 as F).0: K);
// _0 = ();
// goto -> bb11;
// }
//
// bb11: {
// StorageDead(_6);
// goto -> bb12;
// }
//
// bb12: {
// StorageDead(_2);
// goto -> bb22;
// }
//
// bb13: {
// StorageDead(_1);
// return;
// }
//
// bb14: {
// _8 = const true;
// _9 = const true;
// _10 = const true;
// _1 = _4;
// goto -> bb6;
// }
//
// bb15: {
// _8 = const true;
// _9 = const true;
// _10 = const true;
// _1 = _4;
// goto -> bb7;
// }
//
// bb16: {
// _8 = const false; // clear the drop flag - must always be reached
// goto -> bb13;
// }
//
// bb17: {
// _8 = const false;
// goto -> bb1;
// }
//
// bb18: {
// goto -> bb17;
// }
//
// bb19: {
// drop(_1) -> [return: bb16, unwind: bb17];
// }
//
// bb20: {
// drop(_1) -> bb17;
// }
//
// bb21: {
// _11 = discriminant(_1);
// switchInt(_11) -> [0isize: bb16, otherwise: bb19];
// }
//
// bb22: {
// switchInt(_8) -> [0u8: bb16, otherwise: bb21];
// }
//
// bb23: {
// _12 = discriminant(_1);
// switchInt(_12) -> [0isize: bb18, otherwise: bb20];
// }
//
// bb24: {
// switchInt(_8) -> [0u8: bb17, otherwise: bb23];
// }
// }
// MIR for `main` after ElaborateDrops
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/issue-41888.rs:5:11: 5:11
let _1: E; // in scope 0 at $DIR/issue-41888.rs:6:9: 6:10
let mut _2: bool; // in scope 0 at $DIR/issue-41888.rs:7:8: 7:14
let mut _3: E; // in scope 0 at $DIR/issue-41888.rs:8:13: 8:20
let mut _4: K; // in scope 0 at $DIR/issue-41888.rs:8:18: 8:19
let mut _5: isize; // in scope 0 at $DIR/issue-41888.rs:9:16: 9:24
let mut _7: bool; // in scope 0 at $DIR/issue-41888.rs:14:1: 14:2
let mut _8: bool; // in scope 0 at $DIR/issue-41888.rs:14:1: 14:2
let mut _9: bool; // in scope 0 at $DIR/issue-41888.rs:14:1: 14:2
let mut _10: isize; // in scope 0 at $DIR/issue-41888.rs:14:1: 14:2
let mut _11: isize; // in scope 0 at $DIR/issue-41888.rs:14:1: 14:2
scope 1 {
debug e => _1; // in scope 1 at $DIR/issue-41888.rs:6:9: 6:10
let _6: K; // in scope 1 at $DIR/issue-41888.rs:9:21: 9:23
scope 2 {
debug _k => _6; // in scope 2 at $DIR/issue-41888.rs:9:21: 9:23
}
}
bb0: {
_9 = const false; // bb0[0]: scope 0 at $DIR/issue-41888.rs:6:9: 6:10
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x00))
// mir::Constant
// + span: $DIR/issue-41888.rs:6:9: 6:10
// + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
_7 = const false; // bb0[1]: scope 0 at $DIR/issue-41888.rs:6:9: 6:10
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x00))
// mir::Constant
// + span: $DIR/issue-41888.rs:6:9: 6:10
// + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
_8 = const false; // bb0[2]: scope 0 at $DIR/issue-41888.rs:6:9: 6:10
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x00))
// mir::Constant
// + span: $DIR/issue-41888.rs:6:9: 6:10
// + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
StorageLive(_1); // bb0[3]: scope 0 at $DIR/issue-41888.rs:6:9: 6:10
StorageLive(_2); // bb0[4]: scope 1 at $DIR/issue-41888.rs:7:8: 7:14
_2 = const cond() -> [return: bb2, unwind: bb3]; // bb0[5]: scope 1 at $DIR/issue-41888.rs:7:8: 7:14
// ty::Const
// + ty: fn() -> bool {cond}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/issue-41888.rs:7:8: 7:12
// + literal: Const { ty: fn() -> bool {cond}, val: Value(Scalar(<ZST>)) }
}
bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/issue-41888.rs:5:1: 14:2
}
bb2: {
switchInt(_2) -> [false: bb4, otherwise: bb5]; // bb2[0]: scope 1 at $DIR/issue-41888.rs:7:5: 13:6
}
bb3 (cleanup): {
goto -> bb1; // bb3[0]: scope 0 at $DIR/issue-41888.rs:14:1: 14:2
}
bb4: {
_0 = (); // bb4[0]: scope 1 at $DIR/issue-41888.rs:7:5: 13:6
goto -> bb11; // bb4[1]: scope 1 at $DIR/issue-41888.rs:7:5: 13:6
}
bb5: {
StorageLive(_3); // bb5[0]: scope 1 at $DIR/issue-41888.rs:8:13: 8:20
StorageLive(_4); // bb5[1]: scope 1 at $DIR/issue-41888.rs:8:18: 8:19
_4 = K; // bb5[2]: scope 1 at $DIR/issue-41888.rs:8:18: 8:19
_3 = E::F(move _4,); // bb5[3]: scope 1 at $DIR/issue-41888.rs:8:13: 8:20
StorageDead(_4); // bb5[4]: scope 1 at $DIR/issue-41888.rs:8:19: 8:20
goto -> bb14; // bb5[5]: scope 1 at $DIR/issue-41888.rs:8:9: 8:10
}
bb6: {
goto -> bb8; // bb6[0]: scope 1 at $DIR/issue-41888.rs:8:19: 8:20
}
bb7 (cleanup): {
goto -> bb3; // bb7[0]: scope 1 at $DIR/issue-41888.rs:8:19: 8:20
}
bb8: {
StorageDead(_3); // bb8[0]: scope 1 at $DIR/issue-41888.rs:8:19: 8:20
_5 = discriminant(_1); // bb8[1]: scope 1 at $DIR/issue-41888.rs:9:16: 9:24
switchInt(move _5) -> [0isize: bb10, otherwise: bb9]; // bb8[2]: scope 1 at $DIR/issue-41888.rs:9:16: 9:24
}
bb9: {
_0 = (); // bb9[0]: scope 1 at $DIR/issue-41888.rs:9:9: 12:10
goto -> bb11; // bb9[1]: scope 1 at $DIR/issue-41888.rs:9:9: 12:10
}
bb10: {
StorageLive(_6); // bb10[0]: scope 1 at $DIR/issue-41888.rs:9:21: 9:23
_9 = const false; // bb10[1]: scope 1 at $DIR/issue-41888.rs:9:21: 9:23
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x00))
// mir::Constant
// + span: $DIR/issue-41888.rs:9:21: 9:23
// + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
_6 = move ((_1 as F).0: K); // bb10[2]: scope 1 at $DIR/issue-41888.rs:9:21: 9:23
_0 = (); // bb10[3]: scope 2 at $DIR/issue-41888.rs:9:29: 12:10
StorageDead(_6); // bb10[4]: scope 1 at $DIR/issue-41888.rs:12:9: 12:10
goto -> bb11; // bb10[5]: scope 1 at $DIR/issue-41888.rs:9:9: 12:10
}
bb11: {
goto -> bb21; // bb11[0]: scope 0 at $DIR/issue-41888.rs:14:1: 14:2
}
bb12: {
_7 = const false; // bb12[0]: scope 0 at $DIR/issue-41888.rs:14:1: 14:2
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x00))
// mir::Constant
// + span: $DIR/issue-41888.rs:14:1: 14:2
// + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
_8 = const false; // bb12[1]: scope 0 at $DIR/issue-41888.rs:14:1: 14:2
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x00))
// mir::Constant
// + span: $DIR/issue-41888.rs:14:1: 14:2
// + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
_9 = const false; // bb12[2]: scope 0 at $DIR/issue-41888.rs:14:1: 14:2
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x00))
// mir::Constant
// + span: $DIR/issue-41888.rs:14:1: 14:2
// + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
StorageDead(_1); // bb12[3]: scope 0 at $DIR/issue-41888.rs:14:1: 14:2
StorageDead(_2); // bb12[4]: scope 0 at $DIR/issue-41888.rs:14:1: 14:2
return; // bb12[5]: scope 0 at $DIR/issue-41888.rs:14:2: 14:2
}
bb13 (cleanup): {
_7 = const true; // bb13[0]: scope 1 at $DIR/issue-41888.rs:8:9: 8:10
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x01))
// mir::Constant
// + span: $DIR/issue-41888.rs:8:9: 8:10
// + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
_8 = const true; // bb13[1]: scope 1 at $DIR/issue-41888.rs:8:9: 8:10
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x01))
// mir::Constant
// + span: $DIR/issue-41888.rs:8:9: 8:10
// + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
_9 = const true; // bb13[2]: scope 1 at $DIR/issue-41888.rs:8:9: 8:10
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x01))
// mir::Constant
// + span: $DIR/issue-41888.rs:8:9: 8:10
// + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
_1 = move _3; // bb13[3]: scope 1 at $DIR/issue-41888.rs:8:9: 8:10
goto -> bb7; // bb13[4]: scope 1 at $DIR/issue-41888.rs:8:9: 8:10
}
bb14: {
_7 = const true; // bb14[0]: scope 1 at $DIR/issue-41888.rs:8:9: 8:10
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x01))
// mir::Constant
// + span: $DIR/issue-41888.rs:8:9: 8:10
// + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
_8 = const true; // bb14[1]: scope 1 at $DIR/issue-41888.rs:8:9: 8:10
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x01))
// mir::Constant
// + span: $DIR/issue-41888.rs:8:9: 8:10
// + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
_9 = const true; // bb14[2]: scope 1 at $DIR/issue-41888.rs:8:9: 8:10
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x01))
// mir::Constant
// + span: $DIR/issue-41888.rs:8:9: 8:10
// + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
_1 = move _3; // bb14[3]: scope 1 at $DIR/issue-41888.rs:8:9: 8:10
goto -> bb6; // bb14[4]: scope 1 at $DIR/issue-41888.rs:8:9: 8:10
}
bb15: {
_7 = const false; // bb15[0]: scope 0 at $DIR/issue-41888.rs:14:1: 14:2
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x00))
// mir::Constant
// + span: $DIR/issue-41888.rs:14:1: 14:2
// + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
goto -> bb12; // bb15[1]: scope 0 at $DIR/issue-41888.rs:14:1: 14:2
}
bb16 (cleanup): {
_7 = const false; // bb16[0]: scope 0 at $DIR/issue-41888.rs:14:1: 14:2
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x00))
// mir::Constant
// + span: $DIR/issue-41888.rs:14:1: 14:2
// + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
goto -> bb1; // bb16[1]: scope 0 at $DIR/issue-41888.rs:14:1: 14:2
}
bb17 (cleanup): {
goto -> bb16; // bb17[0]: scope 0 at $DIR/issue-41888.rs:14:1: 14:2
}
bb18: {
drop(_1) -> [return: bb15, unwind: bb16]; // bb18[0]: scope 0 at $DIR/issue-41888.rs:14:1: 14:2
}
bb19 (cleanup): {
drop(_1) -> bb16; // bb19[0]: scope 0 at $DIR/issue-41888.rs:14:1: 14:2
}
bb20: {
_10 = discriminant(_1); // bb20[0]: scope 0 at $DIR/issue-41888.rs:14:1: 14:2
switchInt(move _10) -> [0isize: bb15, otherwise: bb18]; // bb20[1]: scope 0 at $DIR/issue-41888.rs:14:1: 14:2
}
bb21: {
switchInt(_7) -> [false: bb15, otherwise: bb20]; // bb21[0]: scope 0 at $DIR/issue-41888.rs:14:1: 14:2
}
bb22 (cleanup): {
_11 = discriminant(_1); // bb22[0]: scope 0 at $DIR/issue-41888.rs:14:1: 14:2
switchInt(move _11) -> [0isize: bb17, otherwise: bb19]; // bb22[1]: scope 0 at $DIR/issue-41888.rs:14:1: 14:2
}
bb23 (cleanup): {
switchInt(_7) -> [false: bb16, otherwise: bb22]; // bb23[0]: scope 0 at $DIR/issue-41888.rs:14:1: 14:2
}
}
// We must mark a variable whose initialization fails due to an
// abort statement as StorageDead.
// EMIT_MIR rustc.main.mir_map.0.mir
fn main() {
loop {
let beacon = {
......@@ -12,82 +13,3 @@ fn main() {
drop(&beacon);
}
}
// END RUST SOURCE
// START rustc.main.mir_map.0.mir
// fn main() -> (){
// let mut _0: ();
// let mut _1: ();
// let _2: i32;
// let mut _3: bool;
// let mut _4: !;
// let _5: ();
// let mut _6: &i32;
// scope 1 {
// debug beacon => _2;
// }
// bb0: {
// goto -> bb1;
// }
// bb1: {
// falseUnwind -> [real: bb3, cleanup: bb4];
// }
// bb2: {
// goto -> bb14;
// }
// bb3: {
// StorageLive(_2);
// StorageLive(_3);
// _3 = const true;
// FakeRead(ForMatchedPlace, _3);
// switchInt(_3) -> [false: bb5, otherwise: bb6];
// }
// bb4 (cleanup): {
// resume;
// }
// bb5: {
// falseEdges -> [real: bb7, imaginary: bb6];
// }
// bb6: {
// _0 = ();
// goto -> bb8;
// }
// bb7: {
// _2 = const 4i32;
// goto -> bb12;
// }
// bb8: {
// StorageDead(_3);
// goto -> bb9;
// }
// bb9: {
// StorageDead(_2);
// goto -> bb2;
// }
// bb10: {
// _4 = ();
// unreachable;
// }
// bb11: {
// goto -> bb12;
// }
// bb12: {
// FakeRead(ForLet, _2);
// StorageDead(_3);
// StorageLive(_5);
// StorageLive(_6);
// _6 = &_2;
// _5 = const std::mem::drop::<&i32>(move _6) -> [return: bb13, unwind: bb4];
// }
// bb13: {
// StorageDead(_6);
// StorageDead(_5);
// _1 = ();
// StorageDead(_2);
// goto -> bb1;
// }
// bb14: {
// return;
// }
// }
// END rustc.main.mir_map.0.mir
// MIR for `main` 0 mir_map
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/issue-49232.rs:5:11: 5:11
let mut _1: (); // in scope 0 at $DIR/issue-49232.rs:5:1: 15:2
let _2: i32; // in scope 0 at $DIR/issue-49232.rs:7:13: 7:19
let mut _3: bool; // in scope 0 at $DIR/issue-49232.rs:8:19: 8:23
let mut _4: !; // in scope 0 at $DIR/issue-49232.rs:10:25: 10:30
let _5: (); // in scope 0 at $DIR/issue-49232.rs:13:9: 13:22
let mut _6: &i32; // in scope 0 at $DIR/issue-49232.rs:13:14: 13:21
scope 1 {
debug beacon => _2; // in scope 1 at $DIR/issue-49232.rs:7:13: 7:19
}
bb0: {
goto -> bb1; // bb0[0]: scope 0 at $DIR/issue-49232.rs:6:5: 14:6
}
bb1: {
falseUnwind -> [real: bb3, cleanup: bb4]; // bb1[0]: scope 0 at $DIR/issue-49232.rs:6:5: 14:6
}
bb2: {
goto -> bb14; // bb2[0]: scope 0 at $DIR/issue-49232.rs:15:2: 15:2
}
bb3: {
StorageLive(_2); // bb3[0]: scope 0 at $DIR/issue-49232.rs:7:13: 7:19
StorageLive(_3); // bb3[1]: scope 0 at $DIR/issue-49232.rs:8:19: 8:23
_3 = const true; // bb3[2]: scope 0 at $DIR/issue-49232.rs:8:19: 8:23
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x01))
// mir::Constant
// + span: $DIR/issue-49232.rs:8:19: 8:23
// + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
FakeRead(ForMatchedPlace, _3); // bb3[3]: scope 0 at $DIR/issue-49232.rs:8:19: 8:23
switchInt(_3) -> [false: bb5, otherwise: bb6]; // bb3[4]: scope 0 at $DIR/issue-49232.rs:9:17: 9:22
}
bb4 (cleanup): {
resume; // bb4[0]: scope 0 at $DIR/issue-49232.rs:5:1: 15:2
}
bb5: {
falseEdges -> [real: bb7, imaginary: bb6]; // bb5[0]: scope 0 at $DIR/issue-49232.rs:9:17: 9:22
}
bb6: {
_0 = (); // bb6[0]: scope 0 at $DIR/issue-49232.rs:10:25: 10:30
goto -> bb8; // bb6[1]: scope 0 at $DIR/issue-49232.rs:10:25: 10:30
}
bb7: {
_2 = const 4i32; // bb7[0]: scope 0 at $DIR/issue-49232.rs:9:26: 9:27
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000004))
// mir::Constant
// + span: $DIR/issue-49232.rs:9:26: 9:27
// + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
goto -> bb12; // bb7[1]: scope 0 at $DIR/issue-49232.rs:8:13: 11:14
}
bb8: {
StorageDead(_3); // bb8[0]: scope 0 at $DIR/issue-49232.rs:12:10: 12:11
goto -> bb9; // bb8[1]: scope 0 at $DIR/issue-49232.rs:10:25: 10:30
}
bb9: {
StorageDead(_2); // bb9[0]: scope 0 at $DIR/issue-49232.rs:14:5: 14:6
goto -> bb2; // bb9[1]: scope 0 at $DIR/issue-49232.rs:10:25: 10:30
}
bb10: {
_4 = (); // bb10[0]: scope 0 at $DIR/issue-49232.rs:10:25: 10:30
unreachable; // bb10[1]: scope 0 at $DIR/issue-49232.rs:10:25: 10:30
}
bb11: {
goto -> bb12; // bb11[0]: scope 0 at $DIR/issue-49232.rs:8:13: 11:14
}
bb12: {
FakeRead(ForLet, _2); // bb12[0]: scope 0 at $DIR/issue-49232.rs:7:13: 7:19
StorageDead(_3); // bb12[1]: scope 0 at $DIR/issue-49232.rs:12:10: 12:11
StorageLive(_5); // bb12[2]: scope 1 at $DIR/issue-49232.rs:13:9: 13:22
StorageLive(_6); // bb12[3]: scope 1 at $DIR/issue-49232.rs:13:14: 13:21
_6 = &_2; // bb12[4]: scope 1 at $DIR/issue-49232.rs:13:14: 13:21
_5 = const std::mem::drop::<&i32>(move _6) -> [return: bb13, unwind: bb4]; // bb12[5]: scope 1 at $DIR/issue-49232.rs:13:9: 13:22
// ty::Const
// + ty: fn(&i32) {std::mem::drop::<&i32>}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/issue-49232.rs:13:9: 13:13
// + literal: Const { ty: fn(&i32) {std::mem::drop::<&i32>}, val: Value(Scalar(<ZST>)) }
}
bb13: {
StorageDead(_6); // bb13[0]: scope 1 at $DIR/issue-49232.rs:13:21: 13:22
StorageDead(_5); // bb13[1]: scope 1 at $DIR/issue-49232.rs:13:22: 13:23
_1 = (); // bb13[2]: scope 0 at $DIR/issue-49232.rs:6:10: 14:6
StorageDead(_2); // bb13[3]: scope 0 at $DIR/issue-49232.rs:14:5: 14:6
goto -> bb1; // bb13[4]: scope 0 at $DIR/issue-49232.rs:6:5: 14:6
}
bb14: {
return; // bb14[0]: scope 0 at $DIR/issue-49232.rs:15:2: 15:2
}
}
// check that we don't forget to drop the Box if we early return before
// initializing it
// ignore-tidy-linelength
// ignore-wasm32-bare compiled with panic=abort by default
#![feature(box_syntax)]
// EMIT_MIR rustc.test.ElaborateDrops.before.mir
fn test() -> Option<Box<u32>> {
Some(box (None?))
}
......@@ -12,80 +12,3 @@ fn test() -> Option<Box<u32>> {
fn main() {
test();
}
// END RUST SOURCE
// START rustc.test.ElaborateDrops.before.mir
// fn test() -> std::option::Option<std::boxed::Box<u32>> {
// ...
// bb0: {
// StorageLive(_1);
// StorageLive(_2);
// _2 = Box(u32);
// StorageLive(_3);
// StorageLive(_4);
// _4 = std::option::Option::<u32>::None;
// _3 = const <std::option::Option<u32> as std::ops::Try>::into_result(move _4) -> [return: bb2, unwind: bb3];
// }
// bb1 (cleanup): {
// resume;
// }
// bb2: {
// StorageDead(_4);
// _5 = discriminant(_3);
// switchInt(move _5) -> [0isize: bb4, 1isize: bb6, otherwise: bb5];
// }
// bb3 (cleanup): {
// drop(_2) -> bb1;
// }
// bb4: {
// StorageLive(_10);
// _10 = ((_3 as Ok).0: u32);
// (*_2) = _10;
// StorageDead(_10);
// _1 = move _2;
// drop(_2) -> [return: bb12, unwind: bb11];
// }
// bb5: {
// unreachable;
// }
// bb6: {
// StorageLive(_6);
// _6 = ((_3 as Err).0: std::option::NoneError);
// StorageLive(_8);
// StorageLive(_9);
// _9 = _6;
// _8 = const <std::option::NoneError as std::convert::From<std::option::NoneError>>::from(move _9) -> [return: bb8, unwind: bb3];
// }
// bb7: {
// return;
// }
// bb8: {
// StorageDead(_9);
// _0 = const <std::option::Option<std::boxed::Box<u32>> as std::ops::Try>::from_error(move _8) -> [return: bb9, unwind: bb3];
// }
// bb9: {
// StorageDead(_8);
// StorageDead(_6);
// drop(_2) -> bb10;
// }
// bb10: {
// StorageDead(_2);
// StorageDead(_1);
// StorageDead(_3);
// goto -> bb7;
// }
// bb11 (cleanup): {
// drop(_1) -> bb1;
// }
// bb12: {
// StorageDead(_2);
// _0 = std::option::Option::<std::boxed::Box<u32>>::Some(move _1,);
// drop(_1) -> bb13;
// }
// bb13: {
// StorageDead(_1);
// StorageDead(_3);
// goto -> bb7;
// }
// }
// END rustc.test.ElaborateDrops.before.mir
// MIR for `test` before ElaborateDrops
fn test() -> std::option::Option<std::boxed::Box<u32>> {
let mut _0: std::option::Option<std::boxed::Box<u32>>; // return place in scope 0 at $DIR/issue-62289.rs:8:14: 8:30
let mut _1: std::boxed::Box<u32>; // in scope 0 at $DIR/issue-62289.rs:9:10: 9:21
let mut _2: std::boxed::Box<u32>; // in scope 0 at $DIR/issue-62289.rs:9:10: 9:21
let mut _3: std::result::Result<u32, std::option::NoneError>; // in scope 0 at $DIR/issue-62289.rs:9:15: 9:20
let mut _4: std::option::Option<u32>; // in scope 0 at $DIR/issue-62289.rs:9:15: 9:19
let mut _5: isize; // in scope 0 at $DIR/issue-62289.rs:9:19: 9:20
let _6: std::option::NoneError; // in scope 0 at $DIR/issue-62289.rs:9:19: 9:20
let mut _7: !; // in scope 0 at $DIR/issue-62289.rs:9:19: 9:20
let mut _8: std::option::NoneError; // in scope 0 at $DIR/issue-62289.rs:9:19: 9:20
let mut _9: std::option::NoneError; // in scope 0 at $DIR/issue-62289.rs:9:19: 9:20
let _10: u32; // in scope 0 at $DIR/issue-62289.rs:9:15: 9:20
scope 1 {
debug err => _6; // in scope 1 at $DIR/issue-62289.rs:9:19: 9:20
scope 2 {
}
}
scope 3 {
debug val => _10; // in scope 3 at $DIR/issue-62289.rs:9:15: 9:20
scope 4 {
}
}
bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/issue-62289.rs:9:10: 9:21
StorageLive(_2); // bb0[1]: scope 0 at $DIR/issue-62289.rs:9:10: 9:21
_2 = Box(u32); // bb0[2]: scope 0 at $DIR/issue-62289.rs:9:10: 9:21
StorageLive(_3); // bb0[3]: scope 0 at $DIR/issue-62289.rs:9:15: 9:20
StorageLive(_4); // bb0[4]: scope 0 at $DIR/issue-62289.rs:9:15: 9:19
_4 = std::option::Option::<u32>::None; // bb0[5]: scope 0 at $DIR/issue-62289.rs:9:15: 9:19
_3 = const <std::option::Option<u32> as std::ops::Try>::into_result(move _4) -> [return: bb2, unwind: bb3]; // bb0[6]: scope 0 at $DIR/issue-62289.rs:9:15: 9:20
// ty::Const
// + ty: fn(std::option::Option<u32>) -> std::result::Result<<std::option::Option<u32> as std::ops::Try>::Ok, <std::option::Option<u32> as std::ops::Try>::Error> {<std::option::Option<u32> as std::ops::Try>::into_result}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/issue-62289.rs:9:15: 9:20
// + literal: Const { ty: fn(std::option::Option<u32>) -> std::result::Result<<std::option::Option<u32> as std::ops::Try>::Ok, <std::option::Option<u32> as std::ops::Try>::Error> {<std::option::Option<u32> as std::ops::Try>::into_result}, val: Value(Scalar(<ZST>)) }
}
bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/issue-62289.rs:8:1: 10:2
}
bb2: {
StorageDead(_4); // bb2[0]: scope 0 at $DIR/issue-62289.rs:9:19: 9:20
_5 = discriminant(_3); // bb2[1]: scope 0 at $DIR/issue-62289.rs:9:19: 9:20
switchInt(move _5) -> [0isize: bb4, 1isize: bb6, otherwise: bb5]; // bb2[2]: scope 0 at $DIR/issue-62289.rs:9:19: 9:20
}
bb3 (cleanup): {
drop(_2) -> bb1; // bb3[0]: scope 0 at $DIR/issue-62289.rs:9:20: 9:21
}
bb4: {
StorageLive(_10); // bb4[0]: scope 0 at $DIR/issue-62289.rs:9:15: 9:20
_10 = ((_3 as Ok).0: u32); // bb4[1]: scope 0 at $DIR/issue-62289.rs:9:15: 9:20
(*_2) = _10; // bb4[2]: scope 4 at $DIR/issue-62289.rs:9:15: 9:20
StorageDead(_10); // bb4[3]: scope 0 at $DIR/issue-62289.rs:9:19: 9:20
_1 = move _2; // bb4[4]: scope 0 at $DIR/issue-62289.rs:9:10: 9:21
drop(_2) -> [return: bb12, unwind: bb11]; // bb4[5]: scope 0 at $DIR/issue-62289.rs:9:20: 9:21
}
bb5: {
unreachable; // bb5[0]: scope 0 at $DIR/issue-62289.rs:9:15: 9:20
}
bb6: {
StorageLive(_6); // bb6[0]: scope 0 at $DIR/issue-62289.rs:9:19: 9:20
_6 = ((_3 as Err).0: std::option::NoneError); // bb6[1]: scope 0 at $DIR/issue-62289.rs:9:19: 9:20
StorageLive(_8); // bb6[2]: scope 2 at $DIR/issue-62289.rs:9:19: 9:20
StorageLive(_9); // bb6[3]: scope 2 at $DIR/issue-62289.rs:9:19: 9:20
_9 = _6; // bb6[4]: scope 2 at $DIR/issue-62289.rs:9:19: 9:20
_8 = const <std::option::NoneError as std::convert::From<std::option::NoneError>>::from(move _9) -> [return: bb8, unwind: bb3]; // bb6[5]: scope 2 at $DIR/issue-62289.rs:9:19: 9:20
// ty::Const
// + ty: fn(std::option::NoneError) -> std::option::NoneError {<std::option::NoneError as std::convert::From<std::option::NoneError>>::from}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/issue-62289.rs:9:19: 9:20
// + literal: Const { ty: fn(std::option::NoneError) -> std::option::NoneError {<std::option::NoneError as std::convert::From<std::option::NoneError>>::from}, val: Value(Scalar(<ZST>)) }
}
bb7: {
return; // bb7[0]: scope 0 at $DIR/issue-62289.rs:10:2: 10:2
}
bb8: {
StorageDead(_9); // bb8[0]: scope 2 at $DIR/issue-62289.rs:9:19: 9:20
_0 = const <std::option::Option<std::boxed::Box<u32>> as std::ops::Try>::from_error(move _8) -> [return: bb9, unwind: bb3]; // bb8[1]: scope 2 at $DIR/issue-62289.rs:9:19: 9:20
// ty::Const
// + ty: fn(<std::option::Option<std::boxed::Box<u32>> as std::ops::Try>::Error) -> std::option::Option<std::boxed::Box<u32>> {<std::option::Option<std::boxed::Box<u32>> as std::ops::Try>::from_error}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/issue-62289.rs:9:15: 9:20
// + literal: Const { ty: fn(<std::option::Option<std::boxed::Box<u32>> as std::ops::Try>::Error) -> std::option::Option<std::boxed::Box<u32>> {<std::option::Option<std::boxed::Box<u32>> as std::ops::Try>::from_error}, val: Value(Scalar(<ZST>)) }
}
bb9: {
StorageDead(_8); // bb9[0]: scope 2 at $DIR/issue-62289.rs:9:19: 9:20
StorageDead(_6); // bb9[1]: scope 0 at $DIR/issue-62289.rs:9:19: 9:20
drop(_2) -> bb10; // bb9[2]: scope 0 at $DIR/issue-62289.rs:9:20: 9:21
}
bb10: {
StorageDead(_2); // bb10[0]: scope 0 at $DIR/issue-62289.rs:9:20: 9:21
StorageDead(_1); // bb10[1]: scope 0 at $DIR/issue-62289.rs:9:21: 9:22
StorageDead(_3); // bb10[2]: scope 0 at $DIR/issue-62289.rs:10:1: 10:2
goto -> bb7; // bb10[3]: scope 0 at $DIR/issue-62289.rs:9:19: 9:20
}
bb11 (cleanup): {
drop(_1) -> bb1; // bb11[0]: scope 0 at $DIR/issue-62289.rs:9:21: 9:22
}
bb12: {
StorageDead(_2); // bb12[0]: scope 0 at $DIR/issue-62289.rs:9:20: 9:21
_0 = std::option::Option::<std::boxed::Box<u32>>::Some(move _1,); // bb12[1]: scope 0 at $DIR/issue-62289.rs:9:5: 9:22
drop(_1) -> bb13; // bb12[2]: scope 0 at $DIR/issue-62289.rs:9:21: 9:22
}
bb13: {
StorageDead(_1); // bb13[0]: scope 0 at $DIR/issue-62289.rs:9:21: 9:22
StorageDead(_3); // bb13[1]: scope 0 at $DIR/issue-62289.rs:10:1: 10:2
goto -> bb7; // bb13[2]: scope 0 at $DIR/issue-62289.rs:10:2: 10:2
}
}
......@@ -2,6 +2,7 @@
// Tests to make sure we correctly generate falseUnwind edges in loops
// EMIT_MIR rustc.main.SimplifyCfg-qualify-consts.after.mir
fn main() {
// Exit early at runtime. Since only care about the generated MIR
// and not the runtime behavior (which is exercised by other tests)
......@@ -14,31 +15,3 @@ fn main() {
continue;
}
}
// END RUST SOURCE
// START rustc.main.SimplifyCfg-qualify-consts.after.mir
// ...
// bb1 (cleanup): {
// resume;
// }
// ...
// bb3: { // Entry into the loop
// _1 = ();
// StorageDead(_2);
// StorageDead(_1);
// StorageLive(_4);
// goto -> bb5;
// }
// ...
// bb5: { // The loop_block
// falseUnwind -> [real: bb6, cleanup: bb1];
// }
// bb6: { // The loop body (body_block)
// StorageLive(_6);
// _6 = const 1i32;
// FakeRead(ForLet, _6);
// StorageDead(_6);
// goto -> bb5;
// }
// ...
// END rustc.main.SimplifyCfg-qualify-consts.after.mir
// MIR for `main` after SimplifyCfg-qualify-consts
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/loop_test.rs:6:11: 6:11
let _1: (); // in scope 0 at $DIR/loop_test.rs:10:5: 12:6
let mut _2: bool; // in scope 0 at $DIR/loop_test.rs:10:8: 10:12
let mut _3: !; // in scope 0 at $DIR/loop_test.rs:10:13: 12:6
let mut _4: !; // in scope 0 at $DIR/loop_test.rs:13:5: 16:6
let mut _5: (); // in scope 0 at $DIR/loop_test.rs:6:1: 17:2
let _6: i32; // in scope 0 at $DIR/loop_test.rs:14:13: 14:14
scope 1 {
debug x => _6; // in scope 1 at $DIR/loop_test.rs:14:13: 14:14
}
bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/loop_test.rs:10:5: 12:6
StorageLive(_2); // bb0[1]: scope 0 at $DIR/loop_test.rs:10:8: 10:12
_2 = const true; // bb0[2]: scope 0 at $DIR/loop_test.rs:10:8: 10:12
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x01))
// mir::Constant
// + span: $DIR/loop_test.rs:10:8: 10:12
// + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
FakeRead(ForMatchedPlace, _2); // bb0[3]: scope 0 at $DIR/loop_test.rs:10:8: 10:12
switchInt(_2) -> [false: bb3, otherwise: bb2]; // bb0[4]: scope 0 at $DIR/loop_test.rs:10:5: 12:6
}
bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/loop_test.rs:6:1: 17:2
}
bb2: {
falseEdges -> [real: bb4, imaginary: bb3]; // bb2[0]: scope 0 at $DIR/loop_test.rs:10:5: 12:6
}
bb3: {
_1 = (); // bb3[0]: scope 0 at $DIR/loop_test.rs:10:5: 12:6
StorageDead(_2); // bb3[1]: scope 0 at $DIR/loop_test.rs:12:5: 12:6
StorageDead(_1); // bb3[2]: scope 0 at $DIR/loop_test.rs:12:5: 12:6
StorageLive(_4); // bb3[3]: scope 0 at $DIR/loop_test.rs:13:5: 16:6
goto -> bb5; // bb3[4]: scope 0 at $DIR/loop_test.rs:13:5: 16:6
}
bb4: {
_0 = (); // bb4[0]: scope 0 at $DIR/loop_test.rs:11:9: 11:15
StorageDead(_2); // bb4[1]: scope 0 at $DIR/loop_test.rs:12:5: 12:6
StorageDead(_1); // bb4[2]: scope 0 at $DIR/loop_test.rs:12:5: 12:6
return; // bb4[3]: scope 0 at $DIR/loop_test.rs:17:2: 17:2
}
bb5: {
falseUnwind -> [real: bb6, cleanup: bb1]; // bb5[0]: scope 0 at $DIR/loop_test.rs:13:5: 16:6
}
bb6: {
StorageLive(_6); // bb6[0]: scope 0 at $DIR/loop_test.rs:14:13: 14:14
_6 = const 1i32; // bb6[1]: scope 0 at $DIR/loop_test.rs:14:17: 14:18
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000001))
// mir::Constant
// + span: $DIR/loop_test.rs:14:17: 14:18
// + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
FakeRead(ForLet, _6); // bb6[2]: scope 0 at $DIR/loop_test.rs:14:13: 14:14
StorageDead(_6); // bb6[3]: scope 0 at $DIR/loop_test.rs:16:5: 16:6
goto -> bb5; // bb6[4]: scope 0 at $DIR/loop_test.rs:15:9: 15:17
}
}
......@@ -8,6 +8,8 @@
// all of the bindings for that scope.
// * No drop flags are used.
// EMIT_MIR rustc.complicated_match.SimplifyCfg-initial.after.mir
// EMIT_MIR rustc.complicated_match.ElaborateDrops.after.mir
fn complicated_match(cond: bool, items: (bool, bool, String)) -> i32 {
match items {
(false, a, s) | (a, false, s) if if cond { return 3 } else { a } => 1,
......@@ -31,199 +33,3 @@ fn main() {
assert_eq!(complicated_match(cond, (items_1, items_2, String::new())), result,);
}
}
// END RUST SOURCE
// START rustc.complicated_match.SimplifyCfg-initial.after.mir
// let mut _0: i32;
// let mut _3: &bool; // Temp for fake borrow of `items.0`
// let mut _4: &bool; // Temp for fake borrow of `items.1`
// let _5: bool; // `a` in arm
// let _6: &bool; // `a` in guard
// let _7: std::string::String; // `s` in arm
// let _8: &std::string::String; // `s` in guard
// let mut _9: bool; // `if cond { return 3 } else { a }`
// let mut _10: bool; // `cond`
// let mut _11: !; // `return 3`
// let mut _12: bool; // `if cond { return 3 } else { a }`
// let mut _13: bool; // `cond`
// let mut _14: !; // `return 3`
// let _15: bool; // `b`
// let _16: std::string::String; // `t`
// scope 1 {
// debug a => _5;
// debug a => _6;
// debug s => _7;
// debug s => _8;
// }
// scope 2 {
// debug b => _15;
// debug t => _16;
// }
// bb0: {
// FakeRead(ForMatchedPlace, _2);
// switchInt((_2.0: bool)) -> [false: bb2, otherwise: bb3];
// }
// bb1 (cleanup): {
// resume;
// }
// bb2: { // pre-binding for arm 1 first pattern
// falseEdges -> [real: bb9, imaginary: bb4];
// }
// bb3: {
// switchInt((_2.1: bool)) -> [false: bb4, otherwise: bb5];
// }
// bb4: { // pre-binding for arm 1 second pattern
// falseEdges -> [real: bb18, imaginary: bb6];
// }
// bb5: {
// switchInt((_2.0: bool)) -> [false: bb7, otherwise: bb6];
// }
// bb6: { // pre-binding for arm 2 first pattern
// falseEdges -> [real: bb26, imaginary: bb7];
// }
// bb7: { // bindings for arm 2 - second pattern
// StorageLive(_15);
// _15 = (_2.1: bool);
// StorageLive(_16);
// _16 = move (_2.2: std::string::String);
// goto -> bb25;
// }
// bb8: { // arm 1
// _0 = const 1i32;
// drop(_7) -> [return: bb24, unwind: bb14];
// }
// bb9: { // guard - first time
// StorageLive(_6);
// _6 = &(_2.1: bool);
// StorageLive(_8);
// _8 = &(_2.2: std::string::String);
// _3 = &shallow (_2.0: bool);
// _4 = &shallow (_2.1: bool);
// StorageLive(_9);
// StorageLive(_10);
// _10 = _1;
// FakeRead(ForMatchedPlace, _10);
// switchInt(_10) -> [false: bb11, otherwise: bb10];
// }
// bb10: {
// falseEdges -> [real: bb12, imaginary: bb11];
// }
// bb11: { // `else` block - first time
// _9 = (*_6);
// StorageDead(_10);
// switchInt(move _9) -> [false: bb17, otherwise: bb16];
// }
// bb12: { // `return 3` - first time
// _0 = const 3i32;
// StorageDead(_10);
// StorageDead(_9);
// StorageDead(_8);
// StorageDead(_6);
// goto -> bb15;
// }
// bb13: {
// return;
// }
// bb14 (cleanup): {
// drop(_2) -> bb1;
// }
// bb15: {
// drop(_2) -> [return: bb13, unwind: bb1];
// }
// bb16: {
// StorageDead(_9);
// FakeRead(ForMatchGuard, _3);
// FakeRead(ForMatchGuard, _4);
// FakeRead(ForGuardBinding, _6);
// FakeRead(ForGuardBinding, _8);
// StorageLive(_5);
// _5 = (_2.1: bool);
// StorageLive(_7);
// _7 = move (_2.2: std::string::String);
// goto -> bb8;
// }
// bb17: { // guard otherwise case - first time
// StorageDead(_9);
// StorageDead(_8);
// StorageDead(_6);
// falseEdges -> [real: bb3, imaginary: bb4];
// }
// bb18: { // guard - second time
// StorageLive(_6);
// _6 = &(_2.0: bool);
// StorageLive(_8);
// _8 = &(_2.2: std::string::String);
// _3 = &shallow (_2.0: bool);
// _4 = &shallow (_2.1: bool);
// StorageLive(_12);
// StorageLive(_13);
// _13 = _1;
// FakeRead(ForMatchedPlace, _13);
// switchInt(_13) -> [false: bb20, otherwise: bb19];
// }
// bb19: {
// falseEdges -> [real: bb21, imaginary: bb20];
// }
// bb20: { // `else` block - second time
// _12 = (*_6);
// StorageDead(_13);
// switchInt(move _12) -> [false: bb23, otherwise: bb22];
// }
// bb21: {
// _0 = const 3i32;
// StorageDead(_13);
// StorageDead(_12);
// StorageDead(_8);
// StorageDead(_6);
// goto -> bb15;
// }
// bb22: { // bindings for arm 1
// StorageDead(_12);
// FakeRead(ForMatchGuard, _3);
// FakeRead(ForMatchGuard, _4);
// FakeRead(ForGuardBinding, _6);
// FakeRead(ForGuardBinding, _8);
// StorageLive(_5);
// _5 = (_2.0: bool);
// StorageLive(_7);
// _7 = move (_2.2: std::string::String);
// goto -> bb8;
// }
// bb23: { // Guard otherwise case - second time
// StorageDead(_12);
// StorageDead(_8);
// StorageDead(_6);
// falseEdges -> [real: bb5, imaginary: bb6];
// }
// bb24: { // rest of arm 1
// StorageDead(_7);
// StorageDead(_5);
// StorageDead(_8);
// StorageDead(_6);
// goto -> bb28;
// }
// bb25: { // arm 2
// _0 = const 2i32;
// drop(_16) -> [return: bb27, unwind: bb14];
// }
// bb26: { // bindings for arm 2 - first pattern
// StorageLive(_15);
// _15 = (_2.1: bool);
// StorageLive(_16);
// _16 = move (_2.2: std::string::String);
// goto -> bb25;
// }
// bb27: { // rest of arm 2
// StorageDead(_16);
// StorageDead(_15);
// goto -> bb28;
// }
// bb28: {
// drop(_2) -> [return: bb13, unwind: bb1];
// }
// END rustc.complicated_match.SimplifyCfg-initial.after.mir
// START rustc.complicated_match.ElaborateDrops.after.mir
// let _16: std::string::String; // No drop flags, which would come after this.
// scope 1 {
// END rustc.complicated_match.ElaborateDrops.after.mir
// MIR for `complicated_match` after ElaborateDrops
fn complicated_match(_1: bool, _2: (bool, bool, std::string::String)) -> i32 {
debug cond => _1; // in scope 0 at $DIR/match-arm-scopes.rs:13:22: 13:26
debug items => _2; // in scope 0 at $DIR/match-arm-scopes.rs:13:34: 13:39
let mut _0: i32; // return place in scope 0 at $DIR/match-arm-scopes.rs:13:66: 13:69
let mut _3: &bool; // in scope 0 at $DIR/match-arm-scopes.rs:14:11: 14:16
let mut _4: &bool; // in scope 0 at $DIR/match-arm-scopes.rs:14:11: 14:16
let _5: bool; // in scope 0 at $DIR/match-arm-scopes.rs:15:17: 15:18
let _6: &bool; // in scope 0 at $DIR/match-arm-scopes.rs:15:17: 15:18
let _7: std::string::String; // in scope 0 at $DIR/match-arm-scopes.rs:15:20: 15:21
let _8: &std::string::String; // in scope 0 at $DIR/match-arm-scopes.rs:15:20: 15:21
let mut _9: bool; // in scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73
let mut _10: bool; // in scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49
let mut _11: !; // in scope 0 at $DIR/match-arm-scopes.rs:15:52: 15:60
let mut _12: bool; // in scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73
let mut _13: bool; // in scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49
let mut _14: !; // in scope 0 at $DIR/match-arm-scopes.rs:15:52: 15:60
let _15: bool; // in scope 0 at $DIR/match-arm-scopes.rs:16:16: 16:17
let _16: std::string::String; // in scope 0 at $DIR/match-arm-scopes.rs:16:19: 16:20
scope 1 {
debug a => _5; // in scope 1 at $DIR/match-arm-scopes.rs:15:17: 15:18
debug a => _6; // in scope 1 at $DIR/match-arm-scopes.rs:15:17: 15:18
debug s => _7; // in scope 1 at $DIR/match-arm-scopes.rs:15:20: 15:21
debug s => _8; // in scope 1 at $DIR/match-arm-scopes.rs:15:20: 15:21
}
scope 2 {
debug b => _15; // in scope 2 at $DIR/match-arm-scopes.rs:16:16: 16:17
debug t => _16; // in scope 2 at $DIR/match-arm-scopes.rs:16:19: 16:20
}
bb0: {
switchInt((_2.0: bool)) -> [false: bb6, otherwise: bb2]; // bb0[0]: scope 0 at $DIR/match-arm-scopes.rs:15:10: 15:15
}
bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/match-arm-scopes.rs:13:1: 18:2
}
bb2: {
switchInt((_2.1: bool)) -> [false: bb14, otherwise: bb3]; // bb2[0]: scope 0 at $DIR/match-arm-scopes.rs:15:29: 15:34
}
bb3: {
switchInt((_2.0: bool)) -> [false: bb4, otherwise: bb21]; // bb3[0]: scope 0 at $DIR/match-arm-scopes.rs:16:10: 16:14
}
bb4: {
StorageLive(_15); // bb4[0]: scope 0 at $DIR/match-arm-scopes.rs:16:32: 16:33
_15 = (_2.1: bool); // bb4[1]: scope 0 at $DIR/match-arm-scopes.rs:16:32: 16:33
StorageLive(_16); // bb4[2]: scope 0 at $DIR/match-arm-scopes.rs:16:35: 16:36
_16 = move (_2.2: std::string::String); // bb4[3]: scope 0 at $DIR/match-arm-scopes.rs:16:35: 16:36
goto -> bb20; // bb4[4]: scope 0 at $DIR/match-arm-scopes.rs:14:5: 17:6
}
bb5: {
_0 = const 1i32; // bb5[0]: scope 1 at $DIR/match-arm-scopes.rs:15:77: 15:78
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000001))
// mir::Constant
// + span: $DIR/match-arm-scopes.rs:15:77: 15:78
// + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
drop(_7) -> [return: bb19, unwind: bb10]; // bb5[1]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
}
bb6: {
StorageLive(_6); // bb6[0]: scope 0 at $DIR/match-arm-scopes.rs:15:17: 15:18
_6 = &(_2.1: bool); // bb6[1]: scope 0 at $DIR/match-arm-scopes.rs:15:17: 15:18
StorageLive(_8); // bb6[2]: scope 0 at $DIR/match-arm-scopes.rs:15:20: 15:21
_8 = &(_2.2: std::string::String); // bb6[3]: scope 0 at $DIR/match-arm-scopes.rs:15:20: 15:21
StorageLive(_9); // bb6[4]: scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73
StorageLive(_10); // bb6[5]: scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49
_10 = _1; // bb6[6]: scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49
switchInt(_10) -> [false: bb7, otherwise: bb8]; // bb6[7]: scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73
}
bb7: {
_9 = (*_6); // bb7[0]: scope 0 at $DIR/match-arm-scopes.rs:15:70: 15:71
StorageDead(_10); // bb7[1]: scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73
switchInt(move _9) -> [false: bb13, otherwise: bb12]; // bb7[2]: scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73
}
bb8: {
_0 = const 3i32; // bb8[0]: scope 0 at $DIR/match-arm-scopes.rs:15:59: 15:60
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000003))
// mir::Constant
// + span: $DIR/match-arm-scopes.rs:15:59: 15:60
// + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
StorageDead(_10); // bb8[1]: scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73
StorageDead(_9); // bb8[2]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageDead(_8); // bb8[3]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageDead(_6); // bb8[4]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
goto -> bb11; // bb8[5]: scope 0 at $DIR/match-arm-scopes.rs:15:52: 15:60
}
bb9: {
return; // bb9[0]: scope 0 at $DIR/match-arm-scopes.rs:18:2: 18:2
}
bb10 (cleanup): {
goto -> bb25; // bb10[0]: scope 0 at $DIR/match-arm-scopes.rs:18:1: 18:2
}
bb11: {
drop(_2) -> [return: bb9, unwind: bb1]; // bb11[0]: scope 0 at $DIR/match-arm-scopes.rs:18:1: 18:2
}
bb12: {
StorageDead(_9); // bb12[0]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageLive(_5); // bb12[1]: scope 0 at $DIR/match-arm-scopes.rs:15:17: 15:18
_5 = (_2.1: bool); // bb12[2]: scope 0 at $DIR/match-arm-scopes.rs:15:17: 15:18
StorageLive(_7); // bb12[3]: scope 0 at $DIR/match-arm-scopes.rs:15:20: 15:21
_7 = move (_2.2: std::string::String); // bb12[4]: scope 0 at $DIR/match-arm-scopes.rs:15:20: 15:21
goto -> bb5; // bb12[5]: scope 0 at $DIR/match-arm-scopes.rs:14:5: 17:6
}
bb13: {
StorageDead(_9); // bb13[0]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageDead(_8); // bb13[1]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageDead(_6); // bb13[2]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
goto -> bb2; // bb13[3]: scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73
}
bb14: {
StorageLive(_6); // bb14[0]: scope 0 at $DIR/match-arm-scopes.rs:15:26: 15:27
_6 = &(_2.0: bool); // bb14[1]: scope 0 at $DIR/match-arm-scopes.rs:15:26: 15:27
StorageLive(_8); // bb14[2]: scope 0 at $DIR/match-arm-scopes.rs:15:36: 15:37
_8 = &(_2.2: std::string::String); // bb14[3]: scope 0 at $DIR/match-arm-scopes.rs:15:36: 15:37
StorageLive(_12); // bb14[4]: scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73
StorageLive(_13); // bb14[5]: scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49
_13 = _1; // bb14[6]: scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49
switchInt(_13) -> [false: bb15, otherwise: bb16]; // bb14[7]: scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73
}
bb15: {
_12 = (*_6); // bb15[0]: scope 0 at $DIR/match-arm-scopes.rs:15:70: 15:71
StorageDead(_13); // bb15[1]: scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73
switchInt(move _12) -> [false: bb18, otherwise: bb17]; // bb15[2]: scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73
}
bb16: {
_0 = const 3i32; // bb16[0]: scope 0 at $DIR/match-arm-scopes.rs:15:59: 15:60
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000003))
// mir::Constant
// + span: $DIR/match-arm-scopes.rs:15:59: 15:60
// + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
StorageDead(_13); // bb16[1]: scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73
StorageDead(_12); // bb16[2]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageDead(_8); // bb16[3]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageDead(_6); // bb16[4]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
goto -> bb11; // bb16[5]: scope 0 at $DIR/match-arm-scopes.rs:15:52: 15:60
}
bb17: {
StorageDead(_12); // bb17[0]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageLive(_5); // bb17[1]: scope 0 at $DIR/match-arm-scopes.rs:15:26: 15:27
_5 = (_2.0: bool); // bb17[2]: scope 0 at $DIR/match-arm-scopes.rs:15:26: 15:27
StorageLive(_7); // bb17[3]: scope 0 at $DIR/match-arm-scopes.rs:15:36: 15:37
_7 = move (_2.2: std::string::String); // bb17[4]: scope 0 at $DIR/match-arm-scopes.rs:15:36: 15:37
goto -> bb5; // bb17[5]: scope 0 at $DIR/match-arm-scopes.rs:14:5: 17:6
}
bb18: {
StorageDead(_12); // bb18[0]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageDead(_8); // bb18[1]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageDead(_6); // bb18[2]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
goto -> bb3; // bb18[3]: scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73
}
bb19: {
StorageDead(_7); // bb19[0]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageDead(_5); // bb19[1]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageDead(_8); // bb19[2]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageDead(_6); // bb19[3]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
goto -> bb23; // bb19[4]: scope 0 at $DIR/match-arm-scopes.rs:14:5: 17:6
}
bb20: {
_0 = const 2i32; // bb20[0]: scope 2 at $DIR/match-arm-scopes.rs:16:41: 16:42
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000002))
// mir::Constant
// + span: $DIR/match-arm-scopes.rs:16:41: 16:42
// + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
drop(_16) -> [return: bb22, unwind: bb10]; // bb20[1]: scope 0 at $DIR/match-arm-scopes.rs:16:42: 16:43
}
bb21: {
StorageLive(_15); // bb21[0]: scope 0 at $DIR/match-arm-scopes.rs:16:16: 16:17
_15 = (_2.1: bool); // bb21[1]: scope 0 at $DIR/match-arm-scopes.rs:16:16: 16:17
StorageLive(_16); // bb21[2]: scope 0 at $DIR/match-arm-scopes.rs:16:19: 16:20
_16 = move (_2.2: std::string::String); // bb21[3]: scope 0 at $DIR/match-arm-scopes.rs:16:19: 16:20
goto -> bb20; // bb21[4]: scope 0 at $DIR/match-arm-scopes.rs:14:5: 17:6
}
bb22: {
StorageDead(_16); // bb22[0]: scope 0 at $DIR/match-arm-scopes.rs:16:42: 16:43
StorageDead(_15); // bb22[1]: scope 0 at $DIR/match-arm-scopes.rs:16:42: 16:43
goto -> bb23; // bb22[2]: scope 0 at $DIR/match-arm-scopes.rs:14:5: 17:6
}
bb23: {
goto -> bb29; // bb23[0]: scope 0 at $DIR/match-arm-scopes.rs:18:1: 18:2
}
bb24 (cleanup): {
goto -> bb1; // bb24[0]: scope 0 at $DIR/match-arm-scopes.rs:18:1: 18:2
}
bb25 (cleanup): {
goto -> bb24; // bb25[0]: scope 0 at $DIR/match-arm-scopes.rs:18:1: 18:2
}
bb26: {
goto -> bb9; // bb26[0]: scope 0 at $DIR/match-arm-scopes.rs:18:1: 18:2
}
bb27 (cleanup): {
goto -> bb1; // bb27[0]: scope 0 at $DIR/match-arm-scopes.rs:18:1: 18:2
}
bb28 (cleanup): {
goto -> bb27; // bb28[0]: scope 0 at $DIR/match-arm-scopes.rs:18:1: 18:2
}
bb29: {
goto -> bb26; // bb29[0]: scope 0 at $DIR/match-arm-scopes.rs:18:1: 18:2
}
}
// MIR for `complicated_match` after SimplifyCfg-initial
fn complicated_match(_1: bool, _2: (bool, bool, std::string::String)) -> i32 {
debug cond => _1; // in scope 0 at $DIR/match-arm-scopes.rs:13:22: 13:26
debug items => _2; // in scope 0 at $DIR/match-arm-scopes.rs:13:34: 13:39
let mut _0: i32; // return place in scope 0 at $DIR/match-arm-scopes.rs:13:66: 13:69
let mut _3: &bool; // in scope 0 at $DIR/match-arm-scopes.rs:14:11: 14:16
let mut _4: &bool; // in scope 0 at $DIR/match-arm-scopes.rs:14:11: 14:16
let _5: bool; // in scope 0 at $DIR/match-arm-scopes.rs:15:17: 15:18
let _6: &bool; // in scope 0 at $DIR/match-arm-scopes.rs:15:17: 15:18
let _7: std::string::String; // in scope 0 at $DIR/match-arm-scopes.rs:15:20: 15:21
let _8: &std::string::String; // in scope 0 at $DIR/match-arm-scopes.rs:15:20: 15:21
let mut _9: bool; // in scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73
let mut _10: bool; // in scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49
let mut _11: !; // in scope 0 at $DIR/match-arm-scopes.rs:15:52: 15:60
let mut _12: bool; // in scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73
let mut _13: bool; // in scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49
let mut _14: !; // in scope 0 at $DIR/match-arm-scopes.rs:15:52: 15:60
let _15: bool; // in scope 0 at $DIR/match-arm-scopes.rs:16:16: 16:17
let _16: std::string::String; // in scope 0 at $DIR/match-arm-scopes.rs:16:19: 16:20
scope 1 {
debug a => _5; // in scope 1 at $DIR/match-arm-scopes.rs:15:17: 15:18
debug a => _6; // in scope 1 at $DIR/match-arm-scopes.rs:15:17: 15:18
debug s => _7; // in scope 1 at $DIR/match-arm-scopes.rs:15:20: 15:21
debug s => _8; // in scope 1 at $DIR/match-arm-scopes.rs:15:20: 15:21
}
scope 2 {
debug b => _15; // in scope 2 at $DIR/match-arm-scopes.rs:16:16: 16:17
debug t => _16; // in scope 2 at $DIR/match-arm-scopes.rs:16:19: 16:20
}
bb0: {
FakeRead(ForMatchedPlace, _2); // bb0[0]: scope 0 at $DIR/match-arm-scopes.rs:14:11: 14:16
switchInt((_2.0: bool)) -> [false: bb2, otherwise: bb3]; // bb0[1]: scope 0 at $DIR/match-arm-scopes.rs:15:10: 15:15
}
bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/match-arm-scopes.rs:13:1: 18:2
}
bb2: {
falseEdges -> [real: bb9, imaginary: bb4]; // bb2[0]: scope 0 at $DIR/match-arm-scopes.rs:15:9: 15:22
}
bb3: {
switchInt((_2.1: bool)) -> [false: bb4, otherwise: bb5]; // bb3[0]: scope 0 at $DIR/match-arm-scopes.rs:15:29: 15:34
}
bb4: {
falseEdges -> [real: bb18, imaginary: bb6]; // bb4[0]: scope 0 at $DIR/match-arm-scopes.rs:15:25: 15:38
}
bb5: {
switchInt((_2.0: bool)) -> [false: bb7, otherwise: bb6]; // bb5[0]: scope 0 at $DIR/match-arm-scopes.rs:16:10: 16:14
}
bb6: {
falseEdges -> [real: bb26, imaginary: bb7]; // bb6[0]: scope 0 at $DIR/match-arm-scopes.rs:16:9: 16:21
}
bb7: {
StorageLive(_15); // bb7[0]: scope 0 at $DIR/match-arm-scopes.rs:16:32: 16:33
_15 = (_2.1: bool); // bb7[1]: scope 0 at $DIR/match-arm-scopes.rs:16:32: 16:33
StorageLive(_16); // bb7[2]: scope 0 at $DIR/match-arm-scopes.rs:16:35: 16:36
_16 = move (_2.2: std::string::String); // bb7[3]: scope 0 at $DIR/match-arm-scopes.rs:16:35: 16:36
goto -> bb25; // bb7[4]: scope 0 at $DIR/match-arm-scopes.rs:14:5: 17:6
}
bb8: {
_0 = const 1i32; // bb8[0]: scope 1 at $DIR/match-arm-scopes.rs:15:77: 15:78
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000001))
// mir::Constant
// + span: $DIR/match-arm-scopes.rs:15:77: 15:78
// + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
drop(_7) -> [return: bb24, unwind: bb14]; // bb8[1]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
}
bb9: {
StorageLive(_6); // bb9[0]: scope 0 at $DIR/match-arm-scopes.rs:15:17: 15:18
_6 = &(_2.1: bool); // bb9[1]: scope 0 at $DIR/match-arm-scopes.rs:15:17: 15:18
StorageLive(_8); // bb9[2]: scope 0 at $DIR/match-arm-scopes.rs:15:20: 15:21
_8 = &(_2.2: std::string::String); // bb9[3]: scope 0 at $DIR/match-arm-scopes.rs:15:20: 15:21
_3 = &shallow (_2.0: bool); // bb9[4]: scope 0 at $DIR/match-arm-scopes.rs:14:11: 14:16
_4 = &shallow (_2.1: bool); // bb9[5]: scope 0 at $DIR/match-arm-scopes.rs:14:11: 14:16
StorageLive(_9); // bb9[6]: scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73
StorageLive(_10); // bb9[7]: scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49
_10 = _1; // bb9[8]: scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49
FakeRead(ForMatchedPlace, _10); // bb9[9]: scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49
switchInt(_10) -> [false: bb11, otherwise: bb10]; // bb9[10]: scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73
}
bb10: {
falseEdges -> [real: bb12, imaginary: bb11]; // bb10[0]: scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73
}
bb11: {
_9 = (*_6); // bb11[0]: scope 0 at $DIR/match-arm-scopes.rs:15:70: 15:71
StorageDead(_10); // bb11[1]: scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73
switchInt(move _9) -> [false: bb17, otherwise: bb16]; // bb11[2]: scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73
}
bb12: {
_0 = const 3i32; // bb12[0]: scope 0 at $DIR/match-arm-scopes.rs:15:59: 15:60
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000003))
// mir::Constant
// + span: $DIR/match-arm-scopes.rs:15:59: 15:60
// + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
StorageDead(_10); // bb12[1]: scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73
StorageDead(_9); // bb12[2]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageDead(_8); // bb12[3]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageDead(_6); // bb12[4]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
goto -> bb15; // bb12[5]: scope 0 at $DIR/match-arm-scopes.rs:15:52: 15:60
}
bb13: {
return; // bb13[0]: scope 0 at $DIR/match-arm-scopes.rs:18:2: 18:2
}
bb14 (cleanup): {
drop(_2) -> bb1; // bb14[0]: scope 0 at $DIR/match-arm-scopes.rs:18:1: 18:2
}
bb15: {
drop(_2) -> [return: bb13, unwind: bb1]; // bb15[0]: scope 0 at $DIR/match-arm-scopes.rs:18:1: 18:2
}
bb16: {
StorageDead(_9); // bb16[0]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
FakeRead(ForMatchGuard, _3); // bb16[1]: scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73
FakeRead(ForMatchGuard, _4); // bb16[2]: scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73
FakeRead(ForGuardBinding, _6); // bb16[3]: scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73
FakeRead(ForGuardBinding, _8); // bb16[4]: scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73
StorageLive(_5); // bb16[5]: scope 0 at $DIR/match-arm-scopes.rs:15:17: 15:18
_5 = (_2.1: bool); // bb16[6]: scope 0 at $DIR/match-arm-scopes.rs:15:17: 15:18
StorageLive(_7); // bb16[7]: scope 0 at $DIR/match-arm-scopes.rs:15:20: 15:21
_7 = move (_2.2: std::string::String); // bb16[8]: scope 0 at $DIR/match-arm-scopes.rs:15:20: 15:21
goto -> bb8; // bb16[9]: scope 0 at $DIR/match-arm-scopes.rs:14:5: 17:6
}
bb17: {
StorageDead(_9); // bb17[0]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageDead(_8); // bb17[1]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageDead(_6); // bb17[2]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
falseEdges -> [real: bb3, imaginary: bb4]; // bb17[3]: scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73
}
bb18: {
StorageLive(_6); // bb18[0]: scope 0 at $DIR/match-arm-scopes.rs:15:26: 15:27
_6 = &(_2.0: bool); // bb18[1]: scope 0 at $DIR/match-arm-scopes.rs:15:26: 15:27
StorageLive(_8); // bb18[2]: scope 0 at $DIR/match-arm-scopes.rs:15:36: 15:37
_8 = &(_2.2: std::string::String); // bb18[3]: scope 0 at $DIR/match-arm-scopes.rs:15:36: 15:37
_3 = &shallow (_2.0: bool); // bb18[4]: scope 0 at $DIR/match-arm-scopes.rs:14:11: 14:16
_4 = &shallow (_2.1: bool); // bb18[5]: scope 0 at $DIR/match-arm-scopes.rs:14:11: 14:16
StorageLive(_12); // bb18[6]: scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73
StorageLive(_13); // bb18[7]: scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49
_13 = _1; // bb18[8]: scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49
FakeRead(ForMatchedPlace, _13); // bb18[9]: scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49
switchInt(_13) -> [false: bb20, otherwise: bb19]; // bb18[10]: scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73
}
bb19: {
falseEdges -> [real: bb21, imaginary: bb20]; // bb19[0]: scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73
}
bb20: {
_12 = (*_6); // bb20[0]: scope 0 at $DIR/match-arm-scopes.rs:15:70: 15:71
StorageDead(_13); // bb20[1]: scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73
switchInt(move _12) -> [false: bb23, otherwise: bb22]; // bb20[2]: scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73
}
bb21: {
_0 = const 3i32; // bb21[0]: scope 0 at $DIR/match-arm-scopes.rs:15:59: 15:60
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000003))
// mir::Constant
// + span: $DIR/match-arm-scopes.rs:15:59: 15:60
// + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
StorageDead(_13); // bb21[1]: scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73
StorageDead(_12); // bb21[2]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageDead(_8); // bb21[3]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageDead(_6); // bb21[4]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
goto -> bb15; // bb21[5]: scope 0 at $DIR/match-arm-scopes.rs:15:52: 15:60
}
bb22: {
StorageDead(_12); // bb22[0]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
FakeRead(ForMatchGuard, _3); // bb22[1]: scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73
FakeRead(ForMatchGuard, _4); // bb22[2]: scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73
FakeRead(ForGuardBinding, _6); // bb22[3]: scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73
FakeRead(ForGuardBinding, _8); // bb22[4]: scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73
StorageLive(_5); // bb22[5]: scope 0 at $DIR/match-arm-scopes.rs:15:26: 15:27
_5 = (_2.0: bool); // bb22[6]: scope 0 at $DIR/match-arm-scopes.rs:15:26: 15:27
StorageLive(_7); // bb22[7]: scope 0 at $DIR/match-arm-scopes.rs:15:36: 15:37
_7 = move (_2.2: std::string::String); // bb22[8]: scope 0 at $DIR/match-arm-scopes.rs:15:36: 15:37
goto -> bb8; // bb22[9]: scope 0 at $DIR/match-arm-scopes.rs:14:5: 17:6
}
bb23: {
StorageDead(_12); // bb23[0]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageDead(_8); // bb23[1]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageDead(_6); // bb23[2]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
falseEdges -> [real: bb5, imaginary: bb6]; // bb23[3]: scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73
}
bb24: {
StorageDead(_7); // bb24[0]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageDead(_5); // bb24[1]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageDead(_8); // bb24[2]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
StorageDead(_6); // bb24[3]: scope 0 at $DIR/match-arm-scopes.rs:15:78: 15:79
goto -> bb28; // bb24[4]: scope 0 at $DIR/match-arm-scopes.rs:14:5: 17:6
}
bb25: {
_0 = const 2i32; // bb25[0]: scope 2 at $DIR/match-arm-scopes.rs:16:41: 16:42
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000002))
// mir::Constant
// + span: $DIR/match-arm-scopes.rs:16:41: 16:42
// + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
drop(_16) -> [return: bb27, unwind: bb14]; // bb25[1]: scope 0 at $DIR/match-arm-scopes.rs:16:42: 16:43
}
bb26: {
StorageLive(_15); // bb26[0]: scope 0 at $DIR/match-arm-scopes.rs:16:16: 16:17
_15 = (_2.1: bool); // bb26[1]: scope 0 at $DIR/match-arm-scopes.rs:16:16: 16:17
StorageLive(_16); // bb26[2]: scope 0 at $DIR/match-arm-scopes.rs:16:19: 16:20
_16 = move (_2.2: std::string::String); // bb26[3]: scope 0 at $DIR/match-arm-scopes.rs:16:19: 16:20
goto -> bb25; // bb26[4]: scope 0 at $DIR/match-arm-scopes.rs:14:5: 17:6
}
bb27: {
StorageDead(_16); // bb27[0]: scope 0 at $DIR/match-arm-scopes.rs:16:42: 16:43
StorageDead(_15); // bb27[1]: scope 0 at $DIR/match-arm-scopes.rs:16:42: 16:43
goto -> bb28; // bb27[2]: scope 0 at $DIR/match-arm-scopes.rs:14:5: 17:6
}
bb28: {
drop(_2) -> [return: bb13, unwind: bb1]; // bb28[0]: scope 0 at $DIR/match-arm-scopes.rs:18:1: 18:2
}
}
......@@ -10,6 +10,7 @@ fn guard2(_: i32) -> bool {
// no_mangle to make sure this gets instantiated even in an executable.
#[no_mangle]
// EMIT_MIR rustc.full_tested_match.PromoteTemps.after.mir
pub fn full_tested_match() {
let _ = match Some(42) {
Some(x) if guard() => (1, x),
......@@ -20,6 +21,7 @@ pub fn full_tested_match() {
// no_mangle to make sure this gets instantiated even in an executable.
#[no_mangle]
// EMIT_MIR rustc.full_tested_match2.PromoteTemps.before.mir
pub fn full_tested_match2() {
let _ = match Some(42) {
Some(x) if guard() => (1, x),
......@@ -28,6 +30,7 @@ pub fn full_tested_match2() {
};
}
// EMIT_MIR rustc.main.PromoteTemps.before.mir
fn main() {
let _ = match Some(1) {
Some(_w) if guard() => 1,
......@@ -36,245 +39,3 @@ fn main() {
_z => 4,
};
}
// END RUST SOURCE
//
// START rustc.full_tested_match.PromoteTemps.after.mir
// bb0: {
// ...
// _2 = std::option::Option::<i32>::Some(const 42i32,);
// FakeRead(ForMatchedPlace, _2);
// _3 = discriminant(_2);
// switchInt(move _3) -> [0isize: bb2, 1isize: bb3, otherwise: bb5];
// }
// bb1 (cleanup): {
// resume;
// }
// bb2: { // pre_binding3 and arm3
// _1 = (const 3i32, const 3i32);
// goto -> bb11;
// }
// bb3: {
// falseEdges -> [real: bb6, imaginary: bb4]; //pre_binding1
// }
// bb4: {
// falseEdges -> [real: bb10, imaginary: bb2]; //pre_binding2
// }
// bb5: {
// unreachable;
// }
// bb6: { // binding1 and guard
// StorageLive(_6);
// _11 = const full_tested_match::promoted[0];
// _6 = &(((*_11) as Some).0: i32);
// _4 = &shallow _2;
// StorageLive(_7);
// _7 = const guard() -> [return: bb7, unwind: bb1];
// }
// bb7: { // end of guard
// switchInt(move _7) -> [false: bb9, otherwise: bb8];
// }
// bb8: { // arm1
// StorageDead(_7);
// FakeRead(ForMatchGuard, _4);
// FakeRead(ForGuardBinding, _6);
// StorageLive(_5);
// _5 = ((_2 as Some).0: i32);
// StorageLive(_8);
// _8 = _5;
// _1 = (const 1i32, move _8);
// StorageDead(_8);
// StorageDead(_5);
// StorageDead(_6);
// goto -> bb11;
// }
// bb9: { // to pre_binding2
// StorageDead(_7);
// StorageDead(_6);
// goto -> bb4;
// }
// bb10: { // arm2
// StorageLive(_9);
// _9 = ((_2 as Some).0: i32);
// StorageLive(_10);
// _10 = _9;
// _1 = (const 2i32, move _10);
// StorageDead(_10);
// StorageDead(_9);
// goto -> bb11;
// }
// bb11: {
// StorageDead(_2);
// StorageDead(_1);
// _0 = ();
// return;
// }
// END rustc.full_tested_match.PromoteTemps.after.mir
//
// START rustc.full_tested_match2.PromoteTemps.before.mir
// bb0: {
// ...
// _2 = std::option::Option::<i32>::Some(const 42i32,);
// FakeRead(ForMatchedPlace, _2);
// _3 = discriminant(_2);
// switchInt(move _3) -> [0isize: bb2, 1isize: bb3, otherwise: bb5];
// }
// bb1 (cleanup): {
// resume;
// }
// bb2: { // pre_binding2
// falseEdges -> [real: bb10, imaginary: bb4];
// }
// bb3: { // pre_binding1
// falseEdges -> [real: bb6, imaginary: bb2];
// }
// bb4: { // binding3 and arm3
// StorageLive(_9);
// _9 = ((_2 as Some).0: i32);
// StorageLive(_10);
// _10 = _9;
// _1 = (const 2i32, move _10);
// StorageDead(_10);
// StorageDead(_9);
// goto -> bb11;
// }
// bb5: {
// unreachable;
// }
// bb6: {
// StorageLive(_6);
// _6 = &((_2 as Some).0: i32);
// _4 = &shallow _2;
// StorageLive(_7);
// _7 = const guard() -> [return: bb7, unwind: bb1];
// }
// bb7: { // end of guard
// switchInt(move _7) -> [false: bb9, otherwise: bb8];
// }
// bb8: {
// StorageDead(_7);
// FakeRead(ForMatchGuard, _4);
// FakeRead(ForGuardBinding, _6);
// StorageLive(_5);
// _5 = ((_2 as Some).0: i32);
// StorageLive(_8);
// _8 = _5;
// _1 = (const 1i32, move _8);
// StorageDead(_8);
// StorageDead(_5);
// StorageDead(_6);
// goto -> bb11;
// }
// bb9: { // to pre_binding3 (can skip 2 since this is `Some`)
// StorageDead(_7);
// StorageDead(_6);
// falseEdges -> [real: bb4, imaginary: bb2];
// }
// bb10: { // arm2
// _1 = (const 3i32, const 3i32);
// goto -> bb11;
// }
// bb11: {
// StorageDead(_2);
// StorageDead(_1);
// _0 = ();
// return;
// }
// END rustc.full_tested_match2.PromoteTemps.before.mir
//
// START rustc.main.PromoteTemps.before.mir
// bb0: {
// ...
// _2 = std::option::Option::<i32>::Some(const 1i32,);
// FakeRead(ForMatchedPlace, _2);
// _4 = discriminant(_2);
// switchInt(move _4) -> [1isize: bb3, otherwise: bb2];
// }
// bb1 (cleanup): {
// resume;
// }
// bb2: {
// falseEdges -> [real: bb10, imaginary: bb5];
// }
// bb3: {
// falseEdges -> [real: bb6, imaginary: bb2];
// }
// bb4: {
// StorageLive(_14);
// _14 = _2;
// _1 = const 4i32;
// StorageDead(_14);
// goto -> bb15;
// }
// bb5: {
// falseEdges -> [real: bb11, imaginary: bb4];
// }
// bb6: { //end of guard1
// StorageLive(_7);
// _7 = &((_2 as Some).0: i32);
// _5 = &shallow _2;
// StorageLive(_8);
// _8 = const guard() -> [return: bb7, unwind: bb1];
// }
// bb7: {
// switchInt(move _8) -> [false: bb9, otherwise: bb8];
// }
// bb8: {
// StorageDead(_8);
// FakeRead(ForMatchGuard, _5);
// FakeRead(ForGuardBinding, _7);
// StorageLive(_6);
// _6 = ((_2 as Some).0: i32);
// _1 = const 1i32;
// StorageDead(_6);
// StorageDead(_7);
// goto -> bb15;
// }
// bb9: {
// StorageDead(_8);
// StorageDead(_7);
// falseEdges -> [real: bb2, imaginary: bb2];
// }
// bb10: { // binding2 & arm2
// StorageLive(_9);
// _9 = _2;
// _1 = const 2i32;
// StorageDead(_9);
// goto -> bb15;
// }
// bb11: { // binding3: Some(y) if guard2(y)
// StorageLive(_11);
// _11 = &((_2 as Some).0: i32);
// _5 = &shallow _2;
// StorageLive(_12);
// StorageLive(_13);
// _13 = (*_11);
// _12 = const guard2(move _13) -> [return: bb12, unwind: bb1];
// }
// bb12: { // end of guard2
// StorageDead(_13);
// switchInt(move _12) -> [false: bb14, otherwise: bb13];
// }
// bb13: { // binding4 & arm4
// StorageDead(_12);
// FakeRead(ForMatchGuard, _5);
// FakeRead(ForGuardBinding, _11);
// StorageLive(_10);
// _10 = ((_2 as Some).0: i32);
// _1 = const 3i32;
// StorageDead(_10);
// StorageDead(_11);
// goto -> bb15;
// }
// bb14: {
// StorageDead(_12);
// StorageDead(_11);
// falseEdges -> [real: bb4, imaginary: bb4];
// }
// bb15: {
// StorageDead(_2);
// StorageDead(_1);
// _0 = ();
// return;
// }
// END rustc.main.PromoteTemps.before.mir
// MIR for `full_tested_match` after PromoteTemps
fn full_tested_match() -> () {
let mut _0: (); // return place in scope 0 at $DIR/match_false_edges.rs:14:28: 14:28
let mut _1: (i32, i32); // in scope 0 at $DIR/match_false_edges.rs:15:13: 19:6
let mut _2: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:15:19: 15:27
let mut _3: isize; // in scope 0 at $DIR/match_false_edges.rs:16:9: 16:16
let mut _4: &std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:15:19: 15:27
let _5: i32; // in scope 0 at $DIR/match_false_edges.rs:16:14: 16:15
let _6: &i32; // in scope 0 at $DIR/match_false_edges.rs:16:14: 16:15
let mut _7: bool; // in scope 0 at $DIR/match_false_edges.rs:16:20: 16:27
let mut _8: i32; // in scope 0 at $DIR/match_false_edges.rs:16:35: 16:36
let _9: i32; // in scope 0 at $DIR/match_false_edges.rs:17:14: 17:15
let mut _10: i32; // in scope 0 at $DIR/match_false_edges.rs:17:24: 17:25
let mut _11: &std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:16:14: 16:15
scope 1 {
}
scope 2 {
debug x => _5; // in scope 2 at $DIR/match_false_edges.rs:16:14: 16:15
debug x => _6; // in scope 2 at $DIR/match_false_edges.rs:16:14: 16:15
}
scope 3 {
debug y => _9; // in scope 3 at $DIR/match_false_edges.rs:17:14: 17:15
}
bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/match_false_edges.rs:15:13: 19:6
StorageLive(_2); // bb0[1]: scope 0 at $DIR/match_false_edges.rs:15:19: 15:27
_2 = std::option::Option::<i32>::Some(const 42i32,); // bb0[2]: scope 0 at $DIR/match_false_edges.rs:15:19: 15:27
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x0000002a))
// mir::Constant
// + span: $DIR/match_false_edges.rs:15:24: 15:26
// + literal: Const { ty: i32, val: Value(Scalar(0x0000002a)) }
FakeRead(ForMatchedPlace, _2); // bb0[3]: scope 0 at $DIR/match_false_edges.rs:15:19: 15:27
_3 = discriminant(_2); // bb0[4]: scope 0 at $DIR/match_false_edges.rs:16:9: 16:16
switchInt(move _3) -> [0isize: bb2, 1isize: bb3, otherwise: bb5]; // bb0[5]: scope 0 at $DIR/match_false_edges.rs:16:9: 16:16
}
bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/match_false_edges.rs:14:1: 20:2
}
bb2: {
_1 = (const 3i32, const 3i32); // bb2[0]: scope 0 at $DIR/match_false_edges.rs:18:17: 18:23
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000003))
// mir::Constant
// + span: $DIR/match_false_edges.rs:18:18: 18:19
// + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000003))
// mir::Constant
// + span: $DIR/match_false_edges.rs:18:21: 18:22
// + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
goto -> bb11; // bb2[1]: scope 0 at $DIR/match_false_edges.rs:15:13: 19:6
}
bb3: {
falseEdges -> [real: bb6, imaginary: bb4]; // bb3[0]: scope 0 at $DIR/match_false_edges.rs:16:9: 16:16
}
bb4: {
falseEdges -> [real: bb10, imaginary: bb2]; // bb4[0]: scope 0 at $DIR/match_false_edges.rs:17:9: 17:16
}
bb5: {
unreachable; // bb5[0]: scope 0 at $DIR/match_false_edges.rs:15:19: 15:27
}
bb6: {
StorageLive(_6); // bb6[0]: scope 0 at $DIR/match_false_edges.rs:16:14: 16:15
_11 = const full_tested_match::promoted[0]; // bb6[1]: scope 0 at $DIR/match_false_edges.rs:16:14: 16:15
// ty::Const
// + ty: &std::option::Option<i32>
// + val: Unevaluated(DefId(0:5 ~ match_false_edges[317d]::full_tested_match[0]), [], Some(promoted[0]))
// mir::Constant
// + span: $DIR/match_false_edges.rs:16:14: 16:15
// + literal: Const { ty: &std::option::Option<i32>, val: Unevaluated(DefId(0:5 ~ match_false_edges[317d]::full_tested_match[0]), [], Some(promoted[0])) }
_6 = &(((*_11) as Some).0: i32); // bb6[2]: scope 0 at $DIR/match_false_edges.rs:16:14: 16:15
_4 = &shallow _2; // bb6[3]: scope 0 at $DIR/match_false_edges.rs:15:19: 15:27
StorageLive(_7); // bb6[4]: scope 0 at $DIR/match_false_edges.rs:16:20: 16:27
_7 = const guard() -> [return: bb7, unwind: bb1]; // bb6[5]: scope 0 at $DIR/match_false_edges.rs:16:20: 16:27
// ty::Const
// + ty: fn() -> bool {guard}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/match_false_edges.rs:16:20: 16:25
// + literal: Const { ty: fn() -> bool {guard}, val: Value(Scalar(<ZST>)) }
}
bb7: {
switchInt(move _7) -> [false: bb9, otherwise: bb8]; // bb7[0]: scope 0 at $DIR/match_false_edges.rs:16:20: 16:27
}
bb8: {
StorageDead(_7); // bb8[0]: scope 0 at $DIR/match_false_edges.rs:16:37: 16:38
FakeRead(ForMatchGuard, _4); // bb8[1]: scope 0 at $DIR/match_false_edges.rs:16:26: 16:27
FakeRead(ForGuardBinding, _6); // bb8[2]: scope 0 at $DIR/match_false_edges.rs:16:26: 16:27
StorageLive(_5); // bb8[3]: scope 0 at $DIR/match_false_edges.rs:16:14: 16:15
_5 = ((_2 as Some).0: i32); // bb8[4]: scope 0 at $DIR/match_false_edges.rs:16:14: 16:15
StorageLive(_8); // bb8[5]: scope 2 at $DIR/match_false_edges.rs:16:35: 16:36
_8 = _5; // bb8[6]: scope 2 at $DIR/match_false_edges.rs:16:35: 16:36
_1 = (const 1i32, move _8); // bb8[7]: scope 2 at $DIR/match_false_edges.rs:16:31: 16:37
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000001))
// mir::Constant
// + span: $DIR/match_false_edges.rs:16:32: 16:33
// + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
StorageDead(_8); // bb8[8]: scope 2 at $DIR/match_false_edges.rs:16:36: 16:37
StorageDead(_5); // bb8[9]: scope 0 at $DIR/match_false_edges.rs:16:37: 16:38
StorageDead(_6); // bb8[10]: scope 0 at $DIR/match_false_edges.rs:16:37: 16:38
goto -> bb11; // bb8[11]: scope 0 at $DIR/match_false_edges.rs:15:13: 19:6
}
bb9: {
StorageDead(_7); // bb9[0]: scope 0 at $DIR/match_false_edges.rs:16:37: 16:38
StorageDead(_6); // bb9[1]: scope 0 at $DIR/match_false_edges.rs:16:37: 16:38
goto -> bb4; // bb9[2]: scope 0 at $DIR/match_false_edges.rs:16:20: 16:27
}
bb10: {
StorageLive(_9); // bb10[0]: scope 0 at $DIR/match_false_edges.rs:17:14: 17:15
_9 = ((_2 as Some).0: i32); // bb10[1]: scope 0 at $DIR/match_false_edges.rs:17:14: 17:15
StorageLive(_10); // bb10[2]: scope 3 at $DIR/match_false_edges.rs:17:24: 17:25
_10 = _9; // bb10[3]: scope 3 at $DIR/match_false_edges.rs:17:24: 17:25
_1 = (const 2i32, move _10); // bb10[4]: scope 3 at $DIR/match_false_edges.rs:17:20: 17:26
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000002))
// mir::Constant
// + span: $DIR/match_false_edges.rs:17:21: 17:22
// + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
StorageDead(_10); // bb10[5]: scope 3 at $DIR/match_false_edges.rs:17:25: 17:26
StorageDead(_9); // bb10[6]: scope 0 at $DIR/match_false_edges.rs:17:26: 17:27
goto -> bb11; // bb10[7]: scope 0 at $DIR/match_false_edges.rs:15:13: 19:6
}
bb11: {
StorageDead(_2); // bb11[0]: scope 0 at $DIR/match_false_edges.rs:19:6: 19:7
StorageDead(_1); // bb11[1]: scope 0 at $DIR/match_false_edges.rs:19:6: 19:7
_0 = (); // bb11[2]: scope 0 at $DIR/match_false_edges.rs:14:28: 20:2
return; // bb11[3]: scope 0 at $DIR/match_false_edges.rs:20:2: 20:2
}
}
// MIR for `full_tested_match2` before PromoteTemps
fn full_tested_match2() -> () {
let mut _0: (); // return place in scope 0 at $DIR/match_false_edges.rs:25:29: 25:29
let mut _1: (i32, i32); // in scope 0 at $DIR/match_false_edges.rs:26:13: 30:6
let mut _2: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:26:19: 26:27
let mut _3: isize; // in scope 0 at $DIR/match_false_edges.rs:27:9: 27:16
let mut _4: &std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:26:19: 26:27
let _5: i32; // in scope 0 at $DIR/match_false_edges.rs:27:14: 27:15
let _6: &i32; // in scope 0 at $DIR/match_false_edges.rs:27:14: 27:15
let mut _7: bool; // in scope 0 at $DIR/match_false_edges.rs:27:20: 27:27
let mut _8: i32; // in scope 0 at $DIR/match_false_edges.rs:27:35: 27:36
let _9: i32; // in scope 0 at $DIR/match_false_edges.rs:29:14: 29:15
let mut _10: i32; // in scope 0 at $DIR/match_false_edges.rs:29:24: 29:25
scope 1 {
}
scope 2 {
debug x => _5; // in scope 2 at $DIR/match_false_edges.rs:27:14: 27:15
debug x => _6; // in scope 2 at $DIR/match_false_edges.rs:27:14: 27:15
}
scope 3 {
debug y => _9; // in scope 3 at $DIR/match_false_edges.rs:29:14: 29:15
}
bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/match_false_edges.rs:26:13: 30:6
StorageLive(_2); // bb0[1]: scope 0 at $DIR/match_false_edges.rs:26:19: 26:27
_2 = std::option::Option::<i32>::Some(const 42i32,); // bb0[2]: scope 0 at $DIR/match_false_edges.rs:26:19: 26:27
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x0000002a))
// mir::Constant
// + span: $DIR/match_false_edges.rs:26:24: 26:26
// + literal: Const { ty: i32, val: Value(Scalar(0x0000002a)) }
FakeRead(ForMatchedPlace, _2); // bb0[3]: scope 0 at $DIR/match_false_edges.rs:26:19: 26:27
_3 = discriminant(_2); // bb0[4]: scope 0 at $DIR/match_false_edges.rs:27:9: 27:16
switchInt(move _3) -> [0isize: bb2, 1isize: bb3, otherwise: bb5]; // bb0[5]: scope 0 at $DIR/match_false_edges.rs:27:9: 27:16
}
bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/match_false_edges.rs:25:1: 31:2
}
bb2: {
falseEdges -> [real: bb10, imaginary: bb4]; // bb2[0]: scope 0 at $DIR/match_false_edges.rs:28:9: 28:13
}
bb3: {
falseEdges -> [real: bb6, imaginary: bb2]; // bb3[0]: scope 0 at $DIR/match_false_edges.rs:27:9: 27:16
}
bb4: {
StorageLive(_9); // bb4[0]: scope 0 at $DIR/match_false_edges.rs:29:14: 29:15
_9 = ((_2 as Some).0: i32); // bb4[1]: scope 0 at $DIR/match_false_edges.rs:29:14: 29:15
StorageLive(_10); // bb4[2]: scope 3 at $DIR/match_false_edges.rs:29:24: 29:25
_10 = _9; // bb4[3]: scope 3 at $DIR/match_false_edges.rs:29:24: 29:25
_1 = (const 2i32, move _10); // bb4[4]: scope 3 at $DIR/match_false_edges.rs:29:20: 29:26
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000002))
// mir::Constant
// + span: $DIR/match_false_edges.rs:29:21: 29:22
// + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
StorageDead(_10); // bb4[5]: scope 3 at $DIR/match_false_edges.rs:29:25: 29:26
StorageDead(_9); // bb4[6]: scope 0 at $DIR/match_false_edges.rs:29:26: 29:27
goto -> bb11; // bb4[7]: scope 0 at $DIR/match_false_edges.rs:26:13: 30:6
}
bb5: {
unreachable; // bb5[0]: scope 0 at $DIR/match_false_edges.rs:26:19: 26:27
}
bb6: {
StorageLive(_6); // bb6[0]: scope 0 at $DIR/match_false_edges.rs:27:14: 27:15
_6 = &((_2 as Some).0: i32); // bb6[1]: scope 0 at $DIR/match_false_edges.rs:27:14: 27:15
_4 = &shallow _2; // bb6[2]: scope 0 at $DIR/match_false_edges.rs:26:19: 26:27
StorageLive(_7); // bb6[3]: scope 0 at $DIR/match_false_edges.rs:27:20: 27:27
_7 = const guard() -> [return: bb7, unwind: bb1]; // bb6[4]: scope 0 at $DIR/match_false_edges.rs:27:20: 27:27
// ty::Const
// + ty: fn() -> bool {guard}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/match_false_edges.rs:27:20: 27:25
// + literal: Const { ty: fn() -> bool {guard}, val: Value(Scalar(<ZST>)) }
}
bb7: {
switchInt(move _7) -> [false: bb9, otherwise: bb8]; // bb7[0]: scope 0 at $DIR/match_false_edges.rs:27:20: 27:27
}
bb8: {
StorageDead(_7); // bb8[0]: scope 0 at $DIR/match_false_edges.rs:27:37: 27:38
FakeRead(ForMatchGuard, _4); // bb8[1]: scope 0 at $DIR/match_false_edges.rs:27:26: 27:27
FakeRead(ForGuardBinding, _6); // bb8[2]: scope 0 at $DIR/match_false_edges.rs:27:26: 27:27
StorageLive(_5); // bb8[3]: scope 0 at $DIR/match_false_edges.rs:27:14: 27:15
_5 = ((_2 as Some).0: i32); // bb8[4]: scope 0 at $DIR/match_false_edges.rs:27:14: 27:15
StorageLive(_8); // bb8[5]: scope 2 at $DIR/match_false_edges.rs:27:35: 27:36
_8 = _5; // bb8[6]: scope 2 at $DIR/match_false_edges.rs:27:35: 27:36
_1 = (const 1i32, move _8); // bb8[7]: scope 2 at $DIR/match_false_edges.rs:27:31: 27:37
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000001))
// mir::Constant
// + span: $DIR/match_false_edges.rs:27:32: 27:33
// + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
StorageDead(_8); // bb8[8]: scope 2 at $DIR/match_false_edges.rs:27:36: 27:37
StorageDead(_5); // bb8[9]: scope 0 at $DIR/match_false_edges.rs:27:37: 27:38
StorageDead(_6); // bb8[10]: scope 0 at $DIR/match_false_edges.rs:27:37: 27:38
goto -> bb11; // bb8[11]: scope 0 at $DIR/match_false_edges.rs:26:13: 30:6
}
bb9: {
StorageDead(_7); // bb9[0]: scope 0 at $DIR/match_false_edges.rs:27:37: 27:38
StorageDead(_6); // bb9[1]: scope 0 at $DIR/match_false_edges.rs:27:37: 27:38
falseEdges -> [real: bb4, imaginary: bb2]; // bb9[2]: scope 0 at $DIR/match_false_edges.rs:27:20: 27:27
}
bb10: {
_1 = (const 3i32, const 3i32); // bb10[0]: scope 0 at $DIR/match_false_edges.rs:28:17: 28:23
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000003))
// mir::Constant
// + span: $DIR/match_false_edges.rs:28:18: 28:19
// + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000003))
// mir::Constant
// + span: $DIR/match_false_edges.rs:28:21: 28:22
// + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
goto -> bb11; // bb10[1]: scope 0 at $DIR/match_false_edges.rs:26:13: 30:6
}
bb11: {
StorageDead(_2); // bb11[0]: scope 0 at $DIR/match_false_edges.rs:30:6: 30:7
StorageDead(_1); // bb11[1]: scope 0 at $DIR/match_false_edges.rs:30:6: 30:7
_0 = (); // bb11[2]: scope 0 at $DIR/match_false_edges.rs:25:29: 31:2
return; // bb11[3]: scope 0 at $DIR/match_false_edges.rs:31:2: 31:2
}
}
// MIR for `main` before PromoteTemps
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/match_false_edges.rs:34:11: 34:11
let mut _1: i32; // in scope 0 at $DIR/match_false_edges.rs:35:13: 40:6
let mut _2: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:35:19: 35:26
let mut _3: isize; // in scope 0 at $DIR/match_false_edges.rs:38:9: 38:16
let mut _4: isize; // in scope 0 at $DIR/match_false_edges.rs:36:9: 36:17
let mut _5: &std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:35:19: 35:26
let _6: i32; // in scope 0 at $DIR/match_false_edges.rs:36:14: 36:16
let _7: &i32; // in scope 0 at $DIR/match_false_edges.rs:36:14: 36:16
let mut _8: bool; // in scope 0 at $DIR/match_false_edges.rs:36:21: 36:28
let _9: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:37:9: 37:11
let _10: i32; // in scope 0 at $DIR/match_false_edges.rs:38:14: 38:15
let _11: &i32; // in scope 0 at $DIR/match_false_edges.rs:38:14: 38:15
let mut _12: bool; // in scope 0 at $DIR/match_false_edges.rs:38:20: 38:29
let mut _13: i32; // in scope 0 at $DIR/match_false_edges.rs:38:27: 38:28
let _14: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:39:9: 39:11
scope 1 {
}
scope 2 {
debug _w => _6; // in scope 2 at $DIR/match_false_edges.rs:36:14: 36:16
debug _w => _7; // in scope 2 at $DIR/match_false_edges.rs:36:14: 36:16
}
scope 3 {
debug _x => _9; // in scope 3 at $DIR/match_false_edges.rs:37:9: 37:11
}
scope 4 {
debug y => _10; // in scope 4 at $DIR/match_false_edges.rs:38:14: 38:15
debug y => _11; // in scope 4 at $DIR/match_false_edges.rs:38:14: 38:15
}
scope 5 {
debug _z => _14; // in scope 5 at $DIR/match_false_edges.rs:39:9: 39:11
}
bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/match_false_edges.rs:35:13: 40:6
StorageLive(_2); // bb0[1]: scope 0 at $DIR/match_false_edges.rs:35:19: 35:26
_2 = std::option::Option::<i32>::Some(const 1i32,); // bb0[2]: scope 0 at $DIR/match_false_edges.rs:35:19: 35:26
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000001))
// mir::Constant
// + span: $DIR/match_false_edges.rs:35:24: 35:25
// + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
FakeRead(ForMatchedPlace, _2); // bb0[3]: scope 0 at $DIR/match_false_edges.rs:35:19: 35:26
_4 = discriminant(_2); // bb0[4]: scope 0 at $DIR/match_false_edges.rs:36:9: 36:17
switchInt(move _4) -> [1isize: bb3, otherwise: bb2]; // bb0[5]: scope 0 at $DIR/match_false_edges.rs:36:9: 36:17
}
bb1 (cleanup): {
resume; // bb1[0]: scope 0 at $DIR/match_false_edges.rs:34:1: 41:2
}
bb2: {
falseEdges -> [real: bb10, imaginary: bb5]; // bb2[0]: scope 0 at $DIR/match_false_edges.rs:37:9: 37:11
}
bb3: {
falseEdges -> [real: bb6, imaginary: bb2]; // bb3[0]: scope 0 at $DIR/match_false_edges.rs:36:9: 36:17
}
bb4: {
StorageLive(_14); // bb4[0]: scope 0 at $DIR/match_false_edges.rs:39:9: 39:11
_14 = _2; // bb4[1]: scope 0 at $DIR/match_false_edges.rs:39:9: 39:11
_1 = const 4i32; // bb4[2]: scope 5 at $DIR/match_false_edges.rs:39:15: 39:16
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000004))
// mir::Constant
// + span: $DIR/match_false_edges.rs:39:15: 39:16
// + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
StorageDead(_14); // bb4[3]: scope 0 at $DIR/match_false_edges.rs:39:16: 39:17
goto -> bb15; // bb4[4]: scope 0 at $DIR/match_false_edges.rs:35:13: 40:6
}
bb5: {
falseEdges -> [real: bb11, imaginary: bb4]; // bb5[0]: scope 0 at $DIR/match_false_edges.rs:38:9: 38:16
}
bb6: {
StorageLive(_7); // bb6[0]: scope 0 at $DIR/match_false_edges.rs:36:14: 36:16
_7 = &((_2 as Some).0: i32); // bb6[1]: scope 0 at $DIR/match_false_edges.rs:36:14: 36:16
_5 = &shallow _2; // bb6[2]: scope 0 at $DIR/match_false_edges.rs:35:19: 35:26
StorageLive(_8); // bb6[3]: scope 0 at $DIR/match_false_edges.rs:36:21: 36:28
_8 = const guard() -> [return: bb7, unwind: bb1]; // bb6[4]: scope 0 at $DIR/match_false_edges.rs:36:21: 36:28
// ty::Const
// + ty: fn() -> bool {guard}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/match_false_edges.rs:36:21: 36:26
// + literal: Const { ty: fn() -> bool {guard}, val: Value(Scalar(<ZST>)) }
}
bb7: {
switchInt(move _8) -> [false: bb9, otherwise: bb8]; // bb7[0]: scope 0 at $DIR/match_false_edges.rs:36:21: 36:28
}
bb8: {
StorageDead(_8); // bb8[0]: scope 0 at $DIR/match_false_edges.rs:36:33: 36:34
FakeRead(ForMatchGuard, _5); // bb8[1]: scope 0 at $DIR/match_false_edges.rs:36:27: 36:28
FakeRead(ForGuardBinding, _7); // bb8[2]: scope 0 at $DIR/match_false_edges.rs:36:27: 36:28
StorageLive(_6); // bb8[3]: scope 0 at $DIR/match_false_edges.rs:36:14: 36:16
_6 = ((_2 as Some).0: i32); // bb8[4]: scope 0 at $DIR/match_false_edges.rs:36:14: 36:16
_1 = const 1i32; // bb8[5]: scope 2 at $DIR/match_false_edges.rs:36:32: 36:33
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000001))
// mir::Constant
// + span: $DIR/match_false_edges.rs:36:32: 36:33
// + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
StorageDead(_6); // bb8[6]: scope 0 at $DIR/match_false_edges.rs:36:33: 36:34
StorageDead(_7); // bb8[7]: scope 0 at $DIR/match_false_edges.rs:36:33: 36:34
goto -> bb15; // bb8[8]: scope 0 at $DIR/match_false_edges.rs:35:13: 40:6
}
bb9: {
StorageDead(_8); // bb9[0]: scope 0 at $DIR/match_false_edges.rs:36:33: 36:34
StorageDead(_7); // bb9[1]: scope 0 at $DIR/match_false_edges.rs:36:33: 36:34
falseEdges -> [real: bb2, imaginary: bb2]; // bb9[2]: scope 0 at $DIR/match_false_edges.rs:36:21: 36:28
}
bb10: {
StorageLive(_9); // bb10[0]: scope 0 at $DIR/match_false_edges.rs:37:9: 37:11
_9 = _2; // bb10[1]: scope 0 at $DIR/match_false_edges.rs:37:9: 37:11
_1 = const 2i32; // bb10[2]: scope 3 at $DIR/match_false_edges.rs:37:15: 37:16
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000002))
// mir::Constant
// + span: $DIR/match_false_edges.rs:37:15: 37:16
// + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
StorageDead(_9); // bb10[3]: scope 0 at $DIR/match_false_edges.rs:37:16: 37:17
goto -> bb15; // bb10[4]: scope 0 at $DIR/match_false_edges.rs:35:13: 40:6
}
bb11: {
StorageLive(_11); // bb11[0]: scope 0 at $DIR/match_false_edges.rs:38:14: 38:15
_11 = &((_2 as Some).0: i32); // bb11[1]: scope 0 at $DIR/match_false_edges.rs:38:14: 38:15
_5 = &shallow _2; // bb11[2]: scope 0 at $DIR/match_false_edges.rs:35:19: 35:26
StorageLive(_12); // bb11[3]: scope 0 at $DIR/match_false_edges.rs:38:20: 38:29
StorageLive(_13); // bb11[4]: scope 0 at $DIR/match_false_edges.rs:38:27: 38:28
_13 = (*_11); // bb11[5]: scope 0 at $DIR/match_false_edges.rs:38:27: 38:28
_12 = const guard2(move _13) -> [return: bb12, unwind: bb1]; // bb11[6]: scope 0 at $DIR/match_false_edges.rs:38:20: 38:29
// ty::Const
// + ty: fn(i32) -> bool {guard2}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/match_false_edges.rs:38:20: 38:26
// + literal: Const { ty: fn(i32) -> bool {guard2}, val: Value(Scalar(<ZST>)) }
}
bb12: {
StorageDead(_13); // bb12[0]: scope 0 at $DIR/match_false_edges.rs:38:28: 38:29
switchInt(move _12) -> [false: bb14, otherwise: bb13]; // bb12[1]: scope 0 at $DIR/match_false_edges.rs:38:20: 38:29
}
bb13: {
StorageDead(_12); // bb13[0]: scope 0 at $DIR/match_false_edges.rs:38:34: 38:35
FakeRead(ForMatchGuard, _5); // bb13[1]: scope 0 at $DIR/match_false_edges.rs:38:28: 38:29
FakeRead(ForGuardBinding, _11); // bb13[2]: scope 0 at $DIR/match_false_edges.rs:38:28: 38:29
StorageLive(_10); // bb13[3]: scope 0 at $DIR/match_false_edges.rs:38:14: 38:15
_10 = ((_2 as Some).0: i32); // bb13[4]: scope 0 at $DIR/match_false_edges.rs:38:14: 38:15
_1 = const 3i32; // bb13[5]: scope 4 at $DIR/match_false_edges.rs:38:33: 38:34
// ty::Const
// + ty: i32
// + val: Value(Scalar(0x00000003))
// mir::Constant
// + span: $DIR/match_false_edges.rs:38:33: 38:34
// + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
StorageDead(_10); // bb13[6]: scope 0 at $DIR/match_false_edges.rs:38:34: 38:35
StorageDead(_11); // bb13[7]: scope 0 at $DIR/match_false_edges.rs:38:34: 38:35
goto -> bb15; // bb13[8]: scope 0 at $DIR/match_false_edges.rs:35:13: 40:6
}
bb14: {
StorageDead(_12); // bb14[0]: scope 0 at $DIR/match_false_edges.rs:38:34: 38:35
StorageDead(_11); // bb14[1]: scope 0 at $DIR/match_false_edges.rs:38:34: 38:35
falseEdges -> [real: bb4, imaginary: bb4]; // bb14[2]: scope 0 at $DIR/match_false_edges.rs:38:20: 38:29
}
bb15: {
StorageDead(_2); // bb15[0]: scope 0 at $DIR/match_false_edges.rs:40:6: 40:7
StorageDead(_1); // bb15[1]: scope 0 at $DIR/match_false_edges.rs:40:6: 40:7
_0 = (); // bb15[2]: scope 0 at $DIR/match_false_edges.rs:34:11: 41:2
return; // bb15[3]: scope 0 at $DIR/match_false_edges.rs:41:2: 41:2
}
}
此差异已折叠。
......@@ -3,6 +3,7 @@
// Ensure that there are no drop terminators in `unwrap<T>` (except the one along the cleanup
// path).
// EMIT_MIR rustc.unwrap.SimplifyCfg-elaborate-drops.after.mir
fn unwrap<T>(opt: Option<T>) -> T {
match opt {
Some(x) => x,
......@@ -13,31 +14,3 @@ fn unwrap<T>(opt: Option<T>) -> T {
fn main() {
let _ = unwrap(Some(1i32));
}
// END RUST SOURCE
// START rustc.unwrap.SimplifyCfg-elaborate-drops.after.mir
// fn unwrap(_1: std::option::Option<T>) -> T {
// ...
// bb0: {
// ...
// switchInt(move _2) -> [0isize: bb2, 1isize: bb4, otherwise: bb3];
// }
// bb1 (cleanup): {
// resume;
// }
// bb2: {
// ...
// const std::rt::begin_panic::<&str>(const "explicit panic") -> bb5;
// }
// bb3: {
// unreachable;
// }
// bb4: {
// ...
// return;
// }
// bb5 (cleanup): {
// drop(_1) -> bb1;
// }
// }
// END rustc.unwrap.SimplifyCfg-elaborate-drops.after.mir
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册