Skip to content

Commit

Permalink
Add missing flags for mir-opt tests of unsound passes
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ecstatic-morse committed Oct 11, 2020
1 parent 51da28a commit d325564
Show file tree
Hide file tree
Showing 11 changed files with 170 additions and 166 deletions.
20 changes: 10 additions & 10 deletions src/test/mir-opt/copy_propagation_arg.arg_src.CopyPropagation.diff
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
+ // MIR for `arg_src` after CopyPropagation

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

bb0: {
nop; // scope 0 at $DIR/copy_propagation_arg.rs:28:9: 28:10
_0 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:28:13: 28:14
_1 = const 123_i32; // scope 1 at $DIR/copy_propagation_arg.rs:29:5: 29:12
nop; // scope 1 at $DIR/copy_propagation_arg.rs:30:5: 30:6
nop; // scope 0 at $DIR/copy_propagation_arg.rs:31:1: 31:2
return; // scope 0 at $DIR/copy_propagation_arg.rs:31:2: 31:2
nop; // scope 0 at $DIR/copy_propagation_arg.rs:30:9: 30:10
_0 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:30:13: 30:14
_1 = const 123_i32; // scope 1 at $DIR/copy_propagation_arg.rs:31:5: 31:12
nop; // scope 1 at $DIR/copy_propagation_arg.rs:32:5: 32:6
nop; // scope 0 at $DIR/copy_propagation_arg.rs:33:1: 33:2
return; // scope 0 at $DIR/copy_propagation_arg.rs:33:2: 33:2
}
}

28 changes: 14 additions & 14 deletions src/test/mir-opt/copy_propagation_arg.bar.CopyPropagation.diff
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
+ // MIR for `bar` after CopyPropagation

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

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

bb1: {
StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:16:12: 16:13
StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:16:13: 16:14
_1 = const 5_u8; // scope 0 at $DIR/copy_propagation_arg.rs:17:5: 17:10
_0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:15:19: 18:2
return; // scope 0 at $DIR/copy_propagation_arg.rs:18:2: 18:2
StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:18:12: 18:13
StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:18:13: 18:14
_1 = const 5_u8; // scope 0 at $DIR/copy_propagation_arg.rs:19:5: 19:10
_0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:17:19: 20:2
return; // scope 0 at $DIR/copy_propagation_arg.rs:20:2: 20:2
}
}

18 changes: 9 additions & 9 deletions src/test/mir-opt/copy_propagation_arg.baz.CopyPropagation.diff
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
+ // MIR for `baz` after CopyPropagation

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

bb0: {
nop; // scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10
nop; // scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10
nop; // scope 0 at $DIR/copy_propagation_arg.rs:23:5: 23:10
nop; // scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10
_0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:21:20: 24:2
return; // scope 0 at $DIR/copy_propagation_arg.rs:24:2: 24:2
nop; // scope 0 at $DIR/copy_propagation_arg.rs:25:9: 25:10
nop; // scope 0 at $DIR/copy_propagation_arg.rs:25:9: 25:10
nop; // scope 0 at $DIR/copy_propagation_arg.rs:25:5: 25:10
nop; // scope 0 at $DIR/copy_propagation_arg.rs:25:9: 25:10
_0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:23:20: 26:2
return; // scope 0 at $DIR/copy_propagation_arg.rs:26:2: 26:2
}
}

28 changes: 14 additions & 14 deletions src/test/mir-opt/copy_propagation_arg.foo.CopyPropagation.diff
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
+ // MIR for `foo` after CopyPropagation

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

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

bb1: {
StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:11:16: 11:17
nop; // scope 0 at $DIR/copy_propagation_arg.rs:11:5: 11:17
nop; // scope 0 at $DIR/copy_propagation_arg.rs:11:16: 11:17
_0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:9:19: 12:2
return; // scope 0 at $DIR/copy_propagation_arg.rs:12:2: 12:2
StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:13:16: 13:17
nop; // scope 0 at $DIR/copy_propagation_arg.rs:13:5: 13:17
nop; // scope 0 at $DIR/copy_propagation_arg.rs:13:16: 13:17
_0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:11:19: 14:2
return; // scope 0 at $DIR/copy_propagation_arg.rs:14:2: 14:2
}
}

