Skip to content

Commit 4668123

Browse files
committed
bless mir-opt
To reproduce the changes in this commit locally: - Run `./x test tidy` and remove all the output files not associated with a test file anymore, as reported by tidy. - Run `./x test tests/mir-opt --bless` to generate the new outputs.
1 parent 070cc83 commit 4668123

File tree

395 files changed

+11189
-38
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

395 files changed

+11189
-38
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// MIR for `main` after SimplifyCfg-elaborate-drops
2+
3+
fn main() -> () {
4+
let mut _0: (); // return place in scope 0 at $DIR/array_index_is_temporary.rs:+0:11: +0:11
5+
let mut _1: [u32; 3]; // in scope 0 at $DIR/array_index_is_temporary.rs:+1:9: +1:14
6+
let mut _4: &mut usize; // in scope 0 at $DIR/array_index_is_temporary.rs:+3:25: +3:31
7+
let mut _5: u32; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:12: +4:29
8+
let mut _6: *mut usize; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:25: +4:26
9+
let _7: usize; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:7: +4:8
10+
let mut _8: usize; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
11+
let mut _9: bool; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
12+
scope 1 {
13+
debug x => _1; // in scope 1 at $DIR/array_index_is_temporary.rs:+1:9: +1:14
14+
let mut _2: usize; // in scope 1 at $DIR/array_index_is_temporary.rs:+2:9: +2:14
15+
scope 2 {
16+
debug y => _2; // in scope 2 at $DIR/array_index_is_temporary.rs:+2:9: +2:14
17+
let _3: *mut usize; // in scope 2 at $DIR/array_index_is_temporary.rs:+3:9: +3:10
18+
scope 3 {
19+
debug z => _3; // in scope 3 at $DIR/array_index_is_temporary.rs:+3:9: +3:10
20+
scope 4 {
21+
}
22+
}
23+
}
24+
}
25+
26+
bb0: {
27+
StorageLive(_1); // scope 0 at $DIR/array_index_is_temporary.rs:+1:9: +1:14
28+
_1 = [const 42_u32, const 43_u32, const 44_u32]; // scope 0 at $DIR/array_index_is_temporary.rs:+1:17: +1:29
29+
StorageLive(_2); // scope 1 at $DIR/array_index_is_temporary.rs:+2:9: +2:14
30+
_2 = const 1_usize; // scope 1 at $DIR/array_index_is_temporary.rs:+2:17: +2:18
31+
StorageLive(_3); // scope 2 at $DIR/array_index_is_temporary.rs:+3:9: +3:10
32+
StorageLive(_4); // scope 2 at $DIR/array_index_is_temporary.rs:+3:25: +3:31
33+
_4 = &mut _2; // scope 2 at $DIR/array_index_is_temporary.rs:+3:25: +3:31
34+
_3 = &raw mut (*_4); // scope 2 at $DIR/array_index_is_temporary.rs:+3:25: +3:31
35+
StorageDead(_4); // scope 2 at $DIR/array_index_is_temporary.rs:+3:31: +3:32
36+
StorageLive(_5); // scope 3 at $DIR/array_index_is_temporary.rs:+4:12: +4:29
37+
StorageLive(_6); // scope 4 at $DIR/array_index_is_temporary.rs:+4:25: +4:26
38+
_6 = _3; // scope 4 at $DIR/array_index_is_temporary.rs:+4:25: +4:26
39+
_5 = foo(move _6) -> [return: bb1, unwind unreachable]; // scope 4 at $DIR/array_index_is_temporary.rs:+4:21: +4:27
40+
// mir::Constant
41+
// + span: $DIR/array_index_is_temporary.rs:17:21: 17:24
42+
// + literal: Const { ty: unsafe fn(*mut usize) -> u32 {foo}, val: Value(<ZST>) }
43+
}
44+
45+
bb1: {
46+
StorageDead(_6); // scope 4 at $DIR/array_index_is_temporary.rs:+4:26: +4:27
47+
StorageLive(_7); // scope 3 at $DIR/array_index_is_temporary.rs:+4:7: +4:8
48+
_7 = _2; // scope 3 at $DIR/array_index_is_temporary.rs:+4:7: +4:8
49+
_8 = Len(_1); // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
50+
_9 = Lt(_7, _8); // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
51+
assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb2, unwind unreachable]; // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
52+
}
53+
54+
bb2: {
55+
_1[_7] = move _5; // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:29
56+
StorageDead(_5); // scope 3 at $DIR/array_index_is_temporary.rs:+4:28: +4:29
57+
StorageDead(_7); // scope 3 at $DIR/array_index_is_temporary.rs:+4:29: +4:30
58+
_0 = const (); // scope 0 at $DIR/array_index_is_temporary.rs:+0:11: +5:2
59+
StorageDead(_3); // scope 2 at $DIR/array_index_is_temporary.rs:+5:1: +5:2
60+
StorageDead(_2); // scope 1 at $DIR/array_index_is_temporary.rs:+5:1: +5:2
61+
StorageDead(_1); // scope 0 at $DIR/array_index_is_temporary.rs:+5:1: +5:2
62+
return; // scope 0 at $DIR/array_index_is_temporary.rs:+5:2: +5:2
63+
}
64+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
// MIR for `main` before ElaborateDrops
2+
3+
fn main() -> () {
4+
let mut _0: (); // return place in scope 0 at $DIR/box_expr.rs:+0:11: +0:11
5+
let _1: std::boxed::Box<S>; // in scope 0 at $DIR/box_expr.rs:+1:9: +1:10
6+
let mut _2: usize; // in scope 0 at $DIR/box_expr.rs:+2:5: +2:23
7+
let mut _3: usize; // in scope 0 at $DIR/box_expr.rs:+2:5: +2:23
8+
let mut _4: *mut u8; // in scope 0 at $DIR/box_expr.rs:+2:5: +2:23
9+
let mut _5: std::boxed::Box<S>; // in scope 0 at $DIR/box_expr.rs:+2:5: +2:23
10+
let _6: (); // in scope 0 at $DIR/box_expr.rs:+3:5: +3:12
11+
let mut _7: std::boxed::Box<S>; // in scope 0 at $DIR/box_expr.rs:+3:10: +3:11
12+
scope 1 {
13+
debug x => _1; // in scope 1 at $DIR/box_expr.rs:+1:9: +1:10
14+
}
15+
scope 2 {
16+
}
17+
18+
bb0: {
19+
StorageLive(_1); // scope 0 at $DIR/box_expr.rs:+1:9: +1:10
20+
_2 = SizeOf(S); // scope 2 at $DIR/box_expr.rs:+2:5: +2:23
21+
_3 = AlignOf(S); // scope 2 at $DIR/box_expr.rs:+2:5: +2:23
22+
_4 = alloc::alloc::exchange_malloc(move _2, move _3) -> [return: bb1, unwind: bb9]; // scope 2 at $DIR/box_expr.rs:+2:5: +2:23
23+
// mir::Constant
24+
// + span: $DIR/box_expr.rs:8:5: 8:23
25+
// + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(<ZST>) }
26+
}
27+
28+
bb1: {
29+
StorageLive(_5); // scope 0 at $DIR/box_expr.rs:+2:5: +2:23
30+
_5 = ShallowInitBox(move _4, S); // scope 0 at $DIR/box_expr.rs:+2:5: +2:23
31+
(*_5) = S::new() -> [return: bb2, unwind: bb8]; // scope 0 at $DIR/box_expr.rs:+2:14: +2:22
32+
// mir::Constant
33+
// + span: $DIR/box_expr.rs:8:14: 8:20
34+
// + literal: Const { ty: fn() -> S {S::new}, val: Value(<ZST>) }
35+
}
36+
37+
bb2: {
38+
_1 = move _5; // scope 0 at $DIR/box_expr.rs:+2:5: +2:23
39+
drop(_5) -> [return: bb3, unwind: bb9]; // scope 0 at $DIR/box_expr.rs:+2:22: +2:23
40+
}
41+
42+
bb3: {
43+
StorageDead(_5); // scope 0 at $DIR/box_expr.rs:+2:22: +2:23
44+
StorageLive(_6); // scope 1 at $DIR/box_expr.rs:+3:5: +3:12
45+
StorageLive(_7); // scope 1 at $DIR/box_expr.rs:+3:10: +3:11
46+
_7 = move _1; // scope 1 at $DIR/box_expr.rs:+3:10: +3:11
47+
_6 = std::mem::drop::<Box<S>>(move _7) -> [return: bb4, unwind: bb6]; // scope 1 at $DIR/box_expr.rs:+3:5: +3:12
48+
// mir::Constant
49+
// + span: $DIR/box_expr.rs:9:5: 9:9
50+
// + literal: Const { ty: fn(Box<S>) {std::mem::drop::<Box<S>>}, val: Value(<ZST>) }
51+
}
52+
53+
bb4: {
54+
StorageDead(_7); // scope 1 at $DIR/box_expr.rs:+3:11: +3:12
55+
StorageDead(_6); // scope 1 at $DIR/box_expr.rs:+3:12: +3:13
56+
_0 = const (); // scope 0 at $DIR/box_expr.rs:+0:11: +4:2
57+
drop(_1) -> [return: bb5, unwind: bb9]; // scope 0 at $DIR/box_expr.rs:+4:1: +4:2
58+
}
59+
60+
bb5: {
61+
StorageDead(_1); // scope 0 at $DIR/box_expr.rs:+4:1: +4:2
62+
return; // scope 0 at $DIR/box_expr.rs:+4:2: +4:2
63+
}
64+
65+
bb6 (cleanup): {
66+
drop(_7) -> [return: bb7, unwind terminate]; // scope 1 at $DIR/box_expr.rs:+3:11: +3:12
67+
}
68+
69+
bb7 (cleanup): {
70+
drop(_1) -> [return: bb9, unwind terminate]; // scope 0 at $DIR/box_expr.rs:+4:1: +4:2
71+
}
72+
73+
bb8 (cleanup): {
74+
drop(_5) -> [return: bb9, unwind terminate]; // scope 0 at $DIR/box_expr.rs:+2:22: +2:23
75+
}
76+
77+
bb9 (cleanup): {
78+
resume; // scope 0 at $DIR/box_expr.rs:+0:1: +4:2
79+
}
80+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
- // MIR for `norm2` before InstSimplify
2+
+ // MIR for `norm2` after InstSimplify
3+
4+
fn norm2(_1: [f32; 2]) -> f32 {
5+
debug x => _1; // in scope 0 at $DIR/combine_array_len.rs:+0:10: +0:11
6+
let mut _0: f32; // return place in scope 0 at $DIR/combine_array_len.rs:+0:26: +0:29
7+
let _2: f32; // in scope 0 at $DIR/combine_array_len.rs:+1:9: +1:10
8+
let _3: usize; // in scope 0 at $DIR/combine_array_len.rs:+1:15: +1:16
9+
let mut _4: usize; // in scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17
10+
let mut _5: bool; // in scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17
11+
let _7: usize; // in scope 0 at $DIR/combine_array_len.rs:+2:15: +2:16
12+
let mut _8: usize; // in scope 0 at $DIR/combine_array_len.rs:+2:13: +2:17
13+
let mut _9: bool; // in scope 0 at $DIR/combine_array_len.rs:+2:13: +2:17
14+
let mut _10: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:5: +3:8
15+
let mut _11: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:5: +3:6
16+
let mut _12: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:7: +3:8
17+
let mut _13: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:11: +3:14
18+
let mut _14: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:11: +3:12
19+
let mut _15: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:13: +3:14
20+
scope 1 {
21+
debug a => _2; // in scope 1 at $DIR/combine_array_len.rs:+1:9: +1:10
22+
let _6: f32; // in scope 1 at $DIR/combine_array_len.rs:+2:9: +2:10
23+
scope 2 {
24+
debug b => _6; // in scope 2 at $DIR/combine_array_len.rs:+2:9: +2:10
25+
}
26+
}
27+
28+
bb0: {
29+
StorageLive(_2); // scope 0 at $DIR/combine_array_len.rs:+1:9: +1:10
30+
StorageLive(_3); // scope 0 at $DIR/combine_array_len.rs:+1:15: +1:16
31+
_3 = const 0_usize; // scope 0 at $DIR/combine_array_len.rs:+1:15: +1:16
32+
- _4 = Len(_1); // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17
33+
+ _4 = const 2_usize; // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17
34+
_5 = Lt(_3, _4); // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17
35+
assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17
36+
}
37+
38+
bb1: {
39+
_2 = _1[_3]; // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17
40+
StorageDead(_3); // scope 0 at $DIR/combine_array_len.rs:+1:17: +1:18
41+
StorageLive(_6); // scope 1 at $DIR/combine_array_len.rs:+2:9: +2:10
42+
StorageLive(_7); // scope 1 at $DIR/combine_array_len.rs:+2:15: +2:16
43+
_7 = const 1_usize; // scope 1 at $DIR/combine_array_len.rs:+2:15: +2:16
44+
- _8 = Len(_1); // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17
45+
+ _8 = const 2_usize; // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17
46+
_9 = Lt(_7, _8); // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17
47+
assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb2, unwind unreachable]; // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17
48+
}
49+
50+
bb2: {
51+
_6 = _1[_7]; // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17
52+
StorageDead(_7); // scope 1 at $DIR/combine_array_len.rs:+2:17: +2:18
53+
StorageLive(_10); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:8
54+
StorageLive(_11); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:6
55+
_11 = _2; // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:6
56+
StorageLive(_12); // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8
57+
_12 = _2; // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8
58+
_10 = Mul(move _11, move _12); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:8
59+
StorageDead(_12); // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8
60+
StorageDead(_11); // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8
61+
StorageLive(_13); // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:14
62+
StorageLive(_14); // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:12
63+
_14 = _6; // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:12
64+
StorageLive(_15); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14
65+
_15 = _6; // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14
66+
_13 = Mul(move _14, move _15); // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:14
67+
StorageDead(_15); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14
68+
StorageDead(_14); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14
69+
_0 = Add(move _10, move _13); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:14
70+
StorageDead(_13); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14
71+
StorageDead(_10); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14
72+
StorageDead(_6); // scope 1 at $DIR/combine_array_len.rs:+4:1: +4:2
73+
StorageDead(_2); // scope 0 at $DIR/combine_array_len.rs:+4:1: +4:2
74+
return; // scope 0 at $DIR/combine_array_len.rs:+4:2: +4:2
75+
}
76+
}
77+

0 commit comments

Comments
 (0)