Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit dfc469d

Browse files
committedSep 21, 2020
Run the test with explicit -O such that Add is generated instead of CheckedAdd
This makes the test run deterministic regardless of noopt testruns
1 parent 2bb3844 commit dfc469d

6 files changed

+198
-197
lines changed
 

‎src/test/mir-opt/inst_combine_deref.deep_opt.InstCombine.diff

Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,37 @@
22
+ // MIR for `deep_opt` after InstCombine
33

44
fn deep_opt() -> (u64, u64, u64) {
5-
let mut _0: (u64, u64, u64); // return place in scope 0 at $DIR/inst_combine_deref.rs:10:18: 10:33
6-
let _1: u64; // in scope 0 at $DIR/inst_combine_deref.rs:11:9: 11:11
7-
let mut _10: u64; // in scope 0 at $DIR/inst_combine_deref.rs:20:6: 20:8
8-
let mut _11: u64; // in scope 0 at $DIR/inst_combine_deref.rs:20:10: 20:12
9-
let mut _12: u64; // in scope 0 at $DIR/inst_combine_deref.rs:20:14: 20:16
5+
let mut _0: (u64, u64, u64); // return place in scope 0 at $DIR/inst_combine_deref.rs:11:18: 11:33
6+
let _1: u64; // in scope 0 at $DIR/inst_combine_deref.rs:12:9: 12:11
7+
let mut _10: u64; // in scope 0 at $DIR/inst_combine_deref.rs:21:6: 21:8
8+
let mut _11: u64; // in scope 0 at $DIR/inst_combine_deref.rs:21:10: 21:12
9+
let mut _12: u64; // in scope 0 at $DIR/inst_combine_deref.rs:21:14: 21:16
1010
scope 1 {
11-
debug x1 => _1; // in scope 1 at $DIR/inst_combine_deref.rs:11:9: 11:11
12-
let _2: u64; // in scope 1 at $DIR/inst_combine_deref.rs:12:9: 12:11
11+
debug x1 => _1; // in scope 1 at $DIR/inst_combine_deref.rs:12:9: 12:11
12+
let _2: u64; // in scope 1 at $DIR/inst_combine_deref.rs:13:9: 13:11
1313
scope 2 {
14-
debug x2 => _2; // in scope 2 at $DIR/inst_combine_deref.rs:12:9: 12:11
15-
let _3: u64; // in scope 2 at $DIR/inst_combine_deref.rs:13:9: 13:11
14+
debug x2 => _2; // in scope 2 at $DIR/inst_combine_deref.rs:13:9: 13:11
15+
let _3: u64; // in scope 2 at $DIR/inst_combine_deref.rs:14:9: 14:11
1616
scope 3 {
17-
debug x3 => _3; // in scope 3 at $DIR/inst_combine_deref.rs:13:9: 13:11
18-
let _4: &u64; // in scope 3 at $DIR/inst_combine_deref.rs:14:9: 14:11
17+
debug x3 => _3; // in scope 3 at $DIR/inst_combine_deref.rs:14:9: 14:11
18+
let _4: &u64; // in scope 3 at $DIR/inst_combine_deref.rs:15:9: 15:11
1919
scope 4 {
20-
debug y1 => _4; // in scope 4 at $DIR/inst_combine_deref.rs:14:9: 14:11
21-
let _5: &u64; // in scope 4 at $DIR/inst_combine_deref.rs:15:9: 15:11
20+
debug y1 => _4; // in scope 4 at $DIR/inst_combine_deref.rs:15:9: 15:11
21+
let _5: &u64; // in scope 4 at $DIR/inst_combine_deref.rs:16:9: 16:11
2222
scope 5 {
23-
debug y2 => _5; // in scope 5 at $DIR/inst_combine_deref.rs:15:9: 15:11
24-
let _6: &u64; // in scope 5 at $DIR/inst_combine_deref.rs:16:9: 16:11
23+
debug y2 => _5; // in scope 5 at $DIR/inst_combine_deref.rs:16:9: 16:11
24+
let _6: &u64; // in scope 5 at $DIR/inst_combine_deref.rs:17:9: 17:11
2525
scope 6 {
26-
debug y3 => _6; // in scope 6 at $DIR/inst_combine_deref.rs:16:9: 16:11
27-
let _7: u64; // in scope 6 at $DIR/inst_combine_deref.rs:17:9: 17:11
26+
debug y3 => _6; // in scope 6 at $DIR/inst_combine_deref.rs:17:9: 17:11
27+
let _7: u64; // in scope 6 at $DIR/inst_combine_deref.rs:18:9: 18:11
2828
scope 7 {
29-
debug z1 => _7; // in scope 7 at $DIR/inst_combine_deref.rs:17:9: 17:11
30-
let _8: u64; // in scope 7 at $DIR/inst_combine_deref.rs:18:9: 18:11
29+
debug z1 => _7; // in scope 7 at $DIR/inst_combine_deref.rs:18:9: 18:11
30+
let _8: u64; // in scope 7 at $DIR/inst_combine_deref.rs:19:9: 19:11
3131
scope 8 {
32-
debug z2 => _8; // in scope 8 at $DIR/inst_combine_deref.rs:18:9: 18:11
33-
let _9: u64; // in scope 8 at $DIR/inst_combine_deref.rs:19:9: 19:11
32+
debug z2 => _8; // in scope 8 at $DIR/inst_combine_deref.rs:19:9: 19:11
33+
let _9: u64; // in scope 8 at $DIR/inst_combine_deref.rs:20:9: 20:11
3434
scope 9 {
35-
debug z3 => _9; // in scope 9 at $DIR/inst_combine_deref.rs:19:9: 19:11
35+
debug z3 => _9; // in scope 9 at $DIR/inst_combine_deref.rs:20:9: 20:11
3636
}
3737
}
3838
}
@@ -44,49 +44,49 @@
4444
}
4545

4646
bb0: {
47-
StorageLive(_1); // scope 0 at $DIR/inst_combine_deref.rs:11:9: 11:11
48-
_1 = const 1_u64; // scope 0 at $DIR/inst_combine_deref.rs:11:14: 11:15
49-
StorageLive(_2); // scope 1 at $DIR/inst_combine_deref.rs:12:9: 12:11
50-
_2 = const 2_u64; // scope 1 at $DIR/inst_combine_deref.rs:12:14: 12:15
51-
StorageLive(_3); // scope 2 at $DIR/inst_combine_deref.rs:13:9: 13:11
52-
_3 = const 3_u64; // scope 2 at $DIR/inst_combine_deref.rs:13:14: 13:15
53-
StorageLive(_4); // scope 3 at $DIR/inst_combine_deref.rs:14:9: 14:11
54-
_4 = &_1; // scope 3 at $DIR/inst_combine_deref.rs:14:14: 14:17
55-
StorageLive(_5); // scope 4 at $DIR/inst_combine_deref.rs:15:9: 15:11
56-
_5 = &_2; // scope 4 at $DIR/inst_combine_deref.rs:15:14: 15:17
57-
StorageLive(_6); // scope 5 at $DIR/inst_combine_deref.rs:16:9: 16:11
58-
_6 = &_3; // scope 5 at $DIR/inst_combine_deref.rs:16:14: 16:17
59-
StorageLive(_7); // scope 6 at $DIR/inst_combine_deref.rs:17:9: 17:11
60-
- _7 = (*_4); // scope 6 at $DIR/inst_combine_deref.rs:17:14: 17:17
61-
+ _7 = _1; // scope 6 at $DIR/inst_combine_deref.rs:17:14: 17:17
62-
StorageLive(_8); // scope 7 at $DIR/inst_combine_deref.rs:18:9: 18:11
63-
- _8 = (*_5); // scope 7 at $DIR/inst_combine_deref.rs:18:14: 18:17
64-
+ _8 = _2; // scope 7 at $DIR/inst_combine_deref.rs:18:14: 18:17
65-
StorageLive(_9); // scope 8 at $DIR/inst_combine_deref.rs:19:9: 19:11
66-
- _9 = (*_6); // scope 8 at $DIR/inst_combine_deref.rs:19:14: 19:17
67-
+ _9 = _3; // scope 8 at $DIR/inst_combine_deref.rs:19:14: 19:17
68-
StorageLive(_10); // scope 9 at $DIR/inst_combine_deref.rs:20:6: 20:8
69-
_10 = _7; // scope 9 at $DIR/inst_combine_deref.rs:20:6: 20:8
70-
StorageLive(_11); // scope 9 at $DIR/inst_combine_deref.rs:20:10: 20:12
71-
_11 = _8; // scope 9 at $DIR/inst_combine_deref.rs:20:10: 20:12
72-
StorageLive(_12); // scope 9 at $DIR/inst_combine_deref.rs:20:14: 20:16
73-
_12 = _9; // scope 9 at $DIR/inst_combine_deref.rs:20:14: 20:16
74-
(_0.0: u64) = move _10; // scope 9 at $DIR/inst_combine_deref.rs:20:5: 20:17
75-
(_0.1: u64) = move _11; // scope 9 at $DIR/inst_combine_deref.rs:20:5: 20:17
76-
(_0.2: u64) = move _12; // scope 9 at $DIR/inst_combine_deref.rs:20:5: 20:17
77-
StorageDead(_12); // scope 9 at $DIR/inst_combine_deref.rs:20:16: 20:17
78-
StorageDead(_11); // scope 9 at $DIR/inst_combine_deref.rs:20:16: 20:17
79-
StorageDead(_10); // scope 9 at $DIR/inst_combine_deref.rs:20:16: 20:17
80-
StorageDead(_9); // scope 8 at $DIR/inst_combine_deref.rs:21:1: 21:2
81-
StorageDead(_8); // scope 7 at $DIR/inst_combine_deref.rs:21:1: 21:2
82-
StorageDead(_7); // scope 6 at $DIR/inst_combine_deref.rs:21:1: 21:2
83-
StorageDead(_6); // scope 5 at $DIR/inst_combine_deref.rs:21:1: 21:2
84-
StorageDead(_5); // scope 4 at $DIR/inst_combine_deref.rs:21:1: 21:2
85-
StorageDead(_4); // scope 3 at $DIR/inst_combine_deref.rs:21:1: 21:2
86-
StorageDead(_3); // scope 2 at $DIR/inst_combine_deref.rs:21:1: 21:2
87-
StorageDead(_2); // scope 1 at $DIR/inst_combine_deref.rs:21:1: 21:2
88-
StorageDead(_1); // scope 0 at $DIR/inst_combine_deref.rs:21:1: 21:2
89-
return; // scope 0 at $DIR/inst_combine_deref.rs:21:2: 21:2
47+
StorageLive(_1); // scope 0 at $DIR/inst_combine_deref.rs:12:9: 12:11
48+
_1 = const 1_u64; // scope 0 at $DIR/inst_combine_deref.rs:12:14: 12:15
49+
StorageLive(_2); // scope 1 at $DIR/inst_combine_deref.rs:13:9: 13:11
50+
_2 = const 2_u64; // scope 1 at $DIR/inst_combine_deref.rs:13:14: 13:15
51+
StorageLive(_3); // scope 2 at $DIR/inst_combine_deref.rs:14:9: 14:11
52+
_3 = const 3_u64; // scope 2 at $DIR/inst_combine_deref.rs:14:14: 14:15
53+
StorageLive(_4); // scope 3 at $DIR/inst_combine_deref.rs:15:9: 15:11
54+
_4 = &_1; // scope 3 at $DIR/inst_combine_deref.rs:15:14: 15:17
55+
StorageLive(_5); // scope 4 at $DIR/inst_combine_deref.rs:16:9: 16:11
56+
_5 = &_2; // scope 4 at $DIR/inst_combine_deref.rs:16:14: 16:17
57+
StorageLive(_6); // scope 5 at $DIR/inst_combine_deref.rs:17:9: 17:11
58+
_6 = &_3; // scope 5 at $DIR/inst_combine_deref.rs:17:14: 17:17
59+
StorageLive(_7); // scope 6 at $DIR/inst_combine_deref.rs:18:9: 18:11
60+
- _7 = (*_4); // scope 6 at $DIR/inst_combine_deref.rs:18:14: 18:17
61+
+ _7 = _1; // scope 6 at $DIR/inst_combine_deref.rs:18:14: 18:17
62+
StorageLive(_8); // scope 7 at $DIR/inst_combine_deref.rs:19:9: 19:11
63+
- _8 = (*_5); // scope 7 at $DIR/inst_combine_deref.rs:19:14: 19:17
64+
+ _8 = _2; // scope 7 at $DIR/inst_combine_deref.rs:19:14: 19:17
65+
StorageLive(_9); // scope 8 at $DIR/inst_combine_deref.rs:20:9: 20:11
66+
- _9 = (*_6); // scope 8 at $DIR/inst_combine_deref.rs:20:14: 20:17
67+
+ _9 = _3; // scope 8 at $DIR/inst_combine_deref.rs:20:14: 20:17
68+
StorageLive(_10); // scope 9 at $DIR/inst_combine_deref.rs:21:6: 21:8
69+
_10 = _7; // scope 9 at $DIR/inst_combine_deref.rs:21:6: 21:8
70+
StorageLive(_11); // scope 9 at $DIR/inst_combine_deref.rs:21:10: 21:12
71+
_11 = _8; // scope 9 at $DIR/inst_combine_deref.rs:21:10: 21:12
72+
StorageLive(_12); // scope 9 at $DIR/inst_combine_deref.rs:21:14: 21:16
73+
_12 = _9; // scope 9 at $DIR/inst_combine_deref.rs:21:14: 21:16
74+
(_0.0: u64) = move _10; // scope 9 at $DIR/inst_combine_deref.rs:21:5: 21:17
75+
(_0.1: u64) = move _11; // scope 9 at $DIR/inst_combine_deref.rs:21:5: 21:17
76+
(_0.2: u64) = move _12; // scope 9 at $DIR/inst_combine_deref.rs:21:5: 21:17
77+
StorageDead(_12); // scope 9 at $DIR/inst_combine_deref.rs:21:16: 21:17
78+
StorageDead(_11); // scope 9 at $DIR/inst_combine_deref.rs:21:16: 21:17
79+
StorageDead(_10); // scope 9 at $DIR/inst_combine_deref.rs:21:16: 21:17
80+
StorageDead(_9); // scope 8 at $DIR/inst_combine_deref.rs:22:1: 22:2
81+
StorageDead(_8); // scope 7 at $DIR/inst_combine_deref.rs:22:1: 22:2
82+
StorageDead(_7); // scope 6 at $DIR/inst_combine_deref.rs:22:1: 22:2
83+
StorageDead(_6); // scope 5 at $DIR/inst_combine_deref.rs:22:1: 22:2
84+
StorageDead(_5); // scope 4 at $DIR/inst_combine_deref.rs:22:1: 22:2
85+
StorageDead(_4); // scope 3 at $DIR/inst_combine_deref.rs:22:1: 22:2
86+
StorageDead(_3); // scope 2 at $DIR/inst_combine_deref.rs:22:1: 22:2
87+
StorageDead(_2); // scope 1 at $DIR/inst_combine_deref.rs:22:1: 22:2
88+
StorageDead(_1); // scope 0 at $DIR/inst_combine_deref.rs:22:1: 22:2
89+
return; // scope 0 at $DIR/inst_combine_deref.rs:22:2: 22:2
9090
}
9191
}
9292

‎src/test/mir-opt/inst_combine_deref.do_not_miscompile.InstCombine.diff

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2,70 +2,70 @@
22
+ // MIR for `do_not_miscompile` after InstCombine
33

44
fn do_not_miscompile() -> () {
5-
let mut _0: (); // return place in scope 0 at $DIR/inst_combine_deref.rs:53:24: 53:24
6-
let _1: i32; // in scope 0 at $DIR/inst_combine_deref.rs:54:9: 54:10
7-
let mut _5: &i32; // in scope 0 at $DIR/inst_combine_deref.rs:58:10: 58:12
8-
let _6: &i32; // in scope 0 at $DIR/inst_combine_deref.rs:58:10: 58:12
9-
let _7: (); // in scope 0 at $DIR/inst_combine_deref.rs:59:5: 59:23
10-
let mut _8: bool; // in scope 0 at $DIR/inst_combine_deref.rs:59:5: 59:23
11-
let mut _9: bool; // in scope 0 at $DIR/inst_combine_deref.rs:59:13: 59:21
12-
let mut _10: i32; // in scope 0 at $DIR/inst_combine_deref.rs:59:13: 59:15
5+
let mut _0: (); // return place in scope 0 at $DIR/inst_combine_deref.rs:54:24: 54:24
6+
let _1: i32; // in scope 0 at $DIR/inst_combine_deref.rs:55:9: 55:10
7+
let mut _5: &i32; // in scope 0 at $DIR/inst_combine_deref.rs:59:10: 59:12
8+
let _6: &i32; // in scope 0 at $DIR/inst_combine_deref.rs:59:10: 59:12
9+
let _7: (); // in scope 0 at $DIR/inst_combine_deref.rs:60:5: 60:23
10+
let mut _8: bool; // in scope 0 at $DIR/inst_combine_deref.rs:60:5: 60:23
11+
let mut _9: bool; // in scope 0 at $DIR/inst_combine_deref.rs:60:13: 60:21
12+
let mut _10: i32; // in scope 0 at $DIR/inst_combine_deref.rs:60:13: 60:15
1313
let mut _11: !; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
1414
scope 1 {
15-
debug x => _1; // in scope 1 at $DIR/inst_combine_deref.rs:54:9: 54:10
16-
let _2: i32; // in scope 1 at $DIR/inst_combine_deref.rs:55:9: 55:10
15+
debug x => _1; // in scope 1 at $DIR/inst_combine_deref.rs:55:9: 55:10
16+
let _2: i32; // in scope 1 at $DIR/inst_combine_deref.rs:56:9: 56:10
1717
scope 2 {
18-
debug a => _2; // in scope 2 at $DIR/inst_combine_deref.rs:55:9: 55:10
19-
let mut _3: &i32; // in scope 2 at $DIR/inst_combine_deref.rs:56:9: 56:14
18+
debug a => _2; // in scope 2 at $DIR/inst_combine_deref.rs:56:9: 56:10
19+
let mut _3: &i32; // in scope 2 at $DIR/inst_combine_deref.rs:57:9: 57:14
2020
scope 3 {
21-
debug y => _3; // in scope 3 at $DIR/inst_combine_deref.rs:56:9: 56:14
22-
let _4: &mut &i32; // in scope 3 at $DIR/inst_combine_deref.rs:57:9: 57:10
21+
debug y => _3; // in scope 3 at $DIR/inst_combine_deref.rs:57:9: 57:14
22+
let _4: &mut &i32; // in scope 3 at $DIR/inst_combine_deref.rs:58:9: 58:10
2323
scope 4 {
24-
debug z => _4; // in scope 4 at $DIR/inst_combine_deref.rs:57:9: 57:10
24+
debug z => _4; // in scope 4 at $DIR/inst_combine_deref.rs:58:9: 58:10
2525
}
2626
}
2727
}
2828
}
2929

3030
bb0: {
31-
StorageLive(_1); // scope 0 at $DIR/inst_combine_deref.rs:54:9: 54:10
32-
_1 = const 42_i32; // scope 0 at $DIR/inst_combine_deref.rs:54:13: 54:15
33-
StorageLive(_2); // scope 1 at $DIR/inst_combine_deref.rs:55:9: 55:10
34-
_2 = const 99_i32; // scope 1 at $DIR/inst_combine_deref.rs:55:13: 55:15
35-
StorageLive(_3); // scope 2 at $DIR/inst_combine_deref.rs:56:9: 56:14
36-
_3 = &_1; // scope 2 at $DIR/inst_combine_deref.rs:56:17: 56:19
37-
StorageLive(_4); // scope 3 at $DIR/inst_combine_deref.rs:57:9: 57:10
38-
_4 = &mut _3; // scope 3 at $DIR/inst_combine_deref.rs:57:13: 57:19
39-
StorageLive(_5); // scope 4 at $DIR/inst_combine_deref.rs:58:10: 58:12
40-
StorageLive(_6); // scope 4 at $DIR/inst_combine_deref.rs:58:10: 58:12
41-
_6 = &_2; // scope 4 at $DIR/inst_combine_deref.rs:58:10: 58:12
42-
- _5 = &(*_6); // scope 4 at $DIR/inst_combine_deref.rs:58:10: 58:12
43-
+ _5 = _6; // scope 4 at $DIR/inst_combine_deref.rs:58:10: 58:12
44-
(*_4) = move _5; // scope 4 at $DIR/inst_combine_deref.rs:58:5: 58:12
45-
StorageDead(_5); // scope 4 at $DIR/inst_combine_deref.rs:58:11: 58:12
46-
StorageDead(_6); // scope 4 at $DIR/inst_combine_deref.rs:58:12: 58:13
47-
StorageLive(_7); // scope 4 at $DIR/inst_combine_deref.rs:59:5: 59:23
48-
StorageLive(_8); // scope 4 at $DIR/inst_combine_deref.rs:59:5: 59:23
49-
StorageLive(_9); // scope 4 at $DIR/inst_combine_deref.rs:59:13: 59:21
50-
StorageLive(_10); // scope 4 at $DIR/inst_combine_deref.rs:59:13: 59:15
51-
_10 = (*_3); // scope 4 at $DIR/inst_combine_deref.rs:59:13: 59:15
52-
_9 = Eq(move _10, const 99_i32); // scope 4 at $DIR/inst_combine_deref.rs:59:13: 59:21
53-
StorageDead(_10); // scope 4 at $DIR/inst_combine_deref.rs:59:20: 59:21
54-
_8 = Not(move _9); // scope 4 at $DIR/inst_combine_deref.rs:59:5: 59:23
55-
StorageDead(_9); // scope 4 at $DIR/inst_combine_deref.rs:59:22: 59:23
56-
switchInt(_8) -> [false: bb1, otherwise: bb2]; // scope 4 at $DIR/inst_combine_deref.rs:59:5: 59:23
31+
StorageLive(_1); // scope 0 at $DIR/inst_combine_deref.rs:55:9: 55:10
32+
_1 = const 42_i32; // scope 0 at $DIR/inst_combine_deref.rs:55:13: 55:15
33+
StorageLive(_2); // scope 1 at $DIR/inst_combine_deref.rs:56:9: 56:10
34+
_2 = const 99_i32; // scope 1 at $DIR/inst_combine_deref.rs:56:13: 56:15
35+
StorageLive(_3); // scope 2 at $DIR/inst_combine_deref.rs:57:9: 57:14
36+
_3 = &_1; // scope 2 at $DIR/inst_combine_deref.rs:57:17: 57:19
37+
StorageLive(_4); // scope 3 at $DIR/inst_combine_deref.rs:58:9: 58:10
38+
_4 = &mut _3; // scope 3 at $DIR/inst_combine_deref.rs:58:13: 58:19
39+
StorageLive(_5); // scope 4 at $DIR/inst_combine_deref.rs:59:10: 59:12
40+
StorageLive(_6); // scope 4 at $DIR/inst_combine_deref.rs:59:10: 59:12
41+
_6 = &_2; // scope 4 at $DIR/inst_combine_deref.rs:59:10: 59:12
42+
- _5 = &(*_6); // scope 4 at $DIR/inst_combine_deref.rs:59:10: 59:12
43+
+ _5 = _6; // scope 4 at $DIR/inst_combine_deref.rs:59:10: 59:12
44+
(*_4) = move _5; // scope 4 at $DIR/inst_combine_deref.rs:59:5: 59:12
45+
StorageDead(_5); // scope 4 at $DIR/inst_combine_deref.rs:59:11: 59:12
46+
StorageDead(_6); // scope 4 at $DIR/inst_combine_deref.rs:59:12: 59:13
47+
StorageLive(_7); // scope 4 at $DIR/inst_combine_deref.rs:60:5: 60:23
48+
StorageLive(_8); // scope 4 at $DIR/inst_combine_deref.rs:60:5: 60:23
49+
StorageLive(_9); // scope 4 at $DIR/inst_combine_deref.rs:60:13: 60:21
50+
StorageLive(_10); // scope 4 at $DIR/inst_combine_deref.rs:60:13: 60:15
51+
_10 = (*_3); // scope 4 at $DIR/inst_combine_deref.rs:60:13: 60:15
52+
_9 = Eq(move _10, const 99_i32); // scope 4 at $DIR/inst_combine_deref.rs:60:13: 60:21
53+
StorageDead(_10); // scope 4 at $DIR/inst_combine_deref.rs:60:20: 60:21
54+
_8 = Not(move _9); // scope 4 at $DIR/inst_combine_deref.rs:60:5: 60:23
55+
StorageDead(_9); // scope 4 at $DIR/inst_combine_deref.rs:60:22: 60:23
56+
switchInt(_8) -> [false: bb1, otherwise: bb2]; // scope 4 at $DIR/inst_combine_deref.rs:60:5: 60:23
5757
}
5858

5959
bb1: {
60-
_7 = const (); // scope 4 at $DIR/inst_combine_deref.rs:59:5: 59:23
61-
StorageDead(_8); // scope 4 at $DIR/inst_combine_deref.rs:59:22: 59:23
62-
StorageDead(_7); // scope 4 at $DIR/inst_combine_deref.rs:59:22: 59:23
63-
_0 = const (); // scope 0 at $DIR/inst_combine_deref.rs:53:24: 60:2
64-
StorageDead(_4); // scope 3 at $DIR/inst_combine_deref.rs:60:1: 60:2
65-
StorageDead(_3); // scope 2 at $DIR/inst_combine_deref.rs:60:1: 60:2
66-
StorageDead(_2); // scope 1 at $DIR/inst_combine_deref.rs:60:1: 60:2
67-
StorageDead(_1); // scope 0 at $DIR/inst_combine_deref.rs:60:1: 60:2
68-
return; // scope 0 at $DIR/inst_combine_deref.rs:60:2: 60:2
60+
_7 = const (); // scope 4 at $DIR/inst_combine_deref.rs:60:5: 60:23
61+
StorageDead(_8); // scope 4 at $DIR/inst_combine_deref.rs:60:22: 60:23
62+
StorageDead(_7); // scope 4 at $DIR/inst_combine_deref.rs:60:22: 60:23
63+
_0 = const (); // scope 0 at $DIR/inst_combine_deref.rs:54:24: 61:2
64+
StorageDead(_4); // scope 3 at $DIR/inst_combine_deref.rs:61:1: 61:2
65+
StorageDead(_3); // scope 2 at $DIR/inst_combine_deref.rs:61:1: 61:2
66+
StorageDead(_2); // scope 1 at $DIR/inst_combine_deref.rs:61:1: 61:2
67+
StorageDead(_1); // scope 0 at $DIR/inst_combine_deref.rs:61:1: 61:2
68+
return; // scope 0 at $DIR/inst_combine_deref.rs:61:2: 61:2
6969
}
7070

7171
bb2: {

‎src/test/mir-opt/inst_combine_deref.dont_opt.InstCombine.diff

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,52 @@
22
+ // MIR for `dont_opt` after InstCombine
33

44
fn dont_opt() -> u64 {
5-
let mut _0: u64; // return place in scope 0 at $DIR/inst_combine_deref.rs:42:18: 42:21
6-
let _1: i32; // in scope 0 at $DIR/inst_combine_deref.rs:43:9: 43:10
7-
let mut _5: &i32; // in scope 0 at $DIR/inst_combine_deref.rs:47:10: 47:14
5+
let mut _0: u64; // return place in scope 0 at $DIR/inst_combine_deref.rs:43:18: 43:21
6+
let _1: i32; // in scope 0 at $DIR/inst_combine_deref.rs:44:9: 44:10
7+
let mut _5: &i32; // in scope 0 at $DIR/inst_combine_deref.rs:48:10: 48:14
88
scope 1 {
9-
debug y => _1; // in scope 1 at $DIR/inst_combine_deref.rs:43:9: 43:10
10-
let _2: &i32; // in scope 1 at $DIR/inst_combine_deref.rs:44:9: 44:13
9+
debug y => _1; // in scope 1 at $DIR/inst_combine_deref.rs:44:9: 44:10
10+
let _2: &i32; // in scope 1 at $DIR/inst_combine_deref.rs:45:9: 45:13
1111
scope 2 {
12-
debug _ref => _2; // in scope 2 at $DIR/inst_combine_deref.rs:44:9: 44:13
13-
let _3: i32; // in scope 2 at $DIR/inst_combine_deref.rs:45:9: 45:10
12+
debug _ref => _2; // in scope 2 at $DIR/inst_combine_deref.rs:45:9: 45:13
13+
let _3: i32; // in scope 2 at $DIR/inst_combine_deref.rs:46:9: 46:10
1414
scope 3 {
15-
debug x => _3; // in scope 3 at $DIR/inst_combine_deref.rs:45:9: 45:10
16-
let mut _4: &i32; // in scope 3 at $DIR/inst_combine_deref.rs:46:9: 46:15
15+
debug x => _3; // in scope 3 at $DIR/inst_combine_deref.rs:46:9: 46:10
16+
let mut _4: &i32; // in scope 3 at $DIR/inst_combine_deref.rs:47:9: 47:15
1717
scope 4 {
18-
debug _1 => _4; // in scope 4 at $DIR/inst_combine_deref.rs:46:9: 46:15
19-
let _6: i32; // in scope 4 at $DIR/inst_combine_deref.rs:48:9: 48:11
18+
debug _1 => _4; // in scope 4 at $DIR/inst_combine_deref.rs:47:9: 47:15
19+
let _6: i32; // in scope 4 at $DIR/inst_combine_deref.rs:49:9: 49:11
2020
scope 5 {
21-
debug _4 => _6; // in scope 5 at $DIR/inst_combine_deref.rs:48:9: 48:11
21+
debug _4 => _6; // in scope 5 at $DIR/inst_combine_deref.rs:49:9: 49:11
2222
}
2323
}
2424
}
2525
}
2626
}
2727

2828
bb0: {
29-
StorageLive(_1); // scope 0 at $DIR/inst_combine_deref.rs:43:9: 43:10
30-
_1 = const 5_i32; // scope 0 at $DIR/inst_combine_deref.rs:43:13: 43:14
31-
StorageLive(_2); // scope 1 at $DIR/inst_combine_deref.rs:44:9: 44:13
32-
_2 = &_1; // scope 1 at $DIR/inst_combine_deref.rs:44:16: 44:18
33-
StorageLive(_3); // scope 2 at $DIR/inst_combine_deref.rs:45:9: 45:10
34-
_3 = const 5_i32; // scope 2 at $DIR/inst_combine_deref.rs:45:13: 45:14
35-
StorageLive(_4); // scope 3 at $DIR/inst_combine_deref.rs:46:9: 46:15
36-
_4 = &_3; // scope 3 at $DIR/inst_combine_deref.rs:46:18: 46:20
37-
StorageLive(_5); // scope 4 at $DIR/inst_combine_deref.rs:47:10: 47:14
38-
- _5 = &(*_2); // scope 4 at $DIR/inst_combine_deref.rs:47:10: 47:14
39-
+ _5 = _2; // scope 4 at $DIR/inst_combine_deref.rs:47:10: 47:14
40-
_4 = move _5; // scope 4 at $DIR/inst_combine_deref.rs:47:5: 47:14
41-
StorageDead(_5); // scope 4 at $DIR/inst_combine_deref.rs:47:13: 47:14
42-
StorageLive(_6); // scope 4 at $DIR/inst_combine_deref.rs:48:9: 48:11
43-
_6 = (*_4); // scope 4 at $DIR/inst_combine_deref.rs:48:14: 48:17
44-
_0 = const 0_u64; // scope 5 at $DIR/inst_combine_deref.rs:49:5: 49:6
45-
StorageDead(_6); // scope 4 at $DIR/inst_combine_deref.rs:50:1: 50:2
46-
StorageDead(_4); // scope 3 at $DIR/inst_combine_deref.rs:50:1: 50:2
47-
StorageDead(_3); // scope 2 at $DIR/inst_combine_deref.rs:50:1: 50:2
48-
StorageDead(_2); // scope 1 at $DIR/inst_combine_deref.rs:50:1: 50:2
49-
StorageDead(_1); // scope 0 at $DIR/inst_combine_deref.rs:50:1: 50:2
50-
return; // scope 0 at $DIR/inst_combine_deref.rs:50:2: 50:2
29+
StorageLive(_1); // scope 0 at $DIR/inst_combine_deref.rs:44:9: 44:10
30+
_1 = const 5_i32; // scope 0 at $DIR/inst_combine_deref.rs:44:13: 44:14
31+
StorageLive(_2); // scope 1 at $DIR/inst_combine_deref.rs:45:9: 45:13
32+
_2 = &_1; // scope 1 at $DIR/inst_combine_deref.rs:45:16: 45:18
33+
StorageLive(_3); // scope 2 at $DIR/inst_combine_deref.rs:46:9: 46:10
34+
_3 = const 5_i32; // scope 2 at $DIR/inst_combine_deref.rs:46:13: 46:14
35+
StorageLive(_4); // scope 3 at $DIR/inst_combine_deref.rs:47:9: 47:15
36+
_4 = &_3; // scope 3 at $DIR/inst_combine_deref.rs:47:18: 47:20
37+
StorageLive(_5); // scope 4 at $DIR/inst_combine_deref.rs:48:10: 48:14
38+
- _5 = &(*_2); // scope 4 at $DIR/inst_combine_deref.rs:48:10: 48:14
39+
+ _5 = _2; // scope 4 at $DIR/inst_combine_deref.rs:48:10: 48:14
40+
_4 = move _5; // scope 4 at $DIR/inst_combine_deref.rs:48:5: 48:14
41+
StorageDead(_5); // scope 4 at $DIR/inst_combine_deref.rs:48:13: 48:14
42+
StorageLive(_6); // scope 4 at $DIR/inst_combine_deref.rs:49:9: 49:11
43+
_6 = (*_4); // scope 4 at $DIR/inst_combine_deref.rs:49:14: 49:17
44+
_0 = const 0_u64; // scope 5 at $DIR/inst_combine_deref.rs:50:5: 50:6
45+
StorageDead(_6); // scope 4 at $DIR/inst_combine_deref.rs:51:1: 51:2
46+
StorageDead(_4); // scope 3 at $DIR/inst_combine_deref.rs:51:1: 51:2
47+
StorageDead(_3); // scope 2 at $DIR/inst_combine_deref.rs:51:1: 51:2
48+
StorageDead(_2); // scope 1 at $DIR/inst_combine_deref.rs:51:1: 51:2
49+
StorageDead(_1); // scope 0 at $DIR/inst_combine_deref.rs:51:1: 51:2
50+
return; // scope 0 at $DIR/inst_combine_deref.rs:51:2: 51:2
5151
}
5252
}
5353

‎src/test/mir-opt/inst_combine_deref.opt_struct.InstCombine.diff

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,43 @@
22
+ // MIR for `opt_struct` after InstCombine
33

44
fn opt_struct(_1: S) -> u64 {
5-
debug s => _1; // in scope 0 at $DIR/inst_combine_deref.rs:29:15: 29:16
6-
let mut _0: u64; // return place in scope 0 at $DIR/inst_combine_deref.rs:29:24: 29:27
7-
let _2: &u64; // in scope 0 at $DIR/inst_combine_deref.rs:30:9: 30:10
8-
let mut _5: u64; // in scope 0 at $DIR/inst_combine_deref.rs:33:5: 33:7
9-
let mut _6: u64; // in scope 0 at $DIR/inst_combine_deref.rs:33:10: 33:11
5+
debug s => _1; // in scope 0 at $DIR/inst_combine_deref.rs:30:15: 30:16
6+
let mut _0: u64; // return place in scope 0 at $DIR/inst_combine_deref.rs:30:24: 30:27
7+
let _2: &u64; // in scope 0 at $DIR/inst_combine_deref.rs:31:9: 31:10
8+
let mut _5: u64; // in scope 0 at $DIR/inst_combine_deref.rs:34:5: 34:7
9+
let mut _6: u64; // in scope 0 at $DIR/inst_combine_deref.rs:34:10: 34:11
1010
scope 1 {
11-
debug a => _2; // in scope 1 at $DIR/inst_combine_deref.rs:30:9: 30:10
12-
let _3: &u64; // in scope 1 at $DIR/inst_combine_deref.rs:31:9: 31:10
11+
debug a => _2; // in scope 1 at $DIR/inst_combine_deref.rs:31:9: 31:10
12+
let _3: &u64; // in scope 1 at $DIR/inst_combine_deref.rs:32:9: 32:10
1313
scope 2 {
14-
debug b => _3; // in scope 2 at $DIR/inst_combine_deref.rs:31:9: 31:10
15-
let _4: u64; // in scope 2 at $DIR/inst_combine_deref.rs:32:9: 32:10
14+
debug b => _3; // in scope 2 at $DIR/inst_combine_deref.rs:32:9: 32:10
15+
let _4: u64; // in scope 2 at $DIR/inst_combine_deref.rs:33:9: 33:10
1616
scope 3 {
17-
debug x => _4; // in scope 3 at $DIR/inst_combine_deref.rs:32:9: 32:10
17+
debug x => _4; // in scope 3 at $DIR/inst_combine_deref.rs:33:9: 33:10
1818
}
1919
}
2020
}
2121

2222
bb0: {
23-
StorageLive(_2); // scope 0 at $DIR/inst_combine_deref.rs:30:9: 30:10
24-
_2 = &(_1.0: u64); // scope 0 at $DIR/inst_combine_deref.rs:30:13: 30:17
25-
StorageLive(_3); // scope 1 at $DIR/inst_combine_deref.rs:31:9: 31:10
26-
_3 = &(_1.1: u64); // scope 1 at $DIR/inst_combine_deref.rs:31:13: 31:17
27-
StorageLive(_4); // scope 2 at $DIR/inst_combine_deref.rs:32:9: 32:10
28-
- _4 = (*_2); // scope 2 at $DIR/inst_combine_deref.rs:32:13: 32:15
29-
+ _4 = (_1.0: u64); // scope 2 at $DIR/inst_combine_deref.rs:32:13: 32:15
30-
StorageLive(_5); // scope 3 at $DIR/inst_combine_deref.rs:33:5: 33:7
31-
- _5 = (*_3); // scope 3 at $DIR/inst_combine_deref.rs:33:5: 33:7
32-
+ _5 = (_1.1: u64); // scope 3 at $DIR/inst_combine_deref.rs:33:5: 33:7
33-
StorageLive(_6); // scope 3 at $DIR/inst_combine_deref.rs:33:10: 33:11
34-
_6 = _4; // scope 3 at $DIR/inst_combine_deref.rs:33:10: 33:11
35-
_0 = Add(move _5, move _6); // scope 3 at $DIR/inst_combine_deref.rs:33:5: 33:11
36-
StorageDead(_6); // scope 3 at $DIR/inst_combine_deref.rs:33:10: 33:11
37-
StorageDead(_5); // scope 3 at $DIR/inst_combine_deref.rs:33:10: 33:11
38-
StorageDead(_4); // scope 2 at $DIR/inst_combine_deref.rs:34:1: 34:2
39-
StorageDead(_3); // scope 1 at $DIR/inst_combine_deref.rs:34:1: 34:2
40-
StorageDead(_2); // scope 0 at $DIR/inst_combine_deref.rs:34:1: 34:2
41-
return; // scope 0 at $DIR/inst_combine_deref.rs:34:2: 34:2
23+
StorageLive(_2); // scope 0 at $DIR/inst_combine_deref.rs:31:9: 31:10
24+
_2 = &(_1.0: u64); // scope 0 at $DIR/inst_combine_deref.rs:31:13: 31:17
25+
StorageLive(_3); // scope 1 at $DIR/inst_combine_deref.rs:32:9: 32:10
26+
_3 = &(_1.1: u64); // scope 1 at $DIR/inst_combine_deref.rs:32:13: 32:17
27+
StorageLive(_4); // scope 2 at $DIR/inst_combine_deref.rs:33:9: 33:10
28+
- _4 = (*_2); // scope 2 at $DIR/inst_combine_deref.rs:33:13: 33:15
29+
+ _4 = (_1.0: u64); // scope 2 at $DIR/inst_combine_deref.rs:33:13: 33:15
30+
StorageLive(_5); // scope 3 at $DIR/inst_combine_deref.rs:34:5: 34:7
31+
- _5 = (*_3); // scope 3 at $DIR/inst_combine_deref.rs:34:5: 34:7
32+
+ _5 = (_1.1: u64); // scope 3 at $DIR/inst_combine_deref.rs:34:5: 34:7
33+
StorageLive(_6); // scope 3 at $DIR/inst_combine_deref.rs:34:10: 34:11
34+
_6 = _4; // scope 3 at $DIR/inst_combine_deref.rs:34:10: 34:11
35+
_0 = Add(move _5, move _6); // scope 3 at $DIR/inst_combine_deref.rs:34:5: 34:11
36+
StorageDead(_6); // scope 3 at $DIR/inst_combine_deref.rs:34:10: 34:11
37+
StorageDead(_5); // scope 3 at $DIR/inst_combine_deref.rs:34:10: 34:11
38+
StorageDead(_4); // scope 2 at $DIR/inst_combine_deref.rs:35:1: 35:2
39+
StorageDead(_3); // scope 1 at $DIR/inst_combine_deref.rs:35:1: 35:2
40+
StorageDead(_2); // scope 0 at $DIR/inst_combine_deref.rs:35:1: 35:2
41+
return; // scope 0 at $DIR/inst_combine_deref.rs:35:2: 35:2
4242
}
4343
}
4444

‎src/test/mir-opt/inst_combine_deref.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// compile-flags: -O
12
// EMIT_MIR inst_combine_deref.simple_opt.InstCombine.diff
23
fn simple_opt() -> u64 {
34
let x = 5;

‎src/test/mir-opt/inst_combine_deref.simple_opt.InstCombine.diff

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,33 @@
22
+ // MIR for `simple_opt` after InstCombine
33

44
fn simple_opt() -> u64 {
5-
let mut _0: u64; // return place in scope 0 at $DIR/inst_combine_deref.rs:2:20: 2:23
6-
let _1: u64; // in scope 0 at $DIR/inst_combine_deref.rs:3:9: 3:10
5+
let mut _0: u64; // return place in scope 0 at $DIR/inst_combine_deref.rs:3:20: 3:23
6+
let _1: u64; // in scope 0 at $DIR/inst_combine_deref.rs:4:9: 4:10
77
scope 1 {
8-
debug x => _1; // in scope 1 at $DIR/inst_combine_deref.rs:3:9: 3:10
9-
let _2: &u64; // in scope 1 at $DIR/inst_combine_deref.rs:4:9: 4:10
8+
debug x => _1; // in scope 1 at $DIR/inst_combine_deref.rs:4:9: 4:10
9+
let _2: &u64; // in scope 1 at $DIR/inst_combine_deref.rs:5:9: 5:10
1010
scope 2 {
11-
debug y => _2; // in scope 2 at $DIR/inst_combine_deref.rs:4:9: 4:10
12-
let _3: u64; // in scope 2 at $DIR/inst_combine_deref.rs:5:9: 5:10
11+
debug y => _2; // in scope 2 at $DIR/inst_combine_deref.rs:5:9: 5:10
12+
let _3: u64; // in scope 2 at $DIR/inst_combine_deref.rs:6:9: 6:10
1313
scope 3 {
14-
debug z => _3; // in scope 3 at $DIR/inst_combine_deref.rs:5:9: 5:10
14+
debug z => _3; // in scope 3 at $DIR/inst_combine_deref.rs:6:9: 6:10
1515
}
1616
}
1717
}
1818

1919
bb0: {
20-
StorageLive(_1); // scope 0 at $DIR/inst_combine_deref.rs:3:9: 3:10
21-
_1 = const 5_u64; // scope 0 at $DIR/inst_combine_deref.rs:3:13: 3:14
22-
StorageLive(_2); // scope 1 at $DIR/inst_combine_deref.rs:4:9: 4:10
23-
_2 = &_1; // scope 1 at $DIR/inst_combine_deref.rs:4:13: 4:15
24-
StorageLive(_3); // scope 2 at $DIR/inst_combine_deref.rs:5:9: 5:10
25-
- _3 = (*_2); // scope 2 at $DIR/inst_combine_deref.rs:5:13: 5:15
26-
+ _3 = _1; // scope 2 at $DIR/inst_combine_deref.rs:5:13: 5:15
27-
_0 = _3; // scope 3 at $DIR/inst_combine_deref.rs:6:5: 6:6
28-
StorageDead(_3); // scope 2 at $DIR/inst_combine_deref.rs:7:1: 7:2
29-
StorageDead(_2); // scope 1 at $DIR/inst_combine_deref.rs:7:1: 7:2
30-
StorageDead(_1); // scope 0 at $DIR/inst_combine_deref.rs:7:1: 7:2
31-
return; // scope 0 at $DIR/inst_combine_deref.rs:7:2: 7:2
20+
StorageLive(_1); // scope 0 at $DIR/inst_combine_deref.rs:4:9: 4:10
21+
_1 = const 5_u64; // scope 0 at $DIR/inst_combine_deref.rs:4:13: 4:14
22+
StorageLive(_2); // scope 1 at $DIR/inst_combine_deref.rs:5:9: 5:10
23+
_2 = &_1; // scope 1 at $DIR/inst_combine_deref.rs:5:13: 5:15
24+
StorageLive(_3); // scope 2 at $DIR/inst_combine_deref.rs:6:9: 6:10
25+
- _3 = (*_2); // scope 2 at $DIR/inst_combine_deref.rs:6:13: 6:15
26+
+ _3 = _1; // scope 2 at $DIR/inst_combine_deref.rs:6:13: 6:15
27+
_0 = _3; // scope 3 at $DIR/inst_combine_deref.rs:7:5: 7:6
28+
StorageDead(_3); // scope 2 at $DIR/inst_combine_deref.rs:8:1: 8:2
29+
StorageDead(_2); // scope 1 at $DIR/inst_combine_deref.rs:8:1: 8:2
30+
StorageDead(_1); // scope 0 at $DIR/inst_combine_deref.rs:8:1: 8:2
31+
return; // scope 0 at $DIR/inst_combine_deref.rs:8:2: 8:2
3232
}
3333
}
3434

0 commit comments

Comments
 (0)
Please sign in to comment.