Skip to content

Commit ef88769

Browse files
committed
--bless all mir-opt tests.
1 parent 39b6253 commit ef88769

File tree

123 files changed

+6572
-3046
lines changed

Some content is hidden

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

123 files changed

+6572
-3046
lines changed

src/test/mir-opt/address-of.rs

Lines changed: 3 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// EMIT_MIR rustc.address_of_reborrow.SimplifyCfg-initial.after.mir
2+
13
fn address_of_reborrow() {
24
let y = &[0; 10];
35
let mut z = &mut [0; 10];
@@ -35,78 +37,11 @@ fn address_of_reborrow() {
3537
}
3638

3739
// The normal borrows here should be preserved
40+
// EMIT_MIR rustc.borrow_and_cast.SimplifyCfg-initial.after.mir
3841
fn borrow_and_cast(mut x: i32) {
3942
let p = &x as *const i32;
4043
let q = &mut x as *const i32;
4144
let r = &mut x as *mut i32;
4245
}
4346

4447
fn main() {}
45-
46-
// START rustc.address_of_reborrow.SimplifyCfg-initial.after.mir
47-
// bb0: {
48-
// ...
49-
// _5 = &raw const (*_1); // & to *const casts
50-
// ...
51-
// _7 = &raw const (*_1);
52-
// ...
53-
// _11 = &raw const (*_1);
54-
// ...
55-
// _14 = &raw const (*_1);
56-
// ...
57-
// _16 = &raw const (*_1);
58-
// ...
59-
// _17 = &raw const (*_1); // & to *const coercions
60-
// ...
61-
// _18 = &raw const (*_1);
62-
// ...
63-
// _20 = &raw const (*_1);
64-
// ...
65-
// _22 = &raw const (*_1);
66-
// ...
67-
// _24 = &raw const (*_2); // &mut to *const casts
68-
// ...
69-
// _26 = &raw const (*_2);
70-
// ...
71-
// _30 = &raw const (*_2);
72-
// ...
73-
// _33 = &raw const (*_2);
74-
// ...
75-
// _34 = &raw const (*_2); // &mut to *const coercions
76-
// ...
77-
// _35 = &raw const (*_2);
78-
// ...
79-
// _37 = &raw const (*_2);
80-
// ...
81-
// _39 = &raw const (*_2);
82-
// ...
83-
// _41 = &raw mut (*_2); // &mut to *mut casts
84-
// ...
85-
// _43 = &raw mut (*_2);
86-
// ...
87-
// _47 = &raw mut (*_2);
88-
// ...
89-
// _50 = &raw mut (*_2);
90-
// ...
91-
// _51 = &raw mut (*_2); // &mut to *mut coercions
92-
// ...
93-
// _52 = &raw mut (*_2);
94-
// ...
95-
// _54 = &raw mut (*_2);
96-
// ...
97-
// _56 = &raw mut (*_2);
98-
// ...
99-
// }
100-
// END rustc.address_of_reborrow.SimplifyCfg-initial.after.mir
101-
102-
// START rustc.borrow_and_cast.EraseRegions.after.mir
103-
// bb0: {
104-
// ...
105-
// _4 = &_1;
106-
// ...
107-
// _7 = &mut _1;
108-
// ...
109-
// _10 = &mut _1;
110-
// ...
111-
// }
112-
// END rustc.borrow_and_cast.EraseRegions.after.mir

src/test/mir-opt/address-of/rustc.address_of_reborrow.SimplifyCfg-initial.after.mir

Lines changed: 320 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// MIR for `borrow_and_cast` after SimplifyCfg-initial
2+
3+
fn borrow_and_cast(_1: i32) -> () {
4+
debug x => _1; // in scope 0 at $DIR/address-of.rs:41:20: 41:25
5+
let mut _0: (); // return place in scope 0 at $DIR/address-of.rs:41:32: 41:32
6+
let _2: *const i32; // in scope 0 at $DIR/address-of.rs:42:9: 42:10
7+
let _3: &i32; // in scope 0 at $DIR/address-of.rs:42:13: 42:15
8+
let _5: &mut i32; // in scope 0 at $DIR/address-of.rs:43:13: 43:19
9+
let mut _7: &mut i32; // in scope 0 at $DIR/address-of.rs:44:13: 44:19
10+
scope 1 {
11+
debug p => _2; // in scope 1 at $DIR/address-of.rs:42:9: 42:10
12+
let _4: *const i32; // in scope 1 at $DIR/address-of.rs:43:9: 43:10
13+
scope 2 {
14+
debug q => _4; // in scope 2 at $DIR/address-of.rs:43:9: 43:10
15+
let _6: *mut i32; // in scope 2 at $DIR/address-of.rs:44:9: 44:10
16+
scope 3 {
17+
debug r => _6; // in scope 3 at $DIR/address-of.rs:44:9: 44:10
18+
}
19+
}
20+
}
21+
22+
bb0: {
23+
StorageLive(_2); // bb0[0]: scope 0 at $DIR/address-of.rs:42:9: 42:10
24+
StorageLive(_3); // bb0[1]: scope 0 at $DIR/address-of.rs:42:13: 42:15
25+
_3 = &_1; // bb0[2]: scope 0 at $DIR/address-of.rs:42:13: 42:15
26+
_2 = &raw const (*_3); // bb0[3]: scope 0 at $DIR/address-of.rs:42:13: 42:15
27+
FakeRead(ForLet, _2); // bb0[4]: scope 0 at $DIR/address-of.rs:42:9: 42:10
28+
StorageDead(_3); // bb0[5]: scope 0 at $DIR/address-of.rs:42:29: 42:30
29+
StorageLive(_4); // bb0[6]: scope 1 at $DIR/address-of.rs:43:9: 43:10
30+
StorageLive(_5); // bb0[7]: scope 1 at $DIR/address-of.rs:43:13: 43:19
31+
_5 = &mut _1; // bb0[8]: scope 1 at $DIR/address-of.rs:43:13: 43:19
32+
_4 = &raw const (*_5); // bb0[9]: scope 1 at $DIR/address-of.rs:43:13: 43:19
33+
FakeRead(ForLet, _4); // bb0[10]: scope 1 at $DIR/address-of.rs:43:9: 43:10
34+
StorageDead(_5); // bb0[11]: scope 1 at $DIR/address-of.rs:43:33: 43:34
35+
StorageLive(_6); // bb0[12]: scope 2 at $DIR/address-of.rs:44:9: 44:10
36+
StorageLive(_7); // bb0[13]: scope 2 at $DIR/address-of.rs:44:13: 44:19
37+
_7 = &mut _1; // bb0[14]: scope 2 at $DIR/address-of.rs:44:13: 44:19
38+
_6 = &raw mut (*_7); // bb0[15]: scope 2 at $DIR/address-of.rs:44:13: 44:19
39+
FakeRead(ForLet, _6); // bb0[16]: scope 2 at $DIR/address-of.rs:44:9: 44:10
40+
StorageDead(_7); // bb0[17]: scope 2 at $DIR/address-of.rs:44:31: 44:32
41+
_0 = (); // bb0[18]: scope 0 at $DIR/address-of.rs:41:32: 45:2
42+
StorageDead(_6); // bb0[19]: scope 2 at $DIR/address-of.rs:45:1: 45:2
43+
StorageDead(_4); // bb0[20]: scope 1 at $DIR/address-of.rs:45:1: 45:2
44+
StorageDead(_2); // bb0[21]: scope 0 at $DIR/address-of.rs:45:1: 45:2
45+
return; // bb0[22]: scope 0 at $DIR/address-of.rs:45:2: 45:2
46+
}
47+
}

src/test/mir-opt/array-index-is-temporary.rs

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,10 @@ unsafe fn foo(z: *mut usize) -> u32 {
77
99
88
}
99

10+
// EMIT_MIR rustc.main.SimplifyCfg-elaborate-drops.after.mir
1011
fn main() {
1112
let mut x = [42, 43, 44];
1213
let mut y = 1;
1314
let z: *mut usize = &mut y;
1415
x[y] = unsafe { foo(z) };
1516
}
16-
17-
// END RUST SOURCE
18-
// START rustc.main.SimplifyCfg-elaborate-drops.after.mir
19-
// bb0: {
20-
// ...
21-
// _4 = &mut _2;
22-
// _3 = &raw mut (*_4);
23-
// ...
24-
// _6 = _3;
25-
// _5 = const foo(move _6) -> bb1;
26-
// }
27-
//
28-
// bb1: {
29-
// ...
30-
// _7 = _2;
31-
// _8 = Len(_1);
32-
// _9 = Lt(_7, _8);
33-
// assert(move _9, "index out of bounds: the len is move _8 but the index is _7") -> bb2;
34-
// }
35-
//
36-
// bb2: {
37-
// _1[_7] = move _5;
38-
// ...
39-
// return;
40-
// }
41-
// END rustc.main.SimplifyCfg-elaborate-drops.after.mir
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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:11:11: 11:11
5+
let mut _1: [u32; 3]; // in scope 0 at $DIR/array-index-is-temporary.rs:12:9: 12:14
6+
let mut _4: &mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:14:25: 14:31
7+
let mut _5: u32; // in scope 0 at $DIR/array-index-is-temporary.rs:15:12: 15:29
8+
let mut _6: *mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:15:25: 15:26
9+
let _7: usize; // in scope 0 at $DIR/array-index-is-temporary.rs:15:7: 15:8
10+
let mut _8: usize; // in scope 0 at $DIR/array-index-is-temporary.rs:15:5: 15:9
11+
let mut _9: bool; // in scope 0 at $DIR/array-index-is-temporary.rs:15:5: 15:9
12+
scope 1 {
13+
debug x => _1; // in scope 1 at $DIR/array-index-is-temporary.rs:12:9: 12:14
14+
let mut _2: usize; // in scope 1 at $DIR/array-index-is-temporary.rs:13:9: 13:14
15+
scope 2 {
16+
debug y => _2; // in scope 2 at $DIR/array-index-is-temporary.rs:13:9: 13:14
17+
let _3: *mut usize as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 2 at $DIR/array-index-is-temporary.rs:14:9: 14:10
18+
scope 3 {
19+
debug z => _3; // in scope 3 at $DIR/array-index-is-temporary.rs:14:9: 14:10
20+
scope 4 {
21+
}
22+
}
23+
}
24+
}
25+
26+
bb0: {
27+
StorageLive(_1); // bb0[0]: scope 0 at $DIR/array-index-is-temporary.rs:12:9: 12:14
28+
_1 = [const 42u32, const 43u32, const 44u32]; // bb0[1]: scope 0 at $DIR/array-index-is-temporary.rs:12:17: 12:29
29+
// ty::Const
30+
// + ty: u32
31+
// + val: Value(Scalar(0x0000002a))
32+
// mir::Constant
33+
// + span: $DIR/array-index-is-temporary.rs:12:18: 12:20
34+
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
35+
// ty::Const
36+
// + ty: u32
37+
// + val: Value(Scalar(0x0000002b))
38+
// mir::Constant
39+
// + span: $DIR/array-index-is-temporary.rs:12:22: 12:24
40+
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002b)) }
41+
// ty::Const
42+
// + ty: u32
43+
// + val: Value(Scalar(0x0000002c))
44+
// mir::Constant
45+
// + span: $DIR/array-index-is-temporary.rs:12:26: 12:28
46+
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002c)) }
47+
StorageLive(_2); // bb0[2]: scope 1 at $DIR/array-index-is-temporary.rs:13:9: 13:14
48+
_2 = const 1usize; // bb0[3]: scope 1 at $DIR/array-index-is-temporary.rs:13:17: 13:18
49+
// ty::Const
50+
// + ty: usize
51+
// + val: Value(Scalar(0x0000000000000001))
52+
// mir::Constant
53+
// + span: $DIR/array-index-is-temporary.rs:13:17: 13:18
54+
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) }
55+
StorageLive(_3); // bb0[4]: scope 2 at $DIR/array-index-is-temporary.rs:14:9: 14:10
56+
StorageLive(_4); // bb0[5]: scope 2 at $DIR/array-index-is-temporary.rs:14:25: 14:31
57+
_4 = &mut _2; // bb0[6]: scope 2 at $DIR/array-index-is-temporary.rs:14:25: 14:31
58+
_3 = &raw mut (*_4); // bb0[7]: scope 2 at $DIR/array-index-is-temporary.rs:14:25: 14:31
59+
StorageDead(_4); // bb0[8]: scope 2 at $DIR/array-index-is-temporary.rs:14:31: 14:32
60+
StorageLive(_5); // bb0[9]: scope 3 at $DIR/array-index-is-temporary.rs:15:12: 15:29
61+
StorageLive(_6); // bb0[10]: scope 4 at $DIR/array-index-is-temporary.rs:15:25: 15:26
62+
_6 = _3; // bb0[11]: scope 4 at $DIR/array-index-is-temporary.rs:15:25: 15:26
63+
_5 = const foo(move _6) -> bb1; // bb0[12]: scope 4 at $DIR/array-index-is-temporary.rs:15:21: 15:27
64+
// ty::Const
65+
// + ty: unsafe fn(*mut usize) -> u32 {foo}
66+
// + val: Value(Scalar(<ZST>))
67+
// mir::Constant
68+
// + span: $DIR/array-index-is-temporary.rs:15:21: 15:24
69+
// + literal: Const { ty: unsafe fn(*mut usize) -> u32 {foo}, val: Value(Scalar(<ZST>)) }
70+
}
71+
72+
bb1: {
73+
StorageDead(_6); // bb1[0]: scope 4 at $DIR/array-index-is-temporary.rs:15:26: 15:27
74+
StorageLive(_7); // bb1[1]: scope 3 at $DIR/array-index-is-temporary.rs:15:7: 15:8
75+
_7 = _2; // bb1[2]: scope 3 at $DIR/array-index-is-temporary.rs:15:7: 15:8
76+
_8 = Len(_1); // bb1[3]: scope 3 at $DIR/array-index-is-temporary.rs:15:5: 15:9
77+
_9 = Lt(_7, _8); // bb1[4]: scope 3 at $DIR/array-index-is-temporary.rs:15:5: 15:9
78+
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
79+
}
80+
81+
bb2: {
82+
_1[_7] = move _5; // bb2[0]: scope 3 at $DIR/array-index-is-temporary.rs:15:5: 15:29
83+
StorageDead(_5); // bb2[1]: scope 3 at $DIR/array-index-is-temporary.rs:15:28: 15:29
84+
StorageDead(_7); // bb2[2]: scope 3 at $DIR/array-index-is-temporary.rs:15:29: 15:30
85+
_0 = (); // bb2[3]: scope 0 at $DIR/array-index-is-temporary.rs:11:11: 16:2
86+
StorageDead(_3); // bb2[4]: scope 2 at $DIR/array-index-is-temporary.rs:16:1: 16:2
87+
StorageDead(_2); // bb2[5]: scope 1 at $DIR/array-index-is-temporary.rs:16:1: 16:2
88+
StorageDead(_1); // bb2[6]: scope 0 at $DIR/array-index-is-temporary.rs:16:1: 16:2
89+
return; // bb2[7]: scope 0 at $DIR/array-index-is-temporary.rs:16:2: 16:2
90+
}
91+
}

