From dc0db358abe19481e475e10c32149b53370f1a1c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 05:57:31 +0200 Subject: Merging upstream version 1.72.1+dfsg1. Signed-off-by: Daniel Baumann --- .../branch.foo.DestinationPropagation.diff | 75 ------------------- ...nch.foo.DestinationPropagation.panic-abort.diff | 66 +++++++++++++++++ ...ch.foo.DestinationPropagation.panic-unwind.diff | 66 +++++++++++++++++ tests/mir-opt/dest-prop/branch.rs | 2 +- ...agation_arg.arg_src.DestinationPropagation.diff | 26 ------- ...arg_src.DestinationPropagation.panic-abort.diff | 26 +++++++ ...rg_src.DestinationPropagation.panic-unwind.diff | 26 +++++++ ...propagation_arg.bar.DestinationPropagation.diff | 32 -------- ...arg.bar.DestinationPropagation.panic-abort.diff | 29 ++++++++ ...rg.bar.DestinationPropagation.panic-unwind.diff | 29 ++++++++ ...propagation_arg.baz.DestinationPropagation.diff | 22 ------ ...arg.baz.DestinationPropagation.panic-abort.diff | 22 ++++++ ...rg.baz.DestinationPropagation.panic-unwind.diff | 22 ++++++ ...propagation_arg.foo.DestinationPropagation.diff | 32 -------- ...arg.foo.DestinationPropagation.panic-abort.diff | 29 ++++++++ ...rg.foo.DestinationPropagation.panic-unwind.diff | 29 ++++++++ tests/mir-opt/dest-prop/copy_propagation_arg.rs | 2 +- .../cycle.main.DestinationPropagation.diff | 77 ------------------- ...le.main.DestinationPropagation.panic-abort.diff | 71 ++++++++++++++++++ ...e.main.DestinationPropagation.panic-unwind.diff | 71 ++++++++++++++++++ tests/mir-opt/dest-prop/cycle.rs | 2 +- ...stores_79191.f.DestinationPropagation.after.mir | 34 --------- ....f.DestinationPropagation.after.panic-abort.mir | 31 ++++++++ ...f.DestinationPropagation.after.panic-unwind.mir | 31 ++++++++ tests/mir-opt/dest-prop/dead_stores_79191.rs | 2 +- ...tores_better.f.DestinationPropagation.after.mir | 33 --------- ....f.DestinationPropagation.after.panic-abort.mir | 30 ++++++++ ...f.DestinationPropagation.after.panic-unwind.mir | 30 ++++++++ tests/mir-opt/dest-prop/dead_stores_better.rs | 2 +- .../simple.nrvo.DestinationPropagation.diff | 43 ----------- ...le.nrvo.DestinationPropagation.panic-abort.diff | 43 +++++++++++ ...e.nrvo.DestinationPropagation.panic-unwind.diff | 43 +++++++++++ tests/mir-opt/dest-prop/simple.rs | 2 +- .../union.main.DestinationPropagation.diff | 35 --------- ...on.main.DestinationPropagation.panic-abort.diff | 32 ++++++++ ...n.main.DestinationPropagation.panic-unwind.diff | 32 ++++++++ tests/mir-opt/dest-prop/union.rs | 2 +- .../unreachable.f.DestinationPropagation.diff | 86 ---------------------- ...hable.f.DestinationPropagation.panic-abort.diff | 80 ++++++++++++++++++++ ...able.f.DestinationPropagation.panic-unwind.diff | 80 ++++++++++++++++++++ tests/mir-opt/dest-prop/unreachable.rs | 2 +- 41 files changed, 926 insertions(+), 503 deletions(-) delete mode 100644 tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.diff create mode 100644 tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-abort.diff create mode 100644 tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-unwind.diff delete mode 100644 tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.diff create mode 100644 tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-abort.diff create mode 100644 tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-unwind.diff delete mode 100644 tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.diff create mode 100644 tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-abort.diff create mode 100644 tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-unwind.diff delete mode 100644 tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.diff create mode 100644 tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-abort.diff create mode 100644 tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-unwind.diff delete mode 100644 tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.diff create mode 100644 tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-abort.diff create mode 100644 tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff delete mode 100644 tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff create mode 100644 tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-abort.diff create mode 100644 tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-unwind.diff delete mode 100644 tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.mir create mode 100644 tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-abort.mir create mode 100644 tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-unwind.mir delete mode 100644 tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.mir create mode 100644 tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-abort.mir create mode 100644 tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir delete mode 100644 tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.diff create mode 100644 tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-abort.diff create mode 100644 tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-unwind.diff delete mode 100644 tests/mir-opt/dest-prop/union.main.DestinationPropagation.diff create mode 100644 tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff create mode 100644 tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff delete mode 100644 tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.diff create mode 100644 tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-abort.diff create mode 100644 tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-unwind.diff (limited to 'tests/mir-opt/dest-prop') diff --git a/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.diff b/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.diff deleted file mode 100644 index b7416d389..000000000 --- a/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.diff +++ /dev/null @@ -1,75 +0,0 @@ -- // MIR for `foo` before DestinationPropagation -+ // MIR for `foo` after DestinationPropagation - - fn foo() -> i32 { - let mut _0: i32; // return place in scope 0 at $DIR/branch.rs:+0:13: +0:16 - let _1: i32; // in scope 0 at $DIR/branch.rs:+1:9: +1:10 - let mut _3: bool; // in scope 0 at $DIR/branch.rs:+3:16: +3:22 - let _4: i32; // in scope 0 at $DIR/branch.rs:+6:9: +6:14 - scope 1 { -- debug x => _1; // in scope 1 at $DIR/branch.rs:+1:9: +1:10 -+ debug x => _0; // in scope 1 at $DIR/branch.rs:+1:9: +1:10 - let _2: i32; // in scope 1 at $DIR/branch.rs:+3:9: +3:10 - scope 2 { -- debug y => _2; // in scope 2 at $DIR/branch.rs:+3:9: +3:10 -+ debug y => _0; // in scope 2 at $DIR/branch.rs:+3:9: +3:10 - } - } - - bb0: { -- StorageLive(_1); // scope 0 at $DIR/branch.rs:+1:9: +1:10 -- _1 = val() -> bb1; // scope 0 at $DIR/branch.rs:+1:13: +1:18 -+ nop; // scope 0 at $DIR/branch.rs:+1:9: +1:10 -+ _0 = val() -> bb1; // scope 0 at $DIR/branch.rs:+1:13: +1:18 - // mir::Constant - // + span: $DIR/branch.rs:14:13: 14:16 - // + literal: Const { ty: fn() -> i32 {val}, val: Value() } - } - - bb1: { -- StorageLive(_2); // scope 1 at $DIR/branch.rs:+3:9: +3:10 -+ nop; // scope 1 at $DIR/branch.rs:+3:9: +3:10 - StorageLive(_3); // scope 1 at $DIR/branch.rs:+3:16: +3:22 - _3 = cond() -> bb2; // scope 1 at $DIR/branch.rs:+3:16: +3:22 - // mir::Constant - // + span: $DIR/branch.rs:16:16: 16:20 - // + literal: Const { ty: fn() -> bool {cond}, val: Value() } - } - - bb2: { - switchInt(move _3) -> [0: bb4, otherwise: bb3]; // scope 1 at $DIR/branch.rs:+3:16: +3:22 - } - - bb3: { -- _2 = _1; // scope 1 at $DIR/branch.rs:+4:9: +4:10 -+ nop; // scope 1 at $DIR/branch.rs:+4:9: +4:10 - goto -> bb6; // scope 1 at $DIR/branch.rs:+3:13: +8:6 - } - - bb4: { - StorageLive(_4); // scope 1 at $DIR/branch.rs:+6:9: +6:14 - _4 = val() -> bb5; // scope 1 at $DIR/branch.rs:+6:9: +6:14 - // mir::Constant - // + span: $DIR/branch.rs:19:9: 19:12 - // + literal: Const { ty: fn() -> i32 {val}, val: Value() } - } - - bb5: { - StorageDead(_4); // scope 1 at $DIR/branch.rs:+6:14: +6:15 -- _2 = _1; // scope 1 at $DIR/branch.rs:+7:9: +7:10 -+ nop; // scope 1 at $DIR/branch.rs:+7:9: +7:10 - goto -> bb6; // scope 1 at $DIR/branch.rs:+3:13: +8:6 - } - - bb6: { - StorageDead(_3); // scope 1 at $DIR/branch.rs:+8:5: +8:6 -- _0 = _2; // scope 2 at $DIR/branch.rs:+10:5: +10:6 -- StorageDead(_2); // scope 1 at $DIR/branch.rs:+11:1: +11:2 -- StorageDead(_1); // scope 0 at $DIR/branch.rs:+11:1: +11:2 -+ nop; // scope 2 at $DIR/branch.rs:+10:5: +10:6 -+ nop; // scope 1 at $DIR/branch.rs:+11:1: +11:2 -+ nop; // scope 0 at $DIR/branch.rs:+11:1: +11:2 - return; // scope 0 at $DIR/branch.rs:+11:2: +11:2 - } - } - diff --git a/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-abort.diff new file mode 100644 index 000000000..10ec3aa55 --- /dev/null +++ b/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-abort.diff @@ -0,0 +1,66 @@ +- // MIR for `foo` before DestinationPropagation ++ // MIR for `foo` after DestinationPropagation + + fn foo() -> i32 { + let mut _0: i32; + let _1: i32; + let mut _3: bool; + let _4: i32; + scope 1 { +- debug x => _1; ++ debug x => _0; + let _2: i32; + scope 2 { +- debug y => _2; ++ debug y => _0; + } + } + + bb0: { +- StorageLive(_1); +- _1 = val() -> [return: bb1, unwind unreachable]; ++ nop; ++ _0 = val() -> [return: bb1, unwind unreachable]; + } + + bb1: { +- StorageLive(_2); ++ nop; + StorageLive(_3); + _3 = cond() -> [return: bb2, unwind unreachable]; + } + + bb2: { + switchInt(move _3) -> [0: bb4, otherwise: bb3]; + } + + bb3: { +- _2 = _1; ++ nop; + goto -> bb6; + } + + bb4: { + StorageLive(_4); + _4 = val() -> [return: bb5, unwind unreachable]; + } + + bb5: { + StorageDead(_4); +- _2 = _1; ++ nop; + goto -> bb6; + } + + bb6: { + StorageDead(_3); +- _0 = _2; +- StorageDead(_2); +- StorageDead(_1); ++ nop; ++ nop; ++ nop; + return; + } + } + diff --git a/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-unwind.diff new file mode 100644 index 000000000..759c1cabf --- /dev/null +++ b/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-unwind.diff @@ -0,0 +1,66 @@ +- // MIR for `foo` before DestinationPropagation ++ // MIR for `foo` after DestinationPropagation + + fn foo() -> i32 { + let mut _0: i32; + let _1: i32; + let mut _3: bool; + let _4: i32; + scope 1 { +- debug x => _1; ++ debug x => _0; + let _2: i32; + scope 2 { +- debug y => _2; ++ debug y => _0; + } + } + + bb0: { +- StorageLive(_1); +- _1 = val() -> [return: bb1, unwind continue]; ++ nop; ++ _0 = val() -> [return: bb1, unwind continue]; + } + + bb1: { +- StorageLive(_2); ++ nop; + StorageLive(_3); + _3 = cond() -> [return: bb2, unwind continue]; + } + + bb2: { + switchInt(move _3) -> [0: bb4, otherwise: bb3]; + } + + bb3: { +- _2 = _1; ++ nop; + goto -> bb6; + } + + bb4: { + StorageLive(_4); + _4 = val() -> [return: bb5, unwind continue]; + } + + bb5: { + StorageDead(_4); +- _2 = _1; ++ nop; + goto -> bb6; + } + + bb6: { + StorageDead(_3); +- _0 = _2; +- StorageDead(_2); +- StorageDead(_1); ++ nop; ++ nop; ++ nop; + return; + } + } + diff --git a/tests/mir-opt/dest-prop/branch.rs b/tests/mir-opt/dest-prop/branch.rs index 7e4276e66..5007aafb6 100644 --- a/tests/mir-opt/dest-prop/branch.rs +++ b/tests/mir-opt/dest-prop/branch.rs @@ -1,4 +1,4 @@ -// ignore-wasm32 compiled with panic=abort by default +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY //! Tests that assignment in both branches of an `if` are eliminated. // unit-test: DestinationPropagation fn val() -> i32 { diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.diff deleted file mode 100644 index 4343a5935..000000000 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.diff +++ /dev/null @@ -1,26 +0,0 @@ -- // 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:+0:12: +0:17 - let mut _0: i32; // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:27: +0:30 - let _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:+1:9: +1:10 - scope 1 { -- debug y => _2; // in scope 1 at $DIR/copy_propagation_arg.rs:+1:9: +1:10 -+ debug y => _0; // in scope 1 at $DIR/copy_propagation_arg.rs:+1:9: +1:10 - } - - bb0: { -- StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+1:9: +1:10 -- _2 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14 -+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+1:9: +1:10 -+ _0 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14 - _1 = const 123_i32; // scope 1 at $DIR/copy_propagation_arg.rs:+2:5: +2:12 -- _0 = _2; // scope 1 at $DIR/copy_propagation_arg.rs:+3:5: +3:6 -- StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+4:1: +4:2 -+ nop; // scope 1 at $DIR/copy_propagation_arg.rs:+3:5: +3:6 -+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+4:1: +4:2 - return; // scope 0 at $DIR/copy_propagation_arg.rs:+4:2: +4:2 - } - } - diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-abort.diff new file mode 100644 index 000000000..1aed07f9e --- /dev/null +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-abort.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; + let mut _0: i32; + let _2: i32; + scope 1 { +- debug y => _2; ++ debug y => _0; + } + + bb0: { +- StorageLive(_2); +- _2 = _1; ++ nop; ++ _0 = _1; + _1 = const 123_i32; +- _0 = _2; +- StorageDead(_2); ++ nop; ++ nop; + return; + } + } + diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-unwind.diff new file mode 100644 index 000000000..1aed07f9e --- /dev/null +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-unwind.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; + let mut _0: i32; + let _2: i32; + scope 1 { +- debug y => _2; ++ debug y => _0; + } + + bb0: { +- StorageLive(_2); +- _2 = _1; ++ nop; ++ _0 = _1; + _1 = const 123_i32; +- _0 = _2; +- StorageDead(_2); ++ nop; ++ nop; + return; + } + } + diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.diff deleted file mode 100644 index a61e741f7..000000000 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.diff +++ /dev/null @@ -1,32 +0,0 @@ -- // 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:+0:8: +0:13 - let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +0:19 - let _2: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13 - let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12 - - bb0: { - StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13 -- StorageLive(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12 -- _3 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12 -- _2 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13 -+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12 -+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12 -+ _2 = dummy(move _1) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13 - // mir::Constant - // + span: $DIR/copy_propagation_arg.rs:17:5: 17:10 - // + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value() } - } - - bb1: { -- StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+1:12: +1:13 -+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+1:12: +1:13 - StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14 - _1 = const 5_u8; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:10 - _0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +3:2 - return; // scope 0 at $DIR/copy_propagation_arg.rs:+3:2: +3:2 - } - } - diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-abort.diff new file mode 100644 index 000000000..641dea594 --- /dev/null +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-abort.diff @@ -0,0 +1,29 @@ +- // MIR for `bar` before DestinationPropagation ++ // MIR for `bar` after DestinationPropagation + + fn bar(_1: u8) -> () { + debug x => _1; + let mut _0: (); + let _2: u8; + let mut _3: u8; + + bb0: { + StorageLive(_2); +- StorageLive(_3); +- _3 = _1; +- _2 = dummy(move _3) -> [return: bb1, unwind unreachable]; ++ nop; ++ nop; ++ _2 = dummy(move _1) -> [return: bb1, unwind unreachable]; + } + + bb1: { +- StorageDead(_3); ++ nop; + StorageDead(_2); + _1 = const 5_u8; + _0 = const (); + return; + } + } + diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-unwind.diff new file mode 100644 index 000000000..8b2835c8c --- /dev/null +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-unwind.diff @@ -0,0 +1,29 @@ +- // MIR for `bar` before DestinationPropagation ++ // MIR for `bar` after DestinationPropagation + + fn bar(_1: u8) -> () { + debug x => _1; + let mut _0: (); + let _2: u8; + let mut _3: u8; + + bb0: { + StorageLive(_2); +- StorageLive(_3); +- _3 = _1; +- _2 = dummy(move _3) -> [return: bb1, unwind continue]; ++ nop; ++ nop; ++ _2 = dummy(move _1) -> [return: bb1, unwind continue]; + } + + bb1: { +- StorageDead(_3); ++ nop; + StorageDead(_2); + _1 = const 5_u8; + _0 = const (); + return; + } + } + diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.diff deleted file mode 100644 index bc88787e6..000000000 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.diff +++ /dev/null @@ -1,22 +0,0 @@ -- // MIR for `baz` before DestinationPropagation -+ // MIR for `baz` after DestinationPropagation - - fn baz(_1: i32) -> i32 { - debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:+0:8: +0:13 - let mut _0: i32; // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:23: +0:26 - let mut _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10 - - bb0: { -- StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10 -- _2 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10 -- _1 = move _2; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:10 -- StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10 -+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10 -+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10 -+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:10 -+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10 - _0 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+3:5: +3:6 - return; // scope 0 at $DIR/copy_propagation_arg.rs:+4:2: +4:2 - } - } - diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-abort.diff new file mode 100644 index 000000000..4cddaec01 --- /dev/null +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-abort.diff @@ -0,0 +1,22 @@ +- // MIR for `baz` before DestinationPropagation ++ // MIR for `baz` after DestinationPropagation + + fn baz(_1: i32) -> i32 { + debug x => _1; + let mut _0: i32; + let mut _2: i32; + + bb0: { +- StorageLive(_2); +- _2 = _1; +- _1 = move _2; +- StorageDead(_2); ++ nop; ++ nop; ++ nop; ++ nop; + _0 = _1; + return; + } + } + diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-unwind.diff new file mode 100644 index 000000000..4cddaec01 --- /dev/null +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-unwind.diff @@ -0,0 +1,22 @@ +- // MIR for `baz` before DestinationPropagation ++ // MIR for `baz` after DestinationPropagation + + fn baz(_1: i32) -> i32 { + debug x => _1; + let mut _0: i32; + let mut _2: i32; + + bb0: { +- StorageLive(_2); +- _2 = _1; +- _1 = move _2; +- StorageDead(_2); ++ nop; ++ nop; ++ nop; ++ nop; + _0 = _1; + return; + } + } + diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.diff deleted file mode 100644 index c7fbecac5..000000000 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.diff +++ /dev/null @@ -1,32 +0,0 @@ -- // 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:+0:8: +0:13 - let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +0:19 - let mut _2: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17 - let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+2:15: +2:16 - - bb0: { -- StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17 -+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17 - StorageLive(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+2:15: +2:16 - _3 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:15: +2:16 -- _2 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17 -+ _1 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17 - // mir::Constant - // + span: $DIR/copy_propagation_arg.rs:12:9: 12:14 - // + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value() } - } - - bb1: { - StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+2:16: +2:17 -- _1 = move _2; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:17 -- StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:16: +2:17 -+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:17 -+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:16: +2:17 - _0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +3:2 - return; // scope 0 at $DIR/copy_propagation_arg.rs:+3:2: +3:2 - } - } - diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-abort.diff new file mode 100644 index 000000000..54875cade --- /dev/null +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-abort.diff @@ -0,0 +1,29 @@ +- // MIR for `foo` before DestinationPropagation ++ // MIR for `foo` after DestinationPropagation + + fn foo(_1: u8) -> () { + debug x => _1; + let mut _0: (); + let mut _2: u8; + let mut _3: u8; + + bb0: { +- StorageLive(_2); ++ nop; + StorageLive(_3); + _3 = _1; +- _2 = dummy(move _3) -> [return: bb1, unwind unreachable]; ++ _1 = dummy(move _3) -> [return: bb1, unwind unreachable]; + } + + bb1: { + StorageDead(_3); +- _1 = move _2; +- StorageDead(_2); ++ nop; ++ nop; + _0 = const (); + return; + } + } + diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff new file mode 100644 index 000000000..b4c8a8927 --- /dev/null +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff @@ -0,0 +1,29 @@ +- // MIR for `foo` before DestinationPropagation ++ // MIR for `foo` after DestinationPropagation + + fn foo(_1: u8) -> () { + debug x => _1; + let mut _0: (); + let mut _2: u8; + let mut _3: u8; + + bb0: { +- StorageLive(_2); ++ nop; + StorageLive(_3); + _3 = _1; +- _2 = dummy(move _3) -> [return: bb1, unwind continue]; ++ _1 = dummy(move _3) -> [return: bb1, unwind continue]; + } + + bb1: { + StorageDead(_3); +- _1 = move _2; +- StorageDead(_2); ++ nop; ++ nop; + _0 = const (); + return; + } + } + diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.rs b/tests/mir-opt/dest-prop/copy_propagation_arg.rs index 57cb328c2..1f8d58892 100644 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.rs +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.rs @@ -1,4 +1,4 @@ -// ignore-wasm32 compiled with panic=abort by default +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Check that DestinationPropagation does not propagate an assignment to a function argument // (doing so can break usages of the original argument value) // unit-test: DestinationPropagation diff --git a/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff b/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff deleted file mode 100644 index b06f069a2..000000000 --- a/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff +++ /dev/null @@ -1,77 +0,0 @@ -- // MIR for `main` before DestinationPropagation -+ // MIR for `main` after DestinationPropagation - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:+0:11: +0:11 - let mut _1: i32; // in scope 0 at $DIR/cycle.rs:+1:9: +1:14 - let mut _4: i32; // in scope 0 at $DIR/cycle.rs:+4:9: +4:10 - let _5: (); // in scope 0 at $DIR/cycle.rs:+6:5: +6:12 - let mut _6: i32; // in scope 0 at $DIR/cycle.rs:+6:10: +6:11 - scope 1 { -- debug x => _1; // in scope 1 at $DIR/cycle.rs:+1:9: +1:14 -+ debug x => _6; // in scope 1 at $DIR/cycle.rs:+1:9: +1:14 - let _2: i32; // in scope 1 at $DIR/cycle.rs:+2:9: +2:10 - scope 2 { -- debug y => _2; // in scope 2 at $DIR/cycle.rs:+2:9: +2:10 -+ debug y => _6; // in scope 2 at $DIR/cycle.rs:+2:9: +2:10 - let _3: i32; // in scope 2 at $DIR/cycle.rs:+3:9: +3:10 - scope 3 { -- debug z => _3; // in scope 3 at $DIR/cycle.rs:+3:9: +3:10 -+ debug z => _6; // in scope 3 at $DIR/cycle.rs:+3:9: +3:10 - } - } - } - - bb0: { -- StorageLive(_1); // scope 0 at $DIR/cycle.rs:+1:9: +1:14 -- _1 = val() -> bb1; // scope 0 at $DIR/cycle.rs:+1:17: +1:22 -+ nop; // scope 0 at $DIR/cycle.rs:+1:9: +1:14 -+ _6 = val() -> bb1; // scope 0 at $DIR/cycle.rs:+1:17: +1:22 - // mir::Constant - // + span: $DIR/cycle.rs:10:17: 10:20 - // + literal: Const { ty: fn() -> i32 {val}, val: Value() } - } - - bb1: { -- StorageLive(_2); // scope 1 at $DIR/cycle.rs:+2:9: +2:10 -- _2 = _1; // scope 1 at $DIR/cycle.rs:+2:13: +2:14 -- StorageLive(_3); // scope 2 at $DIR/cycle.rs:+3:9: +3:10 -- _3 = _2; // scope 2 at $DIR/cycle.rs:+3:13: +3:14 -- StorageLive(_4); // scope 3 at $DIR/cycle.rs:+4:9: +4:10 -- _4 = _3; // scope 3 at $DIR/cycle.rs:+4:9: +4:10 -- _1 = move _4; // scope 3 at $DIR/cycle.rs:+4:5: +4:10 -- StorageDead(_4); // scope 3 at $DIR/cycle.rs:+4:9: +4:10 -+ nop; // scope 1 at $DIR/cycle.rs:+2:9: +2:10 -+ nop; // scope 1 at $DIR/cycle.rs:+2:13: +2:14 -+ nop; // scope 2 at $DIR/cycle.rs:+3:9: +3:10 -+ nop; // scope 2 at $DIR/cycle.rs:+3:13: +3:14 -+ nop; // scope 3 at $DIR/cycle.rs:+4:9: +4:10 -+ nop; // scope 3 at $DIR/cycle.rs:+4:9: +4:10 -+ nop; // scope 3 at $DIR/cycle.rs:+4:5: +4:10 -+ nop; // scope 3 at $DIR/cycle.rs:+4:9: +4:10 - StorageLive(_5); // scope 3 at $DIR/cycle.rs:+6:5: +6:12 -- StorageLive(_6); // scope 3 at $DIR/cycle.rs:+6:10: +6:11 -- _6 = _1; // scope 3 at $DIR/cycle.rs:+6:10: +6:11 -+ nop; // scope 3 at $DIR/cycle.rs:+6:10: +6:11 -+ nop; // scope 3 at $DIR/cycle.rs:+6:10: +6:11 - _5 = std::mem::drop::(move _6) -> bb2; // scope 3 at $DIR/cycle.rs:+6:5: +6:12 - // mir::Constant - // + span: $DIR/cycle.rs:15:5: 15:9 - // + literal: Const { ty: fn(i32) {std::mem::drop::}, val: Value() } - } - - bb2: { -- StorageDead(_6); // scope 3 at $DIR/cycle.rs:+6:11: +6:12 -+ nop; // scope 3 at $DIR/cycle.rs:+6:11: +6:12 - StorageDead(_5); // scope 3 at $DIR/cycle.rs:+6:12: +6:13 - _0 = const (); // scope 0 at $DIR/cycle.rs:+0:11: +7:2 -- StorageDead(_3); // scope 2 at $DIR/cycle.rs:+7:1: +7:2 -- StorageDead(_2); // scope 1 at $DIR/cycle.rs:+7:1: +7:2 -- StorageDead(_1); // scope 0 at $DIR/cycle.rs:+7:1: +7:2 -+ nop; // scope 2 at $DIR/cycle.rs:+7:1: +7:2 -+ nop; // scope 1 at $DIR/cycle.rs:+7:1: +7:2 -+ nop; // scope 0 at $DIR/cycle.rs:+7:1: +7:2 - return; // scope 0 at $DIR/cycle.rs:+7:2: +7:2 - } - } - diff --git a/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-abort.diff new file mode 100644 index 000000000..98b4ee866 --- /dev/null +++ b/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-abort.diff @@ -0,0 +1,71 @@ +- // MIR for `main` before DestinationPropagation ++ // MIR for `main` after DestinationPropagation + + fn main() -> () { + let mut _0: (); + let mut _1: i32; + let mut _4: i32; + let _5: (); + let mut _6: i32; + scope 1 { +- debug x => _1; ++ debug x => _6; + let _2: i32; + scope 2 { +- debug y => _2; ++ debug y => _6; + let _3: i32; + scope 3 { +- debug z => _3; ++ debug z => _6; + } + } + } + + bb0: { +- StorageLive(_1); +- _1 = val() -> [return: bb1, unwind unreachable]; ++ nop; ++ _6 = val() -> [return: bb1, unwind unreachable]; + } + + bb1: { +- StorageLive(_2); +- _2 = _1; +- StorageLive(_3); +- _3 = _2; +- StorageLive(_4); +- _4 = _3; +- _1 = move _4; +- StorageDead(_4); ++ nop; ++ nop; ++ nop; ++ nop; ++ nop; ++ nop; ++ nop; ++ nop; + StorageLive(_5); +- StorageLive(_6); +- _6 = _1; ++ nop; ++ nop; + _5 = std::mem::drop::(move _6) -> [return: bb2, unwind unreachable]; + } + + bb2: { +- StorageDead(_6); ++ nop; + StorageDead(_5); + _0 = const (); +- StorageDead(_3); +- StorageDead(_2); +- StorageDead(_1); ++ nop; ++ nop; ++ nop; + return; + } + } + diff --git a/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-unwind.diff new file mode 100644 index 000000000..6f6e01d37 --- /dev/null +++ b/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-unwind.diff @@ -0,0 +1,71 @@ +- // MIR for `main` before DestinationPropagation ++ // MIR for `main` after DestinationPropagation + + fn main() -> () { + let mut _0: (); + let mut _1: i32; + let mut _4: i32; + let _5: (); + let mut _6: i32; + scope 1 { +- debug x => _1; ++ debug x => _6; + let _2: i32; + scope 2 { +- debug y => _2; ++ debug y => _6; + let _3: i32; + scope 3 { +- debug z => _3; ++ debug z => _6; + } + } + } + + bb0: { +- StorageLive(_1); +- _1 = val() -> [return: bb1, unwind continue]; ++ nop; ++ _6 = val() -> [return: bb1, unwind continue]; + } + + bb1: { +- StorageLive(_2); +- _2 = _1; +- StorageLive(_3); +- _3 = _2; +- StorageLive(_4); +- _4 = _3; +- _1 = move _4; +- StorageDead(_4); ++ nop; ++ nop; ++ nop; ++ nop; ++ nop; ++ nop; ++ nop; ++ nop; + StorageLive(_5); +- StorageLive(_6); +- _6 = _1; ++ nop; ++ nop; + _5 = std::mem::drop::(move _6) -> [return: bb2, unwind continue]; + } + + bb2: { +- StorageDead(_6); ++ nop; + StorageDead(_5); + _0 = const (); +- StorageDead(_3); +- StorageDead(_2); +- StorageDead(_1); ++ nop; ++ nop; ++ nop; + return; + } + } + diff --git a/tests/mir-opt/dest-prop/cycle.rs b/tests/mir-opt/dest-prop/cycle.rs index 3aea19d80..9bc0cb05a 100644 --- a/tests/mir-opt/dest-prop/cycle.rs +++ b/tests/mir-opt/dest-prop/cycle.rs @@ -1,4 +1,4 @@ -// ignore-wasm32 compiled with panic=abort by default +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY //! Tests that cyclic assignments don't hang DestinationPropagation, and result in reasonable code. // unit-test: DestinationPropagation fn val() -> i32 { diff --git a/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.mir b/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.mir deleted file mode 100644 index b9d4b59d2..000000000 --- a/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.mir +++ /dev/null @@ -1,34 +0,0 @@ -// MIR for `f` after DestinationPropagation - -fn f(_1: usize) -> usize { - debug a => _1; // in scope 0 at $DIR/dead_stores_79191.rs:+0:6: +0:11 - let mut _0: usize; // return place in scope 0 at $DIR/dead_stores_79191.rs:+0:23: +0:28 - let _2: usize; // in scope 0 at $DIR/dead_stores_79191.rs:+1:9: +1:10 - let mut _3: usize; // in scope 0 at $DIR/dead_stores_79191.rs:+3:9: +3:10 - let mut _4: usize; // in scope 0 at $DIR/dead_stores_79191.rs:+4:8: +4:9 - scope 1 { - debug b => _3; // in scope 1 at $DIR/dead_stores_79191.rs:+1:9: +1:10 - } - - bb0: { - nop; // scope 0 at $DIR/dead_stores_79191.rs:+1:9: +1:10 - _3 = _1; // scope 0 at $DIR/dead_stores_79191.rs:+1:13: +1:14 - _1 = const 5_usize; // scope 1 at $DIR/dead_stores_79191.rs:+2:5: +2:10 - nop; // scope 1 at $DIR/dead_stores_79191.rs:+3:9: +3:10 - nop; // scope 1 at $DIR/dead_stores_79191.rs:+3:9: +3:10 - _1 = move _3; // scope 1 at $DIR/dead_stores_79191.rs:+3:5: +3:10 - nop; // scope 1 at $DIR/dead_stores_79191.rs:+3:9: +3:10 - nop; // scope 1 at $DIR/dead_stores_79191.rs:+4:8: +4:9 - nop; // scope 1 at $DIR/dead_stores_79191.rs:+4:8: +4:9 - _0 = id::(move _1) -> bb1; // scope 1 at $DIR/dead_stores_79191.rs:+4:5: +4:10 - // mir::Constant - // + span: $DIR/dead_stores_79191.rs:13:5: 13:7 - // + literal: Const { ty: fn(usize) -> usize {id::}, val: Value() } - } - - bb1: { - nop; // scope 1 at $DIR/dead_stores_79191.rs:+4:9: +4:10 - nop; // scope 0 at $DIR/dead_stores_79191.rs:+5:1: +5:2 - return; // scope 0 at $DIR/dead_stores_79191.rs:+5:2: +5:2 - } -} diff --git a/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-abort.mir b/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-abort.mir new file mode 100644 index 000000000..eb160fc19 --- /dev/null +++ b/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-abort.mir @@ -0,0 +1,31 @@ +// MIR for `f` after DestinationPropagation + +fn f(_1: usize) -> usize { + debug a => _1; + let mut _0: usize; + let _2: usize; + let mut _3: usize; + let mut _4: usize; + scope 1 { + debug b => _3; + } + + bb0: { + nop; + _3 = _1; + _1 = const 5_usize; + nop; + nop; + _1 = move _3; + nop; + nop; + nop; + _0 = id::(move _1) -> [return: bb1, unwind unreachable]; + } + + bb1: { + nop; + nop; + return; + } +} diff --git a/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-unwind.mir b/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-unwind.mir new file mode 100644 index 000000000..9147de2ec --- /dev/null +++ b/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-unwind.mir @@ -0,0 +1,31 @@ +// MIR for `f` after DestinationPropagation + +fn f(_1: usize) -> usize { + debug a => _1; + let mut _0: usize; + let _2: usize; + let mut _3: usize; + let mut _4: usize; + scope 1 { + debug b => _3; + } + + bb0: { + nop; + _3 = _1; + _1 = const 5_usize; + nop; + nop; + _1 = move _3; + nop; + nop; + nop; + _0 = id::(move _1) -> [return: bb1, unwind continue]; + } + + bb1: { + nop; + nop; + return; + } +} diff --git a/tests/mir-opt/dest-prop/dead_stores_79191.rs b/tests/mir-opt/dest-prop/dead_stores_79191.rs index 9d4814838..2f95ba0e3 100644 --- a/tests/mir-opt/dest-prop/dead_stores_79191.rs +++ b/tests/mir-opt/dest-prop/dead_stores_79191.rs @@ -1,4 +1,4 @@ -// ignore-wasm32 compiled with panic=abort by default +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: DestinationPropagation fn id(x: T) -> T { diff --git a/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.mir b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.mir deleted file mode 100644 index 9eb0e09bf..000000000 --- a/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.mir +++ /dev/null @@ -1,33 +0,0 @@ -// MIR for `f` after DestinationPropagation - -fn f(_1: usize) -> usize { - debug a => _1; // in scope 0 at $DIR/dead_stores_better.rs:+0:10: +0:15 - let mut _0: usize; // return place in scope 0 at $DIR/dead_stores_better.rs:+0:27: +0:32 - let _2: usize; // in scope 0 at $DIR/dead_stores_better.rs:+1:9: +1:10 - let mut _3: usize; // in scope 0 at $DIR/dead_stores_better.rs:+3:9: +3:10 - let mut _4: usize; // in scope 0 at $DIR/dead_stores_better.rs:+4:8: +4:9 - scope 1 { - debug b => _1; // in scope 1 at $DIR/dead_stores_better.rs:+1:9: +1:10 - } - - bb0: { - nop; // scope 0 at $DIR/dead_stores_better.rs:+1:9: +1:10 - nop; // scope 0 at $DIR/dead_stores_better.rs:+1:13: +1:14 - nop; // scope 1 at $DIR/dead_stores_better.rs:+3:9: +3:10 - nop; // scope 1 at $DIR/dead_stores_better.rs:+3:9: +3:10 - nop; // scope 1 at $DIR/dead_stores_better.rs:+3:5: +3:10 - nop; // scope 1 at $DIR/dead_stores_better.rs:+3:9: +3:10 - nop; // scope 1 at $DIR/dead_stores_better.rs:+4:8: +4:9 - nop; // scope 1 at $DIR/dead_stores_better.rs:+4:8: +4:9 - _0 = id::(move _1) -> bb1; // scope 1 at $DIR/dead_stores_better.rs:+4:5: +4:10 - // mir::Constant - // + span: $DIR/dead_stores_better.rs:17:5: 17:7 - // + literal: Const { ty: fn(usize) -> usize {id::}, val: Value() } - } - - bb1: { - nop; // scope 1 at $DIR/dead_stores_better.rs:+4:9: +4:10 - nop; // scope 0 at $DIR/dead_stores_better.rs:+5:1: +5:2 - return; // scope 0 at $DIR/dead_stores_better.rs:+5:2: +5:2 - } -} diff --git a/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-abort.mir b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-abort.mir new file mode 100644 index 000000000..a3ec09010 --- /dev/null +++ b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-abort.mir @@ -0,0 +1,30 @@ +// MIR for `f` after DestinationPropagation + +fn f(_1: usize) -> usize { + debug a => _1; + let mut _0: usize; + let _2: usize; + let mut _3: usize; + let mut _4: usize; + scope 1 { + debug b => _1; + } + + bb0: { + nop; + nop; + nop; + nop; + nop; + nop; + nop; + nop; + _0 = id::(move _1) -> [return: bb1, unwind unreachable]; + } + + bb1: { + nop; + nop; + return; + } +} diff --git a/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir new file mode 100644 index 000000000..185feb4b4 --- /dev/null +++ b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir @@ -0,0 +1,30 @@ +// MIR for `f` after DestinationPropagation + +fn f(_1: usize) -> usize { + debug a => _1; + let mut _0: usize; + let _2: usize; + let mut _3: usize; + let mut _4: usize; + scope 1 { + debug b => _1; + } + + bb0: { + nop; + nop; + nop; + nop; + nop; + nop; + nop; + nop; + _0 = id::(move _1) -> [return: bb1, unwind continue]; + } + + bb1: { + nop; + nop; + return; + } +} diff --git a/tests/mir-opt/dest-prop/dead_stores_better.rs b/tests/mir-opt/dest-prop/dead_stores_better.rs index 72d406bfd..e67653c57 100644 --- a/tests/mir-opt/dest-prop/dead_stores_better.rs +++ b/tests/mir-opt/dest-prop/dead_stores_better.rs @@ -1,4 +1,4 @@ -// ignore-wasm32 compiled with panic=abort by default +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY // This is a copy of the `dead_stores_79191` test, except that we turn on DSE. This demonstrates // that that pass enables this one to do more optimizations. diff --git a/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.diff b/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.diff deleted file mode 100644 index c2a3a0025..000000000 --- a/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.diff +++ /dev/null @@ -1,43 +0,0 @@ -- // MIR for `nrvo` before DestinationPropagation -+ // MIR for `nrvo` after DestinationPropagation - - fn nrvo(_1: for<'a> fn(&'a mut [u8; 1024])) -> [u8; 1024] { - debug init => _1; // in scope 0 at $DIR/simple.rs:+0:9: +0:13 - let mut _0: [u8; 1024]; // return place in scope 0 at $DIR/simple.rs:+0:39: +0:49 - let mut _2: [u8; 1024]; // in scope 0 at $DIR/simple.rs:+1:9: +1:16 - let _3: (); // in scope 0 at $DIR/simple.rs:+2:5: +2:19 - let mut _4: for<'a> fn(&'a mut [u8; 1024]); // in scope 0 at $DIR/simple.rs:+2:5: +2:9 - let mut _5: &mut [u8; 1024]; // in scope 0 at $DIR/simple.rs:+2:10: +2:18 - let mut _6: &mut [u8; 1024]; // in scope 0 at $DIR/simple.rs:+2:10: +2:18 - scope 1 { - debug buf => _2; // in scope 1 at $DIR/simple.rs:+1:9: +1:16 - } - - bb0: { - StorageLive(_2); // scope 0 at $DIR/simple.rs:+1:9: +1:16 - _2 = [const 0_u8; 1024]; // scope 0 at $DIR/simple.rs:+1:19: +1:28 - StorageLive(_3); // scope 1 at $DIR/simple.rs:+2:5: +2:19 -- StorageLive(_4); // scope 1 at $DIR/simple.rs:+2:5: +2:9 -- _4 = _1; // scope 1 at $DIR/simple.rs:+2:5: +2:9 -+ nop; // scope 1 at $DIR/simple.rs:+2:5: +2:9 -+ nop; // scope 1 at $DIR/simple.rs:+2:5: +2:9 - StorageLive(_5); // scope 1 at $DIR/simple.rs:+2:10: +2:18 - StorageLive(_6); // scope 1 at $DIR/simple.rs:+2:10: +2:18 - _6 = &mut _2; // scope 1 at $DIR/simple.rs:+2:10: +2:18 - _5 = &mut (*_6); // scope 1 at $DIR/simple.rs:+2:10: +2:18 -- _3 = move _4(move _5) -> bb1; // scope 1 at $DIR/simple.rs:+2:5: +2:19 -+ _3 = move _1(move _5) -> bb1; // scope 1 at $DIR/simple.rs:+2:5: +2:19 - } - - bb1: { - StorageDead(_5); // scope 1 at $DIR/simple.rs:+2:18: +2:19 -- StorageDead(_4); // scope 1 at $DIR/simple.rs:+2:18: +2:19 -+ nop; // scope 1 at $DIR/simple.rs:+2:18: +2:19 - StorageDead(_6); // scope 1 at $DIR/simple.rs:+2:19: +2:20 - StorageDead(_3); // scope 1 at $DIR/simple.rs:+2:19: +2:20 - _0 = _2; // scope 1 at $DIR/simple.rs:+3:5: +3:8 - StorageDead(_2); // scope 0 at $DIR/simple.rs:+4:1: +4:2 - return; // scope 0 at $DIR/simple.rs:+4:2: +4:2 - } - } - diff --git a/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-abort.diff new file mode 100644 index 000000000..4d34f43fd --- /dev/null +++ b/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-abort.diff @@ -0,0 +1,43 @@ +- // MIR for `nrvo` before DestinationPropagation ++ // MIR for `nrvo` after DestinationPropagation + + fn nrvo(_1: for<'a> fn(&'a mut [u8; 1024])) -> [u8; 1024] { + debug init => _1; + let mut _0: [u8; 1024]; + let mut _2: [u8; 1024]; + let _3: (); + let mut _4: for<'a> fn(&'a mut [u8; 1024]); + let mut _5: &mut [u8; 1024]; + let mut _6: &mut [u8; 1024]; + scope 1 { + debug buf => _2; + } + + bb0: { + StorageLive(_2); + _2 = [const 0_u8; 1024]; + StorageLive(_3); +- StorageLive(_4); +- _4 = _1; ++ nop; ++ nop; + StorageLive(_5); + StorageLive(_6); + _6 = &mut _2; + _5 = &mut (*_6); +- _3 = move _4(move _5) -> [return: bb1, unwind unreachable]; ++ _3 = move _1(move _5) -> [return: bb1, unwind unreachable]; + } + + bb1: { + StorageDead(_5); +- StorageDead(_4); ++ nop; + StorageDead(_6); + StorageDead(_3); + _0 = _2; + StorageDead(_2); + return; + } + } + diff --git a/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-unwind.diff new file mode 100644 index 000000000..9c3cbef38 --- /dev/null +++ b/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-unwind.diff @@ -0,0 +1,43 @@ +- // MIR for `nrvo` before DestinationPropagation ++ // MIR for `nrvo` after DestinationPropagation + + fn nrvo(_1: for<'a> fn(&'a mut [u8; 1024])) -> [u8; 1024] { + debug init => _1; + let mut _0: [u8; 1024]; + let mut _2: [u8; 1024]; + let _3: (); + let mut _4: for<'a> fn(&'a mut [u8; 1024]); + let mut _5: &mut [u8; 1024]; + let mut _6: &mut [u8; 1024]; + scope 1 { + debug buf => _2; + } + + bb0: { + StorageLive(_2); + _2 = [const 0_u8; 1024]; + StorageLive(_3); +- StorageLive(_4); +- _4 = _1; ++ nop; ++ nop; + StorageLive(_5); + StorageLive(_6); + _6 = &mut _2; + _5 = &mut (*_6); +- _3 = move _4(move _5) -> [return: bb1, unwind continue]; ++ _3 = move _1(move _5) -> [return: bb1, unwind continue]; + } + + bb1: { + StorageDead(_5); +- StorageDead(_4); ++ nop; + StorageDead(_6); + StorageDead(_3); + _0 = _2; + StorageDead(_2); + return; + } + } + diff --git a/tests/mir-opt/dest-prop/simple.rs b/tests/mir-opt/dest-prop/simple.rs index 3a4aec34e..0bcb2924f 100644 --- a/tests/mir-opt/dest-prop/simple.rs +++ b/tests/mir-opt/dest-prop/simple.rs @@ -1,4 +1,4 @@ -// ignore-wasm32 compiled with panic=abort by default +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY //! Copy of `nrvo-simple.rs`, to ensure that full dest-prop handles it too. // unit-test: DestinationPropagation // EMIT_MIR simple.nrvo.DestinationPropagation.diff diff --git a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.diff b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.diff deleted file mode 100644 index 457fc8308..000000000 --- a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.diff +++ /dev/null @@ -1,35 +0,0 @@ -- // MIR for `main` before DestinationPropagation -+ // MIR for `main` after DestinationPropagation - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/union.rs:+0:11: +0:11 - let _1: main::Un; // in scope 0 at $DIR/union.rs:+5:9: +5:11 - let mut _2: u32; // in scope 0 at $DIR/union.rs:+5:23: +5:28 - let mut _3: u32; // in scope 0 at $DIR/union.rs:+7:10: +7:26 - scope 1 { - debug un => _1; // in scope 1 at $DIR/union.rs:+5:9: +5:11 - scope 2 { - } - scope 3 (inlined std::mem::drop::) { // at $DIR/union.rs:16:5: 16:27 - debug _x => _3; // in scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/union.rs:+5:9: +5:11 - StorageLive(_2); // scope 0 at $DIR/union.rs:+5:23: +5:28 - _2 = val() -> bb1; // scope 0 at $DIR/union.rs:+5:23: +5:28 - // mir::Constant - // + span: $DIR/union.rs:14:23: 14:26 - // + literal: Const { ty: fn() -> u32 {val}, val: Value() } - } - - bb1: { - StorageDead(_2); // scope 0 at $DIR/union.rs:+5:29: +5:30 - StorageLive(_3); // scope 1 at $DIR/union.rs:+7:10: +7:26 - StorageDead(_3); // scope 1 at $DIR/union.rs:+7:26: +7:27 - StorageDead(_1); // scope 0 at $DIR/union.rs:+8:1: +8:2 - return; // scope 0 at $DIR/union.rs:+8:2: +8:2 - } - } - diff --git a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff new file mode 100644 index 000000000..459a9c442 --- /dev/null +++ b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff @@ -0,0 +1,32 @@ +- // MIR for `main` before DestinationPropagation ++ // MIR for `main` after DestinationPropagation + + fn main() -> () { + let mut _0: (); + let _1: main::Un; + let mut _2: u32; + let mut _3: u32; + scope 1 { + debug un => _1; + scope 2 { + } + scope 3 (inlined std::mem::drop::) { + debug _x => _3; + } + } + + bb0: { + StorageLive(_1); + StorageLive(_2); + _2 = val() -> [return: bb1, unwind unreachable]; + } + + bb1: { + StorageDead(_2); + StorageLive(_3); + StorageDead(_3); + StorageDead(_1); + return; + } + } + diff --git a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff new file mode 100644 index 000000000..d2eef9058 --- /dev/null +++ b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff @@ -0,0 +1,32 @@ +- // MIR for `main` before DestinationPropagation ++ // MIR for `main` after DestinationPropagation + + fn main() -> () { + let mut _0: (); + let _1: main::Un; + let mut _2: u32; + let mut _3: u32; + scope 1 { + debug un => _1; + scope 2 { + } + scope 3 (inlined std::mem::drop::) { + debug _x => _3; + } + } + + bb0: { + StorageLive(_1); + StorageLive(_2); + _2 = val() -> [return: bb1, unwind continue]; + } + + bb1: { + StorageDead(_2); + StorageLive(_3); + StorageDead(_3); + StorageDead(_1); + return; + } + } + diff --git a/tests/mir-opt/dest-prop/union.rs b/tests/mir-opt/dest-prop/union.rs index 062d02d06..4bc6f28c6 100644 --- a/tests/mir-opt/dest-prop/union.rs +++ b/tests/mir-opt/dest-prop/union.rs @@ -1,4 +1,4 @@ -// ignore-wasm32 compiled with panic=abort by default +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY //! Tests that we can propagate into places that are projections into unions // compile-flags: -Zunsound-mir-opts fn val() -> u32 { diff --git a/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.diff b/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.diff deleted file mode 100644 index ae63d724d..000000000 --- a/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.diff +++ /dev/null @@ -1,86 +0,0 @@ -- // MIR for `f` before DestinationPropagation -+ // MIR for `f` after DestinationPropagation - - fn f(_1: T) -> () { - debug a => _1; // in scope 0 at $DIR/unreachable.rs:+0:19: +0:20 - let mut _0: (); // return place in scope 0 at $DIR/unreachable.rs:+0:25: +0:25 - let _2: T; // in scope 0 at $DIR/unreachable.rs:+1:9: +1:10 - let mut _3: bool; // in scope 0 at $DIR/unreachable.rs:+2:8: +2:13 - let _4: (); // in scope 0 at $DIR/unreachable.rs:+3:9: +3:16 - let mut _5: T; // in scope 0 at $DIR/unreachable.rs:+3:11: +3:12 - let mut _6: T; // in scope 0 at $DIR/unreachable.rs:+3:14: +3:15 - let _7: (); // in scope 0 at $DIR/unreachable.rs:+5:9: +5:16 - let mut _8: T; // in scope 0 at $DIR/unreachable.rs:+5:11: +5:12 - let mut _9: T; // in scope 0 at $DIR/unreachable.rs:+5:14: +5:15 - scope 1 { -- debug b => _2; // in scope 1 at $DIR/unreachable.rs:+1:9: +1:10 -+ debug b => _1; // in scope 1 at $DIR/unreachable.rs:+1:9: +1:10 - } - - bb0: { -- StorageLive(_2); // scope 0 at $DIR/unreachable.rs:+1:9: +1:10 -- _2 = _1; // scope 0 at $DIR/unreachable.rs:+1:13: +1:14 -+ nop; // scope 0 at $DIR/unreachable.rs:+1:9: +1:10 -+ nop; // scope 0 at $DIR/unreachable.rs:+1:13: +1:14 - StorageLive(_3); // scope 1 at $DIR/unreachable.rs:+2:8: +2:13 - _3 = const false; // scope 1 at $DIR/unreachable.rs:+2:8: +2:13 -- goto -> bb3; // scope 1 at $DIR/unreachable.rs:+2:8: +2:13 -+ goto -> bb1; // scope 1 at $DIR/unreachable.rs:+2:8: +2:13 - } - - bb1: { -- StorageLive(_4); // scope 1 at $DIR/unreachable.rs:+3:9: +3:16 -- StorageLive(_5); // scope 1 at $DIR/unreachable.rs:+3:11: +3:12 -- _5 = _1; // scope 1 at $DIR/unreachable.rs:+3:11: +3:12 -- StorageLive(_6); // scope 1 at $DIR/unreachable.rs:+3:14: +3:15 -- _6 = _2; // scope 1 at $DIR/unreachable.rs:+3:14: +3:15 -- _4 = g::(move _5, move _6) -> bb2; // scope 1 at $DIR/unreachable.rs:+3:9: +3:16 -- // mir::Constant -- // + span: $DIR/unreachable.rs:12:9: 12:10 -- // + literal: Const { ty: fn(T, T) {g::}, val: Value() } -- } -- -- bb2: { -- StorageDead(_6); // scope 1 at $DIR/unreachable.rs:+3:15: +3:16 -- StorageDead(_5); // scope 1 at $DIR/unreachable.rs:+3:15: +3:16 -- StorageDead(_4); // scope 1 at $DIR/unreachable.rs:+3:16: +3:17 -- _0 = const (); // scope 1 at $DIR/unreachable.rs:+2:14: +4:6 -- goto -> bb5; // scope 1 at $DIR/unreachable.rs:+2:5: +6:6 -- } -- -- bb3: { - StorageLive(_7); // scope 1 at $DIR/unreachable.rs:+5:9: +5:16 -- StorageLive(_8); // scope 1 at $DIR/unreachable.rs:+5:11: +5:12 -- _8 = _2; // scope 1 at $DIR/unreachable.rs:+5:11: +5:12 -+ nop; // scope 1 at $DIR/unreachable.rs:+5:11: +5:12 -+ nop; // scope 1 at $DIR/unreachable.rs:+5:11: +5:12 - StorageLive(_9); // scope 1 at $DIR/unreachable.rs:+5:14: +5:15 -- _9 = _2; // scope 1 at $DIR/unreachable.rs:+5:14: +5:15 -- _7 = g::(move _8, move _9) -> bb4; // scope 1 at $DIR/unreachable.rs:+5:9: +5:16 -+ _9 = _1; // scope 1 at $DIR/unreachable.rs:+5:14: +5:15 -+ _7 = g::(move _1, move _9) -> bb2; // scope 1 at $DIR/unreachable.rs:+5:9: +5:16 - // mir::Constant - // + span: $DIR/unreachable.rs:14:9: 14:10 - // + literal: Const { ty: fn(T, T) {g::}, val: Value() } - } - -- bb4: { -+ bb2: { - StorageDead(_9); // scope 1 at $DIR/unreachable.rs:+5:15: +5:16 -- StorageDead(_8); // scope 1 at $DIR/unreachable.rs:+5:15: +5:16 -+ nop; // scope 1 at $DIR/unreachable.rs:+5:15: +5:16 - StorageDead(_7); // scope 1 at $DIR/unreachable.rs:+5:16: +5:17 - _0 = const (); // scope 1 at $DIR/unreachable.rs:+4:12: +6:6 -- goto -> bb5; // scope 1 at $DIR/unreachable.rs:+2:5: +6:6 -+ goto -> bb3; // scope 1 at $DIR/unreachable.rs:+2:5: +6:6 - } - -- bb5: { -+ bb3: { - StorageDead(_3); // scope 1 at $DIR/unreachable.rs:+6:5: +6:6 -- StorageDead(_2); // scope 0 at $DIR/unreachable.rs:+7:1: +7:2 -+ nop; // scope 0 at $DIR/unreachable.rs:+7:1: +7:2 - return; // scope 0 at $DIR/unreachable.rs:+7:2: +7:2 - } - } - diff --git a/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-abort.diff new file mode 100644 index 000000000..97ca82509 --- /dev/null +++ b/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-abort.diff @@ -0,0 +1,80 @@ +- // MIR for `f` before DestinationPropagation ++ // MIR for `f` after DestinationPropagation + + fn f(_1: T) -> () { + debug a => _1; + let mut _0: (); + let _2: T; + let mut _3: bool; + let _4: (); + let mut _5: T; + let mut _6: T; + let _7: (); + let mut _8: T; + let mut _9: T; + scope 1 { +- debug b => _2; ++ debug b => _1; + } + + bb0: { +- StorageLive(_2); +- _2 = _1; ++ nop; ++ nop; + StorageLive(_3); + _3 = const false; +- goto -> bb3; ++ goto -> bb1; + } + + bb1: { +- StorageLive(_4); +- StorageLive(_5); +- _5 = _1; +- StorageLive(_6); +- _6 = _2; +- _4 = g::(move _5, move _6) -> [return: bb2, unwind unreachable]; +- } +- +- bb2: { +- StorageDead(_6); +- StorageDead(_5); +- StorageDead(_4); +- _0 = const (); +- goto -> bb5; +- } +- +- bb3: { + StorageLive(_7); +- StorageLive(_8); +- _8 = _2; ++ nop; ++ nop; + StorageLive(_9); +- _9 = _2; +- _7 = g::(move _8, move _9) -> [return: bb4, unwind unreachable]; ++ _9 = _1; ++ _7 = g::(move _1, move _9) -> [return: bb2, unwind unreachable]; + } + +- bb4: { ++ bb2: { + StorageDead(_9); +- StorageDead(_8); ++ nop; + StorageDead(_7); + _0 = const (); +- goto -> bb5; ++ goto -> bb3; + } + +- bb5: { ++ bb3: { + StorageDead(_3); +- StorageDead(_2); ++ nop; + return; + } + } + diff --git a/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-unwind.diff new file mode 100644 index 000000000..7f730a77b --- /dev/null +++ b/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-unwind.diff @@ -0,0 +1,80 @@ +- // MIR for `f` before DestinationPropagation ++ // MIR for `f` after DestinationPropagation + + fn f(_1: T) -> () { + debug a => _1; + let mut _0: (); + let _2: T; + let mut _3: bool; + let _4: (); + let mut _5: T; + let mut _6: T; + let _7: (); + let mut _8: T; + let mut _9: T; + scope 1 { +- debug b => _2; ++ debug b => _1; + } + + bb0: { +- StorageLive(_2); +- _2 = _1; ++ nop; ++ nop; + StorageLive(_3); + _3 = const false; +- goto -> bb3; ++ goto -> bb1; + } + + bb1: { +- StorageLive(_4); +- StorageLive(_5); +- _5 = _1; +- StorageLive(_6); +- _6 = _2; +- _4 = g::(move _5, move _6) -> [return: bb2, unwind continue]; +- } +- +- bb2: { +- StorageDead(_6); +- StorageDead(_5); +- StorageDead(_4); +- _0 = const (); +- goto -> bb5; +- } +- +- bb3: { + StorageLive(_7); +- StorageLive(_8); +- _8 = _2; ++ nop; ++ nop; + StorageLive(_9); +- _9 = _2; +- _7 = g::(move _8, move _9) -> [return: bb4, unwind continue]; ++ _9 = _1; ++ _7 = g::(move _1, move _9) -> [return: bb2, unwind continue]; + } + +- bb4: { ++ bb2: { + StorageDead(_9); +- StorageDead(_8); ++ nop; + StorageDead(_7); + _0 = const (); +- goto -> bb5; ++ goto -> bb3; + } + +- bb5: { ++ bb3: { + StorageDead(_3); +- StorageDead(_2); ++ nop; + return; + } + } + diff --git a/tests/mir-opt/dest-prop/unreachable.rs b/tests/mir-opt/dest-prop/unreachable.rs index c73d11ae3..e950dbbf5 100644 --- a/tests/mir-opt/dest-prop/unreachable.rs +++ b/tests/mir-opt/dest-prop/unreachable.rs @@ -1,4 +1,4 @@ -// ignore-wasm32 compiled with panic=abort by default +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Check that unreachable code is removed after the destination propagation. // Regression test for issue #105428. // -- cgit v1.2.3