2 changes: 2 additions & 0 deletions src/test/mir-opt/copy_propagation_arg.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// compile-flags: -Z unsound-mir-opts

// Check that CopyPropagation does not propagate an assignment to a function argument
// (doing so can break usages of the original argument value)

Expand Down
2 changes: 2 additions & 0 deletions src/test/mir-opt/issue-73223.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// compile-flags: -Z unsound-mir-opts -Z mir-opt-skip-pass=CopyProp

fn main() {
let split = match Some(1) {
Some(v) => v,
Expand Down
44 changes: 22 additions & 22 deletions src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
+ // MIR for `main` after PreCodegen

fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:1:11: 1:11
let _1: i32; // in scope 0 at $DIR/issue-73223.rs:2:9: 2:14
let mut _2: std::option::Option<i32>; // in scope 0 at $DIR/issue-73223.rs:2:23: 2:30
let _3: i32; // in scope 0 at $DIR/issue-73223.rs:3:14: 3:15
let mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:3:11: 3:11
let _1: i32; // in scope 0 at $DIR/issue-73223.rs:4:9: 4:14
let mut _2: std::option::Option<i32>; // in scope 0 at $DIR/issue-73223.rs:4:23: 4:30
let _3: i32; // in scope 0 at $DIR/issue-73223.rs:5:14: 5:15
let mut _5: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _6: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _9: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
Expand All @@ -23,10 +23,10 @@
let mut _21: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _22: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
scope 1 {
debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14
let _4: std::option::Option<i32>; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14
debug split => _1; // in scope 1 at $DIR/issue-73223.rs:4:9: 4:14
let _4: std::option::Option<i32>; // in scope 1 at $DIR/issue-73223.rs:9:9: 9:14
scope 3 {
debug _prev => _4; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14
debug _prev => _4; // in scope 3 at $DIR/issue-73223.rs:9:9: 9:14
let _7: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let _8: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
scope 4 {
Expand Down Expand Up @@ -61,25 +61,25 @@
}
}
scope 2 {
debug v => _3; // in scope 2 at $DIR/issue-73223.rs:3:14: 3:15
debug v => _3; // in scope 2 at $DIR/issue-73223.rs:5:14: 5:15
}
scope 7 {
}
scope 9 {
}

bb0: {
StorageLive(_1); // scope 0 at $DIR/issue-73223.rs:2:9: 2:14
StorageLive(_2); // scope 0 at $DIR/issue-73223.rs:2:23: 2:30
((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30
discriminant(_2) = 1; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30
StorageLive(_3); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15
_3 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15
_1 = _3; // scope 2 at $DIR/issue-73223.rs:3:20: 3:21
StorageDead(_3); // scope 0 at $DIR/issue-73223.rs:3:20: 3:21
StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7
((_4 as Some).0: i32) = _1; // scope 1 at $DIR/issue-73223.rs:7:22: 7:27
discriminant(_4) = 1; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28
StorageLive(_1); // scope 0 at $DIR/issue-73223.rs:4:9: 4:14
StorageLive(_2); // scope 0 at $DIR/issue-73223.rs:4:23: 4:30
((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:4:23: 4:30
discriminant(_2) = 1; // scope 0 at $DIR/issue-73223.rs:4:23: 4:30
StorageLive(_3); // scope 0 at $DIR/issue-73223.rs:5:14: 5:15
_3 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:5:14: 5:15
_1 = _3; // scope 2 at $DIR/issue-73223.rs:5:20: 5:21
StorageDead(_3); // scope 0 at $DIR/issue-73223.rs:5:20: 5:21
StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:7:6: 7:7
((_4 as Some).0: i32) = _1; // scope 1 at $DIR/issue-73223.rs:9:22: 9:27
discriminant(_4) = 1; // scope 1 at $DIR/issue-73223.rs:9:17: 9:28
(_5.0: &i32) = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_6 = const main::promoted[1]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
// ty::Const
Expand Down Expand Up @@ -108,9 +108,9 @@
StorageDead(_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_7); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2
StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2
return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2
_0 = const (); // scope 0 at $DIR/issue-73223.rs:3:11: 11:2
StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:11:1: 11:2
return; // scope 0 at $DIR/issue-73223.rs:11:2: 11:2
}

bb2: {
Expand Down
Loading

0 comments on commit d325564

Please sign in to comment.