src/test/mir-opt/box_expr.rs

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#![feature(box_syntax)]
44

5+
// EMIT_MIR rustc.main.ElaborateDrops.before.mir
56
fn main() {
67
let x = box S::new();
78
drop(x);
@@ -18,60 +19,3 @@ impl Drop for S {
1819
println!("splat!");
1920
}
2021
}
21-
22-
// END RUST SOURCE
23-
// START rustc.main.ElaborateDrops.before.mir
24-
// let mut _0: ();
25-
// let _1: std::boxed::Box<S>;
26-
// let mut _2: std::boxed::Box<S>;
27-
// let _3: ();
28-
// let mut _4: std::boxed::Box<S>;
29-
// scope 1 {
30-
// debug x => _1;
31-
// }
32-
// bb0: {
33-
// StorageLive(_1);
34-
// StorageLive(_2);
35-
// _2 = Box(S);
36-
// (*_2) = const S::new() -> [return: bb2, unwind: bb3];
37-
// }
38-
//
39-
// bb1 (cleanup): {
40-
// resume;
41-
// }
42-
//
43-
// bb2: {
44-
// _1 = move _2;
45-
// drop(_2) -> bb4;
46-
// }
47-
//
48-
// bb3 (cleanup): {
49-
// drop(_2) -> bb1;
50-
// }
51-
//
52-
// bb4: {
53-
// StorageDead(_2);
54-
// StorageLive(_3);
55-
// StorageLive(_4);
56-
// _4 = move _1;
57-
// _3 = const std::mem::drop::<std::boxed::Box<S>>(move _4) -> [return: bb5, unwind: bb7];
58-
// }
59-
//
60-
// bb5: {
61-
// StorageDead(_4);
62-
// StorageDead(_3);
63-
// _0 = ();
64-
// drop(_1) -> bb8;
65-
// }
66-
// bb6 (cleanup): {
67-
// drop(_1) -> bb1;
68-
// }
69-
// bb7 (cleanup): {
70-
// drop(_4) -> bb6;
71-
// }
72-
// bb8: {
73-
// StorageDead(_1);
74-
// return;
75-
// }
76-
// }
77-
// END rustc.main.ElaborateDrops.before.mir

0 commit comments

Comments
 (0)