Skip to content

Commit d325564

Browse files
Add missing flags for mir-opt tests of unsound passes
These don't actually test anything since whoever implemented `-Zunsound-mir-opts` forgot to set it when unsound passes were checked. They break now that the passes are skipped entirely without `-Zunsound-mir-opts` instead of just being no-ops.
1 parent 51da28a commit d325564

11 files changed

+170
-166
lines changed

src/test/mir-opt/copy_propagation_arg.arg_src.CopyPropagation.diff

+10-10
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
+ // MIR for `arg_src` after CopyPropagation
33

44
fn arg_src(_1: i32) -> i32 {
5-
debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:27:12: 27:17
6-
let mut _0: i32; // return place in scope 0 at $DIR/copy_propagation_arg.rs:27:27: 27:30
7-
let _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:28:9: 28:10
5+
debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:29:12: 29:17
6+
let mut _0: i32; // return place in scope 0 at $DIR/copy_propagation_arg.rs:29:27: 29:30
7+
let _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:30:9: 30:10
88
scope 1 {
9-
debug y => _0; // in scope 1 at $DIR/copy_propagation_arg.rs:28:9: 28:10
9+
debug y => _0; // in scope 1 at $DIR/copy_propagation_arg.rs:30:9: 30:10
1010
}
1111

1212
bb0: {
13-
nop; // scope 0 at $DIR/copy_propagation_arg.rs:28:9: 28:10
14-
_0 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:28:13: 28:14
15-
_1 = const 123_i32; // scope 1 at $DIR/copy_propagation_arg.rs:29:5: 29:12
16-
nop; // scope 1 at $DIR/copy_propagation_arg.rs:30:5: 30:6
17-
nop; // scope 0 at $DIR/copy_propagation_arg.rs:31:1: 31:2
18-
return; // scope 0 at $DIR/copy_propagation_arg.rs:31:2: 31:2
13+
nop; // scope 0 at $DIR/copy_propagation_arg.rs:30:9: 30:10
14+
_0 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:30:13: 30:14
15+
_1 = const 123_i32; // scope 1 at $DIR/copy_propagation_arg.rs:31:5: 31:12
16+
nop; // scope 1 at $DIR/copy_propagation_arg.rs:32:5: 32:6
17+
nop; // scope 0 at $DIR/copy_propagation_arg.rs:33:1: 33:2
18+
return; // scope 0 at $DIR/copy_propagation_arg.rs:33:2: 33:2
1919
}
2020
}
2121

src/test/mir-opt/copy_propagation_arg.bar.CopyPropagation.diff

+14-14
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@
22
+ // MIR for `bar` after CopyPropagation
33

44
fn bar(_1: u8) -> () {
5-
debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:15:8: 15:13
6-
let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:15:19: 15:19
7-
let _2: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:16:5: 16:13
8-
let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:16:11: 16:12
5+
debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:17:8: 17:13
6+
let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:17:19: 17:19
7+
let _2: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:18:5: 18:13
8+
let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:18:11: 18:12
99

1010
bb0: {
11-
StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:16:5: 16:13
12-
StorageLive(_3); // scope 0 at $DIR/copy_propagation_arg.rs:16:11: 16:12
13-
_3 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:16:11: 16:12
14-
_2 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:16:5: 16:13
11+
StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:18:5: 18:13
12+
StorageLive(_3); // scope 0 at $DIR/copy_propagation_arg.rs:18:11: 18:12
13+
_3 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:18:11: 18:12
14+
_2 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:18:5: 18:13
1515
// mir::Constant
16-
// + span: $DIR/copy_propagation_arg.rs:16:5: 16:10
16+
// + span: $DIR/copy_propagation_arg.rs:18:5: 18:10
1717
// + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value(Scalar(<ZST>)) }
1818
}
1919

2020
bb1: {
21-
StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:16:12: 16:13
22-
StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:16:13: 16:14
23-
_1 = const 5_u8; // scope 0 at $DIR/copy_propagation_arg.rs:17:5: 17:10
24-
_0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:15:19: 18:2
25-
return; // scope 0 at $DIR/copy_propagation_arg.rs:18:2: 18:2
21+
StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:18:12: 18:13
22+
StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:18:13: 18:14
23+
_1 = const 5_u8; // scope 0 at $DIR/copy_propagation_arg.rs:19:5: 19:10
24+
_0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:17:19: 20:2
25+
return; // scope 0 at $DIR/copy_propagation_arg.rs:20:2: 20:2
2626
}
2727
}
2828

