Skip to content

Commit 7a30d3e

Browse files
committed
Bless mir_opt tests that were broken by DSE.
Adding the DSE pass changed the emitted MIR for a bunch of other test. This commit blesses/fixes these changes. In some cases, this required adding some `black_box` calls to inhibit the DSE optimizations.
1 parent 81f8c12 commit 7a30d3e

15 files changed

+136
-119
lines changed

src/test/mir-opt/const_debuginfo.main.ConstDebugInfo.diff

Lines changed: 95 additions & 82 deletions
Large diffs are not rendered by default.

src/test/mir-opt/const_debuginfo.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// compile-flags: -C overflow-checks=no -Zunsound-mir-opts
22

3+
#![feature(bench_black_box)]
4+
35
struct Point {
46
x: u32,
57
y: u32,
@@ -19,6 +21,8 @@ fn main() {
1921

2022
let p = Point { x: 32, y: 32 };
2123
let a = p.x + p.y;
24+
25+
core::hint::black_box(());
2226
}
2327

2428
// EMIT_MIR const_debuginfo.main.ConstDebugInfo.diff

src/test/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals.after.32bit.mir

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ fn main() -> () {
1919
StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
2020
_1 = const 4_i32; // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
2121
StorageLive(_2); // scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
22-
_2 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
2322
StorageLive(_3); // scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
24-
_3 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
2523
StorageDead(_3); // scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2
2624
StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2
2725
StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2

src/test/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals.after.64bit.mir

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ fn main() -> () {
1919
StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
2020
_1 = const 4_i32; // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
2121
StorageLive(_2); // scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
22-
_2 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
2322
StorageLive(_3); // scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
24-
_3 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
2523
StorageDead(_3); // scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2
2624
StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2
2725
StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@
2525
StorageLive(_5); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
2626
- StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
2727
- StorageLive(_7); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
28-
- _7 = _2; // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
2928
- StorageLive(_11); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
30-
- _11 = _7; // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
31-
- _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
3229
- StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:7:20: 7:21
3330
_5 = const N; // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27
3431
- StorageDead(_11); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27

src/test/mir-opt/lower_array_len.array_bound_mut.SimplifyLocals.diff

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@
3131
StorageLive(_5); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27
3232
- StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27
3333
- StorageLive(_7); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27
34-
- _7 = &(*_2); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27
3534
- StorageLive(_14); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27
36-
- _14 = _7; // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27
37-
- _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27
3835
- StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:18:20: 18:21
3936
_5 = const N; // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27
4037
- StorageDead(_14); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27

src/test/mir-opt/lower_array_len.array_len.SimplifyLocals.diff

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111
bb0: {
1212
- StorageLive(_2); // scope 0 at $DIR/lower_array_len.rs:31:5: 31:14
1313
- StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:31:5: 31:14
14-
- _3 = _1; // scope 0 at $DIR/lower_array_len.rs:31:5: 31:14
1514
- StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:31:5: 31:14
16-
- _4 = _3; // scope 0 at $DIR/lower_array_len.rs:31:5: 31:14
17-
- _2 = move _3 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:31:5: 31:14
1815
- StorageDead(_3); // scope 0 at $DIR/lower_array_len.rs:31:7: 31:8
1916
_0 = const N; // scope 0 at $DIR/lower_array_len.rs:31:5: 31:14
2017
- StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:31:5: 31:14

src/test/mir-opt/lower_array_len.array_len_by_value.SimplifyLocals.diff

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111
bb0: {
1212
- StorageLive(_2); // scope 0 at $DIR/lower_array_len.rs:38:5: 38:14
1313
- StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:38:5: 38:14
14-
- _3 = &_1; // scope 0 at $DIR/lower_array_len.rs:38:5: 38:14
1514
- StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:38:5: 38:14
16-
- _4 = _3; // scope 0 at $DIR/lower_array_len.rs:38:5: 38:14
17-
- _2 = move _3 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:38:5: 38:14
1815
- StorageDead(_3); // scope 0 at $DIR/lower_array_len.rs:38:7: 38:8
1916
_0 = const N; // scope 0 at $DIR/lower_array_len.rs:38:5: 38:14
2017
- StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:38:5: 38:14

src/test/mir-opt/separate_const_switch.too_complex.PreCodegen.after.mir

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ fn too_complex(_1: Result<i32, usize>) -> Option<i32> {
4141
StorageDead(_7); // scope 2 at $DIR/separate_const_switch.rs:17:43: 17:44
4242
StorageDead(_6); // scope 0 at $DIR/separate_const_switch.rs:17:43: 17:44
4343
StorageLive(_10); // scope 0 at $DIR/separate_const_switch.rs:21:28: 21:29
44-
_10 = ((_2 as Break).0: usize); // scope 0 at $DIR/separate_const_switch.rs:21:28: 21:29
4544
discriminant(_0) = 0; // scope 4 at $DIR/separate_const_switch.rs:21:34: 21:38
4645
StorageDead(_10); // scope 0 at $DIR/separate_const_switch.rs:21:37: 21:38
4746
goto -> bb3; // scope 0 at $DIR/separate_const_switch.rs:21:37: 21:38

src/test/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals.diff

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
- StorageLive(_10); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:12: 16:30
4949
- StorageLive(_11); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:12: 16:28
5050
- (_11.0: u8) = const 40_u8; // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:12: 16:28
51-
- _10 = const 40_u8; // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:12: 16:30
5251
- _9 = const 42_u8; // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:12: 16:34
5352
- StorageDead(_10); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:33: 16:34
5453
- _8 = use_u8(const 42_u8) -> bb2; // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:5: 16:35

0 commit comments

Comments
 (0)