Skip to content

Commit

Permalink
Add EMIT_MIR_FOR_EACH_BIT_WIDTH to tests that need it.
Browse files Browse the repository at this point in the history
  • Loading branch information
anyska committed Apr 7, 2020
1 parent 688a4dd commit e0bb75e
Show file tree
Hide file tree
Showing 47 changed files with 1,855 additions and 488 deletions.
1 change: 1 addition & 0 deletions src/test/mir-opt/array-index-is-temporary.rs
Expand Up @@ -7,6 +7,7 @@ unsafe fn foo(z: *mut usize) -> u32 {
99
}

// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR rustc.main.SimplifyCfg-elaborate-drops.after.mir
fn main() {
let mut x = [42, 43, 44];
Expand Down
@@ -0,0 +1,91 @@
// MIR for `main` after SimplifyCfg-elaborate-drops

fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/array-index-is-temporary.rs:12:11: 12:11
let mut _1: [u32; 3]; // in scope 0 at $DIR/array-index-is-temporary.rs:13:9: 13:14
let mut _4: &mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:15:25: 15:31
let mut _5: u32; // in scope 0 at $DIR/array-index-is-temporary.rs:16:12: 16:29
let mut _6: *mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:16:25: 16:26
let _7: usize; // in scope 0 at $DIR/array-index-is-temporary.rs:16:7: 16:8
let mut _8: usize; // in scope 0 at $DIR/array-index-is-temporary.rs:16:5: 16:9
let mut _9: bool; // in scope 0 at $DIR/array-index-is-temporary.rs:16:5: 16:9
scope 1 {
debug x => _1; // in scope 1 at $DIR/array-index-is-temporary.rs:13:9: 13:14
let mut _2: usize; // in scope 1 at $DIR/array-index-is-temporary.rs:14:9: 14:14
scope 2 {
debug y => _2; // in scope 2 at $DIR/array-index-is-temporary.rs:14:9: 14:14
let _3: *mut usize as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10
scope 3 {
debug z => _3; // in scope 3 at $DIR/array-index-is-temporary.rs:15:9: 15:10
scope 4 {
}
}
}
}

bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/array-index-is-temporary.rs:13:9: 13:14
_1 = [const 42u32, const 43u32, const 44u32]; // bb0[1]: scope 0 at $DIR/array-index-is-temporary.rs:13:17: 13:29
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x0000002a))
// mir::Constant
// + span: $DIR/array-index-is-temporary.rs:13:18: 13:20
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x0000002b))
// mir::Constant
// + span: $DIR/array-index-is-temporary.rs:13:22: 13:24
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002b)) }
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x0000002c))
// mir::Constant
// + span: $DIR/array-index-is-temporary.rs:13:26: 13:28
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002c)) }
StorageLive(_2); // bb0[2]: scope 1 at $DIR/array-index-is-temporary.rs:14:9: 14:14
_2 = const 1usize; // bb0[3]: scope 1 at $DIR/array-index-is-temporary.rs:14:17: 14:18
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000001))
// mir::Constant
// + span: $DIR/array-index-is-temporary.rs:14:17: 14:18
// + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) }
StorageLive(_3); // bb0[4]: scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10
StorageLive(_4); // bb0[5]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
_4 = &mut _2; // bb0[6]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
_3 = &raw mut (*_4); // bb0[7]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
StorageDead(_4); // bb0[8]: scope 2 at $DIR/array-index-is-temporary.rs:15:31: 15:32
StorageLive(_5); // bb0[9]: scope 3 at $DIR/array-index-is-temporary.rs:16:12: 16:29
StorageLive(_6); // bb0[10]: scope 4 at $DIR/array-index-is-temporary.rs:16:25: 16:26
_6 = _3; // bb0[11]: scope 4 at $DIR/array-index-is-temporary.rs:16:25: 16:26
_5 = const foo(move _6) -> bb1; // bb0[12]: scope 4 at $DIR/array-index-is-temporary.rs:16:21: 16:27
// ty::Const
// + ty: unsafe fn(*mut usize) -> u32 {foo}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/array-index-is-temporary.rs:16:21: 16:24
// + literal: Const { ty: unsafe fn(*mut usize) -> u32 {foo}, val: Value(Scalar(<ZST>)) }
}