src/test/mir-opt/copy_propagation_arg.baz.CopyPropagation.diff

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
+ // MIR for `baz` after CopyPropagation
33

44
fn baz(_1: i32) -> () {
5-
debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:21:8: 21:13
6-
let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:21:20: 21:20
7-
let mut _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10
5+
debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:23:8: 23:13
6+
let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:23:20: 23:20
7+
let mut _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:25:9: 25:10
88

99
bb0: {
10-
nop; // scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10
11-
nop; // scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10
12-
nop; // scope 0 at $DIR/copy_propagation_arg.rs:23:5: 23:10
13-
nop; // scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10
14-
_0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:21:20: 24:2
15-
return; // scope 0 at $DIR/copy_propagation_arg.rs:24:2: 24:2
10+
nop; // scope 0 at $DIR/copy_propagation_arg.rs:25:9: 25:10
11+
nop; // scope 0 at $DIR/copy_propagation_arg.rs:25:9: 25:10
12+
nop; // scope 0 at $DIR/copy_propagation_arg.rs:25:5: 25:10
13+
nop; // scope 0 at $DIR/copy_propagation_arg.rs:25:9: 25:10
14+
_0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:23:20: 26:2
15+
return; // scope 0 at $DIR/copy_propagation_arg.rs:26:2: 26:2
1616
}
1717
}
1818

src/test/mir-opt/copy_propagation_arg.foo.CopyPropagation.diff

+14-14
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@
22
+ // MIR for `foo` after CopyPropagation
33

44
fn foo(_1: u8) -> () {
5-
debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:9:8: 9:13
6-
let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:9:19: 9:19
7-
let mut _2: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:11:9: 11:17
8-
let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:11:15: 11:16
5+
debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:11:8: 11:13
6+
let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:11:19: 11:19
7+
let mut _2: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:13:9: 13:17
8+
let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:13:15: 13:16
99

1010
bb0: {
11-
nop; // scope 0 at $DIR/copy_propagation_arg.rs:11:9: 11:17
12-
StorageLive(_3); // scope 0 at $DIR/copy_propagation_arg.rs:11:15: 11:16
13-
_3 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:11:15: 11:16
14-
_1 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:11:9: 11:17
11+
nop; // scope 0 at $DIR/copy_propagation_arg.rs:13:9: 13:17
12+
StorageLive(_3); // scope 0 at $DIR/copy_propagation_arg.rs:13:15: 13:16
13+
_3 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:13:15: 13:16
14+
_1 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:13:9: 13:17
1515
// mir::Constant
16-
// + span: $DIR/copy_propagation_arg.rs:11:9: 11:14
16+
// + span: $DIR/copy_propagation_arg.rs:13:9: 13:14
1717
// + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value(Scalar(<ZST>)) }
1818
}
1919

2020
bb1: {
21-
StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:11:16: 11:17
22-
nop; // scope 0 at $DIR/copy_propagation_arg.rs:11:5: 11:17
23-
nop; // scope 0 at $DIR/copy_propagation_arg.rs:11:16: 11:17
24-
_0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:9:19: 12:2
25-
return; // scope 0 at $DIR/copy_propagation_arg.rs:12:2: 12:2
21+
StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:13:16: 13:17
22+
nop; // scope 0 at $DIR/copy_propagation_arg.rs:13:5: 13:17
23+
nop; // scope 0 at $DIR/copy_propagation_arg.rs:13:16: 13:17
24+
_0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:11:19: 14:2
25+
return; // scope 0 at $DIR/copy_propagation_arg.rs:14:2: 14:2
2626
}
2727
}
2828

src/test/mir-opt/copy_propagation_arg.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// compile-flags: -Z unsound-mir-opts
2+
13
// Check that CopyPropagation does not propagate an assignment to a function argument
24
// (doing so can break usages of the original argument value)
35

