Skip to content

Commit 595657d

Browse files
Bless mir-opt tests
1 parent da1b320 commit 595657d

14 files changed

+265
-291
lines changed

src/test/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@
44
static mut BAR: *const &i32 = {
55
let mut _0: *const &i32; // return place in scope 0 at $DIR/const-promotion-extern-static.rs:9:17: 9:28
66
let mut _1: &[&i32]; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
7-
let mut _2: &[&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
8-
let _3: [&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
9-
let mut _4: &i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
10-
let _5: &i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
11-
+ let mut _6: &[&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
7+
let _2: &[&i32]; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
8+
let mut _3: &[&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
9+
let _4: [&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
10+
let mut _5: &i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
11+
let _6: &i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
12+
+ let mut _7: &[&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
1213

1314
bb0: {
1415
StorageLive(_1); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
1516
StorageLive(_2); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
16-
- StorageLive(_3); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
17-
- StorageLive(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
18-
- StorageLive(_5); // scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
19-
- _5 = const {alloc1: &i32}; // scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
20-
+ _6 = const BAR::promoted[0]; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
17+
StorageLive(_3); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
18+
- StorageLive(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
19+
- StorageLive(_5); // scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
20+
- StorageLive(_6); // scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
21+
- _6 = const {alloc1: &i32}; // scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
22+
+ _7 = const BAR::promoted[0]; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
2123
// ty::Const
2224
- // + ty: &i32
2325
- // + val: Value(Scalar(alloc1))
@@ -26,24 +28,26 @@
2628
// mir::Constant
2729
- // + span: $DIR/const-promotion-extern-static.rs:9:33: 9:34
2830
- // + literal: Const { ty: &i32, val: Value(Scalar(alloc1)) }
29-
- _4 = &(*_5); // scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
30-
- _3 = [move _4]; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
31-
- _2 = &_3; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
31+
- _5 = &(*_6); // scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
32+
- _4 = [move _5]; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
33+
- _3 = &_4; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
3234
+ // + span: $DIR/const-promotion-extern-static.rs:9:31: 9:44
3335
+ // + literal: Const { ty: &[&i32; 1], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:6 ~ const_promotion_extern_static[HASH]::BAR), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) }
34-
+ _2 = &(*_6); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
35-
_1 = move _2 as &[&i32] (Pointer(Unsize)); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
36-
- StorageDead(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:9:34: 9:35
37-
StorageDead(_2); // scope 0 at $DIR/const-promotion-extern-static.rs:9:34: 9:35
36+
+ _3 = &(*_7); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
37+
_2 = move _3 as &[&i32] (Pointer(Unsize)); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
38+
_1 = &(*_2); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
39+
- StorageDead(_5); // scope 0 at $DIR/const-promotion-extern-static.rs:9:34: 9:35
40+
StorageDead(_3); // scope 0 at $DIR/const-promotion-extern-static.rs:9:34: 9:35
3841
_0 = core::slice::<impl [&i32]>::as_ptr(move _1) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
3942
// mir::Constant
4043
// + span: $DIR/const-promotion-extern-static.rs:9:36: 9:42
4144
// + literal: Const { ty: for<'r> fn(&'r [&i32]) -> *const &i32 {core::slice::<impl [&i32]>::as_ptr}, val: Value(Scalar(<ZST>)) }
4245
}
4346

4447
bb1: {
45-
- StorageDead(_5); // scope 0 at $DIR/const-promotion-extern-static.rs:9:43: 9:44
46-
- StorageDead(_3); // scope 0 at $DIR/const-promotion-extern-static.rs:9:43: 9:44
48+
- StorageDead(_6); // scope 0 at $DIR/const-promotion-extern-static.rs:9:43: 9:44
49+
- StorageDead(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:9:43: 9:44
50+
StorageDead(_2); // scope 0 at $DIR/const-promotion-extern-static.rs:9:43: 9:44
4751
StorageDead(_1); // scope 0 at $DIR/const-promotion-extern-static.rs:9:43: 9:44
4852
return; // scope 0 at $DIR/const-promotion-extern-static.rs:9:1: 9:45
4953
}

src/test/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,24 @@
44
static mut FOO: *const &i32 = {
55
let mut _0: *const &i32; // return place in scope 0 at $DIR/const-promotion-extern-static.rs:13:17: 13:28
66
let mut _1: &[&i32]; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
7-
let mut _2: &[&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
8-
let _3: [&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
9-
let mut _4: &i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:32: 13:45
10-
let _5: *const i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
11-
+ let mut _6: &[&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
7+
let _2: &[&i32]; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
8+
let mut _3: &[&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
9+
let _4: [&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
10+
let mut _5: &i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:32: 13:45
11+
let _6: *const i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
12+
+ let mut _7: &[&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
1213
scope 1 {
1314
}
1415

1516
bb0: {
1617
StorageLive(_1); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
1718
StorageLive(_2); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
18-
- StorageLive(_3); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
19-
- StorageLive(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:13:32: 13:45
20-
- StorageLive(_5); // scope 1 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
21-
- _5 = const {alloc3: *const i32}; // scope 1 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
22-
+ _6 = const FOO::promoted[0]; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
19+
StorageLive(_3); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
20+
- StorageLive(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
21+
- StorageLive(_5); // scope 0 at $DIR/const-promotion-extern-static.rs:13:32: 13:45
22+
- StorageLive(_6); // scope 1 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
23+
- _6 = const {alloc3: *const i32}; // scope 1 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
24+
+ _7 = const FOO::promoted[0]; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
2325
// ty::Const
2426
- // + ty: *const i32
2527
- // + val: Value(Scalar(alloc3))
@@ -28,24 +30,26 @@
2830
// mir::Constant
2931
- // + span: $DIR/const-promotion-extern-static.rs:13:42: 13:43
3032
- // + literal: Const { ty: *const i32, val: Value(Scalar(alloc3)) }
31-
- _4 = &(*_5); // scope 1 at $DIR/const-promotion-extern-static.rs:13:41: 13:43
32-
- _3 = [move _4]; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
33-
- _2 = &_3; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
33+
- _5 = &(*_6); // scope 1 at $DIR/const-promotion-extern-static.rs:13:41: 13:43
34+
- _4 = [move _5]; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
35+
- _3 = &_4; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
3436
+ // + span: $DIR/const-promotion-extern-static.rs:13:31: 13:55
3537
+ // + literal: Const { ty: &[&i32; 1], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:7 ~ const_promotion_extern_static[HASH]::FOO), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) }
36-
+ _2 = &(*_6); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
37-
_1 = move _2 as &[&i32] (Pointer(Unsize)); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
38-
- StorageDead(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:13:45: 13:46
39-
StorageDead(_2); // scope 0 at $DIR/const-promotion-extern-static.rs:13:45: 13:46
38+
+ _3 = &(*_7); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
39+
_2 = move _3 as &[&i32] (Pointer(Unsize)); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
40+
_1 = &(*_2); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
41+
- StorageDead(_5); // scope 0 at $DIR/const-promotion-extern-static.rs:13:45: 13:46
42+
StorageDead(_3); // scope 0 at $DIR/const-promotion-extern-static.rs:13:45: 13:46
4043
_0 = core::slice::<impl [&i32]>::as_ptr(move _1) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
4144
// mir::Constant
4245
// + span: $DIR/const-promotion-extern-static.rs:13:47: 13:53
4346
// + literal: Const { ty: for<'r> fn(&'r [&i32]) -> *const &i32 {core::slice::<impl [&i32]>::as_ptr}, val: Value(Scalar(<ZST>)) }
4447
}
4548

4649
bb1: {
47-
- StorageDead(_5); // scope 0 at $DIR/const-promotion-extern-static.rs:13:54: 13:55
48-
- StorageDead(_3); // scope 0 at $DIR/const-promotion-extern-static.rs:13:54: 13:55
50+
- StorageDead(_6); // scope 0 at $DIR/const-promotion-extern-static.rs:13:54: 13:55
51+
- StorageDead(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:13:54: 13:55
52+
StorageDead(_2); // scope 0 at $DIR/const-promotion-extern-static.rs:13:54: 13:55
4953
StorageDead(_1); // scope 0 at $DIR/const-promotion-extern-static.rs:13:54: 13:55
5054
return; // scope 0 at $DIR/const-promotion-extern-static.rs:13:1: 13:56
5155
}

src/test/mir-opt/lower_array_len.array_bound.InstCombine.diff

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
let mut _4: usize; // in scope 0 at $DIR/lower_array_len.rs:7:8: 7:13
1010
let mut _5: usize; // in scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
1111
let mut _6: &[u8]; // in scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
12-
let mut _7: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
13-
let _8: usize; // in scope 0 at $DIR/lower_array_len.rs:8:15: 8:20
14-
let mut _9: usize; // in scope 0 at $DIR/lower_array_len.rs:8:9: 8:21
15-
let mut _10: bool; // in scope 0 at $DIR/lower_array_len.rs:8:9: 8:21
16-
let mut _11: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
12+
let _7: &[u8]; // in scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
13+
let mut _8: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
14+
let _9: usize; // in scope 0 at $DIR/lower_array_len.rs:8:15: 8:20
15+
let mut _10: usize; // in scope 0 at $DIR/lower_array_len.rs:8:9: 8:21
16+
let mut _11: bool; // in scope 0 at $DIR/lower_array_len.rs:8:9: 8:21
1717

1818
bb0: {
1919
StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:7:8: 7:27
@@ -22,34 +22,34 @@
2222
StorageLive(_5); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
2323
StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
2424
StorageLive(_7); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
25-
- _7 = &(*_2); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
26-
+ _7 = _2; // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
27-
StorageLive(_11); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
28-
_11 = _7; // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
29-
_6 = move _7 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
30-
StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:7:20: 7:21
31-
- _5 = Len((*_11)); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
32-
+ _5 = const N; // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
33-
StorageDead(_11); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
25+
StorageLive(_8); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
26+
- _8 = &(*_2); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
27+
+ _8 = _2; // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
28+
_7 = move _8 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
29+
- _6 = &(*_7); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
30+
+ _6 = _7; // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
31+
StorageDead(_8); // scope 0 at $DIR/lower_array_len.rs:7:20: 7:21
32+
_5 = Len((*_6)); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
3433
StorageDead(_6); // scope 0 at $DIR/lower_array_len.rs:7:26: 7:27
3534
_3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_array_len.rs:7:8: 7:27
35+
StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:7:26: 7:27
3636
StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:7:26: 7:27
3737
StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:7:26: 7:27
3838
switchInt(move _3) -> [false: bb3, otherwise: bb1]; // scope 0 at $DIR/lower_array_len.rs:7:8: 7:27
3939
}
4040

4141
bb1: {
42-
StorageLive(_8); // scope 0 at $DIR/lower_array_len.rs:8:15: 8:20
43-
_8 = _1; // scope 0 at $DIR/lower_array_len.rs:8:15: 8:20
44-
- _9 = Len((*_2)); // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21
45-
+ _9 = const N; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21
46-
_10 = Lt(_8, _9); // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21
47-
assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb2; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21
42+
StorageLive(_9); // scope 0 at $DIR/lower_array_len.rs:8:15: 8:20
43+
_9 = _1; // scope 0 at $DIR/lower_array_len.rs:8:15: 8:20
44+
- _10 = Len((*_2)); // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21
45+
+ _10 = const N; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21
46+
_11 = Lt(_9, _10); // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21
47+
assert(move _11, "index out of bounds: the length is {} but the index is {}", move _10, _9) -> bb2; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21
4848
}
4949

5050
bb2: {
51-
_0 = (*_2)[_8]; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21
52-
StorageDead(_8); // scope 0 at $DIR/lower_array_len.rs:9:5: 9:6
51+
_0 = (*_2)[_9]; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21
52+
StorageDead(_9); // scope 0 at $DIR/lower_array_len.rs:9:5: 9:6
5353
goto -> bb4; // scope 0 at $DIR/lower_array_len.rs:7:5: 11:6
5454
}
5555

0 commit comments

Comments
 (0)