bb1: {
StorageDead(_6); // bb1[0]: scope 4 at $DIR/array-index-is-temporary.rs:16:26: 16:27
StorageLive(_7); // bb1[1]: scope 3 at $DIR/array-index-is-temporary.rs:16:7: 16:8
_7 = _2; // bb1[2]: scope 3 at $DIR/array-index-is-temporary.rs:16:7: 16:8
_8 = Len(_1); // bb1[3]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
_9 = Lt(_7, _8); // bb1[4]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
assert(move _9, "index out of bounds: the len is move _8 but the index is _7") -> bb2; // bb1[5]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
}

bb2: {
_1[_7] = move _5; // bb2[0]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:29
StorageDead(_5); // bb2[1]: scope 3 at $DIR/array-index-is-temporary.rs:16:28: 16:29
StorageDead(_7); // bb2[2]: scope 3 at $DIR/array-index-is-temporary.rs:16:29: 16:30
_0 = (); // bb2[3]: scope 0 at $DIR/array-index-is-temporary.rs:12:11: 17:2
StorageDead(_3); // bb2[4]: scope 2 at $DIR/array-index-is-temporary.rs:17:1: 17:2
StorageDead(_2); // bb2[5]: scope 1 at $DIR/array-index-is-temporary.rs:17:1: 17:2
StorageDead(_1); // bb2[6]: scope 0 at $DIR/array-index-is-temporary.rs:17:1: 17:2
return; // bb2[7]: scope 0 at $DIR/array-index-is-temporary.rs:17:2: 17:2
}
}
@@ -1,91 +1,91 @@
// 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
let mut _0: (); // return place in scope 0 at $DIR/array-index-is-temporary.rs:12:11: 12:11
let mut _1: [u32; 3]; // in scope 0 at $DIR/array-index-is-temporary.rs:13:9: 13:14
let mut _4: &mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:15:25: 15:31
let mut _5: u32; // in scope 0 at $DIR/array-index-is-temporary.rs:16:12: 16:29
let mut _6: *mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:16:25: 16:26
let _7: usize; // in scope 0 at $DIR/array-index-is-temporary.rs:16:7: 16:8
let mut _8: usize; // in scope 0 at $DIR/array-index-is-temporary.rs:16:5: 16:9
let mut _9: bool; // in scope 0 at $DIR/array-index-is-temporary.rs:16:5: 16:9
scope 1 {
debug x => _1; // in scope 1 at $DIR/array-index-is-temporary.rs:12:9: 12:14
let mut _2: usize; // in scope 1 at $DIR/array-index-is-temporary.rs:13:9: 13:14
debug x => _1; // in scope 1 at $DIR/array-index-is-temporary.rs:13:9: 13:14
let mut _2: usize; // in scope 1 at $DIR/array-index-is-temporary.rs:14:9: 14: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
debug y => _2; // in scope 2 at $DIR/array-index-is-temporary.rs:14:9: 14:14
let _3: *mut usize as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10
scope 3 {
debug z => _3; // in scope 3 at $DIR/array-index-is-temporary.rs:14:9: 14:10
debug z => _3; // in scope 3 at $DIR/array-index-is-temporary.rs:15:9: 15:10
scope 4 {
}
}
}
}

bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/array-index-is-temporary.rs: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
StorageLive(_1); // bb0[0]: scope 0 at $DIR/array-index-is-temporary.rs:13:9: 13:14
_1 = [const 42u32, const 43u32, const 44u32]; // bb0[1]: scope 0 at $DIR/array-index-is-temporary.rs:13:17: 13:29
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x0000002a))
// mir::Constant
// + span: $DIR/array-index-is-temporary.rs:12:18: 12:20
// + span: $DIR/array-index-is-temporary.rs:13:18: 13:20
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x0000002b))
// mir::Constant
// + span: $DIR/array-index-is-temporary.rs:12:22: 12:24
// + span: $DIR/array-index-is-temporary.rs:13:22: 13:24
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002b)) }
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x0000002c))
// mir::Constant
// + span: $DIR/array-index-is-temporary.rs:12:26: 12:28
// + span: $DIR/array-index-is-temporary.rs:13:26: 13:28
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002c)) }
StorageLive(_2); // bb0[2]: scope 1 at $DIR/array-index-is-temporary.rs:13:9: 13:14
_2 = const 1usize; // bb0[3]: scope 1 at $DIR/array-index-is-temporary.rs:13:17: 13:18
StorageLive(_2); // bb0[2]: scope 1 at $DIR/array-index-is-temporary.rs:14:9: 14:14
_2 = const 1usize; // bb0[3]: scope 1 at $DIR/array-index-is-temporary.rs:14:17: 14:18
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x0000000000000001))
// mir::Constant
// + span: $DIR/array-index-is-temporary.rs:13:17: 13:18
// + span: $DIR/array-index-is-temporary.rs:14:17: 14:18
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) }
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
StorageLive(_3); // bb0[4]: scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10
StorageLive(_4); // bb0[5]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
_4 = &mut _2; // bb0[6]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
_3 = &raw mut (*_4); // bb0[7]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
StorageDead(_4); // bb0[8]: scope 2 at $DIR/array-index-is-temporary.rs:15:31: 15:32
StorageLive(_5); // bb0[9]: scope 3 at $DIR/array-index-is-temporary.rs:16:12: 16:29
StorageLive(_6); // bb0[10]: scope 4 at $DIR/array-index-is-temporary.rs:16:25: 16:26
_6 = _3; // bb0[11]: scope 4 at $DIR/array-index-is-temporary.rs:16:25: 16:26
_5 = const foo(move _6) -> bb1; // bb0[12]: scope 4 at $DIR/array-index-is-temporary.rs:16:21: 16:27
// ty::Const
// + ty: unsafe fn(*mut usize) -> u32 {foo}
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/array-index-is-temporary.rs:15:21: 15:24
// + span: $DIR/array-index-is-temporary.rs:16:21: 16:24
// + literal: Const { ty: unsafe fn(*mut usize) -> u32 {foo}, val: Value(Scalar(<ZST>)) }
}

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
StorageDead(_6); // bb1[0]: scope 4 at $DIR/array-index-is-temporary.rs:16:26: 16:27
StorageLive(_7); // bb1[1]: scope 3 at $DIR/array-index-is-temporary.rs:16:7: 16:8
_7 = _2; // bb1[2]: scope 3 at $DIR/array-index-is-temporary.rs:16:7: 16:8
_8 = Len(_1); // bb1[3]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
_9 = Lt(_7, _8); // bb1[4]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
assert(move _9, "index out of bounds: the len is move _8 but the index is _7") -> bb2; // bb1[5]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
}

bb2: {
_1[_7] = move _5; // bb2[0]: scope 3 at $DIR/array-index-is-temporary.rs: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
_1[_7] = move _5; // bb2[0]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:29
StorageDead(_5); // bb2[1]: scope 3 at $DIR/array-index-is-temporary.rs:16:28: 16:29
StorageDead(_7); // bb2[2]: scope 3 at $DIR/array-index-is-temporary.rs:16:29: 16:30
_0 = (); // bb2[3]: scope 0 at $DIR/array-index-is-temporary.rs:12:11: 17:2
StorageDead(_3); // bb2[4]: scope 2 at $DIR/array-index-is-temporary.rs:17:1: 17:2
StorageDead(_2); // bb2[5]: scope 1 at $DIR/array-index-is-temporary.rs:17:1: 17:2
StorageDead(_1); // bb2[6]: scope 0 at $DIR/array-index-is-temporary.rs:17:1: 17:2
return; // bb2[7]: scope 0 at $DIR/array-index-is-temporary.rs:17:2: 17:2
}
}
1 change: 1 addition & 0 deletions src/test/mir-opt/combine_array_len.rs
@@ -1,3 +1,4 @@
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR rustc.norm2.InstCombine.diff

fn norm2(x: [f32; 2]) -> f32 {
Expand Down

0 comments on commit e0bb75e

Please sign in to comment.