src/test/mir-opt/issue-73223.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// compile-flags: -Z unsound-mir-opts -Z mir-opt-skip-pass=CopyProp
2+
13
fn main() {
24
let split = match Some(1) {
35
Some(v) => v,

src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff

+22-22
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
+ // MIR for `main` after PreCodegen
33

44
fn main() -> () {
5-
let mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:1:11: 1:11
6-
let _1: i32; // in scope 0 at $DIR/issue-73223.rs:2:9: 2:14
7-
let mut _2: std::option::Option<i32>; // in scope 0 at $DIR/issue-73223.rs:2:23: 2:30
8-
let _3: i32; // in scope 0 at $DIR/issue-73223.rs:3:14: 3:15
5+
let mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:3:11: 3:11
6+
let _1: i32; // in scope 0 at $DIR/issue-73223.rs:4:9: 4:14
7+
let mut _2: std::option::Option<i32>; // in scope 0 at $DIR/issue-73223.rs:4:23: 4:30
8+
let _3: i32; // in scope 0 at $DIR/issue-73223.rs:5:14: 5:15
99
let mut _5: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
1010
let mut _6: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
1111
let mut _9: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
@@ -23,10 +23,10 @@
2323
let mut _21: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
2424
let mut _22: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
2525
scope 1 {
26-
debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14
27-
let _4: std::option::Option<i32>; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14
26+
debug split => _1; // in scope 1 at $DIR/issue-73223.rs:4:9: 4:14
27+
let _4: std::option::Option<i32>; // in scope 1 at $DIR/issue-73223.rs:9:9: 9:14
2828
scope 3 {
29-
debug _prev => _4; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14
29+
debug _prev => _4; // in scope 3 at $DIR/issue-73223.rs:9:9: 9:14
3030
let _7: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
3131
let _8: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
3232
scope 4 {
@@ -61,25 +61,25 @@
6161
}
6262
}
6363
scope 2 {
64-
debug v => _3; // in scope 2 at $DIR/issue-73223.rs:3:14: 3:15
64+
debug v => _3; // in scope 2 at $DIR/issue-73223.rs:5:14: 5:15
6565
}
6666
scope 7 {
6767
}
6868
scope 9 {
6969
}
7070

7171
bb0: {
72-
StorageLive(_1); // scope 0 at $DIR/issue-73223.rs:2:9: 2:14
73-
StorageLive(_2); // scope 0 at $DIR/issue-73223.rs:2:23: 2:30
74-
((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30
75-
discriminant(_2) = 1; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30
76-
StorageLive(_3); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15
77-
_3 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15
78-
_1 = _3; // scope 2 at $DIR/issue-73223.rs:3:20: 3:21
79-
StorageDead(_3); // scope 0 at $DIR/issue-73223.rs:3:20: 3:21
80-
StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7
81-
((_4 as Some).0: i32) = _1; // scope 1 at $DIR/issue-73223.rs:7:22: 7:27
82-
discriminant(_4) = 1; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28
72+
StorageLive(_1); // scope 0 at $DIR/issue-73223.rs:4:9: 4:14
73+
StorageLive(_2); // scope 0 at $DIR/issue-73223.rs:4:23: 4:30
74+
((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:4:23: 4:30
75+
discriminant(_2) = 1; // scope 0 at $DIR/issue-73223.rs:4:23: 4:30
76+
StorageLive(_3); // scope 0 at $DIR/issue-73223.rs:5:14: 5:15
77+
_3 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:5:14: 5:15
78+
_1 = _3; // scope 2 at $DIR/issue-73223.rs:5:20: 5:21
79+
StorageDead(_3); // scope 0 at $DIR/issue-73223.rs:5:20: 5:21
80+
StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:7:6: 7:7
81+
((_4 as Some).0: i32) = _1; // scope 1 at $DIR/issue-73223.rs:9:22: 9:27
82+
discriminant(_4) = 1; // scope 1 at $DIR/issue-73223.rs:9:17: 9:28
8383
(_5.0: &i32) = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
8484
_6 = const main::promoted[1]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
8585
// ty::Const
@@ -108,9 +108,9 @@
108108
StorageDead(_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
109109
StorageDead(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
110110
StorageDead(_7); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
111-
_0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2
112-
StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2
113-
return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2
111+
_0 = const (); // scope 0 at $DIR/issue-73223.rs:3:11: 11:2
112+
StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:11:1: 11:2
113+
return; // scope 0 at $DIR/issue-73223.rs:11:2: 11:2
114114
}
115115

116116
bb2: {

0 commit comments

Comments
 (0)