diff options
| author | Jonas Schievink <jonasschievink@gmail.com> | 2020-10-17 02:25:31 +0200 |
|---|---|---|
| committer | Jonas Schievink <jonasschievink@gmail.com> | 2020-10-17 02:25:31 +0200 |
| commit | dc3177775c6accb004a1bde5ea72ba03740952ad (patch) | |
| tree | 467bc32fdc0f84a699343b6ce02411e7d710f035 /src | |
| parent | 5a51185fd4600e96cc79a3db9da3c4bf927f2281 (diff) | |
Remove the old copy propagation pass
Diffstat (limited to 'src')
11 files changed, 73 insertions, 96 deletions
diff --git a/src/test/mir-opt/copy_propagation.rs b/src/test/mir-opt/copy_propagation.rs deleted file mode 100644 index 8283ec73d0f..00000000000 --- a/src/test/mir-opt/copy_propagation.rs +++ /dev/null @@ -1,12 +0,0 @@ -// compile-flags: -Zunsound-mir-opts -// EMIT_MIR copy_propagation.test.CopyPropagation.diff - -fn test(x: u32) -> u32 { - let y = x; - y -} - -fn main() { - // Make sure the function actually gets instantiated. - test(0); -} diff --git a/src/test/mir-opt/copy_propagation.test.CopyPropagation.diff b/src/test/mir-opt/copy_propagation.test.CopyPropagation.diff deleted file mode 100644 index 152d1590630..00000000000 --- a/src/test/mir-opt/copy_propagation.test.CopyPropagation.diff +++ /dev/null @@ -1,20 +0,0 @@ -- // MIR for `test` before CopyPropagation -+ // MIR for `test` after CopyPropagation - - fn test(_1: u32) -> u32 { - debug x => _1; // in scope 0 at $DIR/copy_propagation.rs:4:9: 4:10 - let mut _0: u32; // return place in scope 0 at $DIR/copy_propagation.rs:4:20: 4:23 - let _2: u32; // in scope 0 at $DIR/copy_propagation.rs:5:9: 5:10 - scope 1 { - debug y => _0; // in scope 1 at $DIR/copy_propagation.rs:5:9: 5:10 - } - - bb0: { - nop; // scope 0 at $DIR/copy_propagation.rs:5:9: 5:10 - _0 = _1; // scope 0 at $DIR/copy_propagation.rs:5:13: 5:14 - nop; // scope 1 at $DIR/copy_propagation.rs:6:5: 6:6 - nop; // scope 0 at $DIR/copy_propagation.rs:7:1: 7:2 - return; // scope 0 at $DIR/copy_propagation.rs:7:2: 7:2 - } - } - diff --git a/src/test/mir-opt/copy_propagation_arg.arg_src.CopyPropagation.diff b/src/test/mir-opt/copy_propagation_arg.arg_src.CopyPropagation.diff deleted file mode 100644 index 8aab2299d26..00000000000 --- a/src/test/mir-opt/copy_propagation_arg.arg_src.CopyPropagation.diff +++ /dev/null @@ -1,21 +0,0 @@ -- // MIR for `arg_src` before CopyPropagation -+ // 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 - scope 1 { - debug y => _0; // in scope 1 at $DIR/copy_propagation_arg.rs:28:9: 28: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 - } - } - diff --git a/src/test/mir-opt/copy_propagation_arg.baz.CopyPropagation.diff b/src/test/mir-opt/copy_propagation_arg.baz.CopyPropagation.diff deleted file mode 100644 index 1ea51fec710..00000000000 --- a/src/test/mir-opt/copy_propagation_arg.baz.CopyPropagation.diff +++ /dev/null @@ -1,18 +0,0 @@ -- // MIR for `baz` before CopyPropagation -+ // 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 - - 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 - } - } - diff --git a/src/test/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.diff b/src/test/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.diff new file mode 100644 index 00000000000..a5d80e75053 --- /dev/null +++ b/src/test/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.diff @@ -0,0 +1,26 @@ +- // MIR for `arg_src` before DestinationPropagation ++ // MIR for `arg_src` after DestinationPropagation + + 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 + scope 1 { +- debug y => _2; // 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:28:9: 28:10 + } + + bb0: { +- StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:28:9: 28:10 +- _2 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:28:13: 28:14 ++ 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 +- _0 = _2; // scope 1 at $DIR/copy_propagation_arg.rs:30:5: 30:6 +- StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:31:1: 31:2 ++ 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 + } + } + diff --git a/src/test/mir-opt/copy_propagation_arg.bar.CopyPropagation.diff b/src/test/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.diff index fb793e53ea8..dce8800e986 100644 --- a/src/test/mir-opt/copy_propagation_arg.bar.CopyPropagation.diff +++ b/src/test/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.diff @@ -1,5 +1,5 @@ -- // MIR for `bar` before CopyPropagation -+ // MIR for `bar` after CopyPropagation +- // MIR for `bar` before DestinationPropagation ++ // MIR for `bar` after DestinationPropagation fn bar(_1: u8) -> () { debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:15:8: 15:13 diff --git a/src/test/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.diff b/src/test/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.diff new file mode 100644 index 00000000000..2f8c76eb65a --- /dev/null +++ b/src/test/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.diff @@ -0,0 +1,22 @@ +- // MIR for `baz` before DestinationPropagation ++ // MIR for `baz` after DestinationPropagation + + 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 + + bb0: { +- StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10 +- _2 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10 +- _1 = move _2; // scope 0 at $DIR/copy_propagation_arg.rs:23:5: 23:10 +- StorageDead(_2); // 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: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 + } + } + diff --git a/src/test/mir-opt/copy_propagation_arg.foo.CopyPropagation.diff b/src/test/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.diff index 48ab37a239c..2dea530db3d 100644 --- a/src/test/mir-opt/copy_propagation_arg.foo.CopyPropagation.diff +++ b/src/test/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.diff @@ -1,5 +1,5 @@ -- // MIR for `foo` before CopyPropagation -+ // MIR for `foo` after CopyPropagation +- // MIR for `foo` before DestinationPropagation ++ // MIR for `foo` after DestinationPropagation fn foo(_1: u8) -> () { debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:9:8: 9:13 @@ -8,10 +8,12 @@ let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:11:15: 11:16 bb0: { - nop; // scope 0 at $DIR/copy_propagation_arg.rs:11:9: 11:17 +- StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:11:9: 11:17 ++ 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 +- _2 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:11:9: 11:17 ++ _1 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:11:9: 11:17 // mir::Constant // + span: $DIR/copy_propagation_arg.rs:11:9: 11:14 // + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value(Scalar(<ZST>)) } @@ -19,8 +21,10 @@ 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 +- _1 = move _2; // scope 0 at $DIR/copy_propagation_arg.rs:11:5: 11:17 +- StorageDead(_2); // 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 } diff --git a/src/test/mir-opt/copy_propagation_arg.rs b/src/test/mir-opt/dest-prop/copy_propagation_arg.rs index 3a00fc58a4e..b5188a8b4b2 100644 --- a/src/test/mir-opt/copy_propagation_arg.rs +++ b/src/test/mir-opt/dest-prop/copy_propagation_arg.rs @@ -1,29 +1,29 @@ -// Check that CopyPropagation does not propagate an assignment to a function argument +// Check that DestinationPropagation does not propagate an assignment to a function argument // (doing so can break usages of the original argument value) fn dummy(x: u8) -> u8 { x } -// EMIT_MIR copy_propagation_arg.foo.CopyPropagation.diff +// EMIT_MIR copy_propagation_arg.foo.DestinationPropagation.diff fn foo(mut x: u8) { // calling `dummy` to make an use of `x` that copyprop cannot eliminate x = dummy(x); // this will assign a local to `x` } -// EMIT_MIR copy_propagation_arg.bar.CopyPropagation.diff +// EMIT_MIR copy_propagation_arg.bar.DestinationPropagation.diff fn bar(mut x: u8) { dummy(x); x = 5; } -// EMIT_MIR copy_propagation_arg.baz.CopyPropagation.diff +// EMIT_MIR copy_propagation_arg.baz.DestinationPropagation.diff fn baz(mut x: i32) { // self-assignment to a function argument should be eliminated x = x; } -// EMIT_MIR copy_propagation_arg.arg_src.CopyPropagation.diff +// EMIT_MIR copy_propagation_arg.arg_src.DestinationPropagation.diff fn arg_src(mut x: i32) -> i32 { let y = x; x = 123; // Don't propagate this assignment to `y` diff --git a/src/test/mir-opt/early_otherwise_branch_68867.rs b/src/test/mir-opt/early_otherwise_branch_68867.rs index 98a275c18ac..b822c58f550 100644 --- a/src/test/mir-opt/early_otherwise_branch_68867.rs +++ b/src/test/mir-opt/early_otherwise_branch_68867.rs @@ -12,7 +12,7 @@ pub enum ViewportPercentageLength { } // EMIT_MIR early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff -// EMIT_MIR early_otherwise_branch_68867.try_sum EarlyOtherwiseBranch.before SimplifyBranches-after-copy-prop.after +// EMIT_MIR early_otherwise_branch_68867.try_sum EarlyOtherwiseBranch.before SimplifyBranches-final.after #[no_mangle] pub extern "C" fn try_sum( x: &ViewportPercentageLength, diff --git a/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.before-SimplifyBranches-after-copy-prop.after.diff b/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.before-SimplifyBranches-final.after.diff index 9a5a309fd27..f51a08ed730 100644 --- a/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.before-SimplifyBranches-after-copy-prop.after.diff +++ b/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.before-SimplifyBranches-final.after.diff @@ -1,5 +1,5 @@ - // MIR for `try_sum` before EarlyOtherwiseBranch -+ // MIR for `try_sum` after SimplifyBranches-after-copy-prop ++ // MIR for `try_sum` after SimplifyBranches-final fn try_sum(_1: &ViewportPercentageLength, _2: &ViewportPercentageLength) -> std::result::Result<ViewportPercentageLength, ()> { debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:18:5: 18:6 @@ -68,21 +68,17 @@ - StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:14: 22:24 - StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:15: 22:16 - _5 = _1; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:15: 22:16 -- StorageLive(_6); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:18: 22:23 -- _6 = _2; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:18: 22:23 -- (_4.0: &ViewportPercentageLength) = move _5; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:14: 22:24 -- (_4.1: &ViewportPercentageLength) = move _6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:14: 22:24 -- StorageDead(_6); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:23: 22:24 -- StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:23: 22:24 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:14: 22:24 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:15: 22:16 + (_4.0: &ViewportPercentageLength) = _1; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:15: 22:16 -+ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:18: 22:23 -+ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:18: 22:23 + StorageLive(_6); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:18: 22:23 + _6 = _2; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:18: 22:23 +- (_4.0: &ViewportPercentageLength) = move _5; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:14: 22:24 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:14: 22:24 -+ (_4.1: &ViewportPercentageLength) = move _2; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:14: 22:24 -+ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:23: 22:24 + (_4.1: &ViewportPercentageLength) = move _6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:14: 22:24 + StorageDead(_6); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:23: 22:24 +- StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:23: 22:24 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:23: 22:24 _11 = discriminant((*(_4.0: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 - switchInt(move _11) -> [0_isize: bb1, 1_isize: bb3, 2_isize: bb4, 3_isize: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 |
