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 --- .../cast.main.DataflowConstProp.diff | 48 +++---- .../checked.main.DataflowConstProp.diff | 80 ----------- ...checked.main.DataflowConstProp.panic-abort.diff | 80 +++++++++++ ...hecked.main.DataflowConstProp.panic-unwind.diff | 80 +++++++++++ tests/mir-opt/dataflow-const-prop/checked.rs | 2 +- .../enum.multiple.DataflowConstProp.diff | 88 ++++++------ ...enum.mutate_discriminant.DataflowConstProp.diff | 22 +-- .../enum.simple.DataflowConstProp.diff | 68 +++++----- .../if.main.DataflowConstProp.diff | 150 ++++++++++----------- .../inherit_overflow.main.DataflowConstProp.diff | 39 ------ ...verflow.main.DataflowConstProp.panic-abort.diff | 39 ++++++ ...erflow.main.DataflowConstProp.panic-unwind.diff | 39 ++++++ .../dataflow-const-prop/inherit_overflow.rs | 2 +- .../issue_81605.f.DataflowConstProp.diff | 34 ++--- .../ref_without_sb.main.DataflowConstProp.diff | 55 -------- ...hout_sb.main.DataflowConstProp.panic-abort.diff | 49 +++++++ ...out_sb.main.DataflowConstProp.panic-unwind.diff | 49 +++++++ .../mir-opt/dataflow-const-prop/ref_without_sb.rs | 2 +- .../repr_transparent.main.DataflowConstProp.diff | 58 ++++---- .../self_assign.main.DataflowConstProp.diff | 66 ++++----- .../self_assign_add.main.DataflowConstProp.diff | 24 ++-- .../sibling_ptr.main.DataflowConstProp.diff | 54 -------- ...ing_ptr.main.DataflowConstProp.panic-abort.diff | 51 +++++++ ...ng_ptr.main.DataflowConstProp.panic-unwind.diff | 51 +++++++ tests/mir-opt/dataflow-const-prop/sibling_ptr.rs | 2 +- .../struct.main.DataflowConstProp.diff | 72 +++++----- .../terminator.main.DataflowConstProp.diff | 40 ------ ...minator.main.DataflowConstProp.panic-abort.diff | 37 +++++ ...inator.main.DataflowConstProp.panic-unwind.diff | 37 +++++ tests/mir-opt/dataflow-const-prop/terminator.rs | 2 +- .../tuple.main.DataflowConstProp.diff | 112 +++++++-------- 31 files changed, 888 insertions(+), 644 deletions(-) delete mode 100644 tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.diff create mode 100644 tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff create mode 100644 tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff delete mode 100644 tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.diff create mode 100644 tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff create mode 100644 tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff delete mode 100644 tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.diff create mode 100644 tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-abort.diff create mode 100644 tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff delete mode 100644 tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.diff create mode 100644 tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff create mode 100644 tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff delete mode 100644 tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.diff create mode 100644 tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-abort.diff create mode 100644 tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-unwind.diff (limited to 'tests/mir-opt/dataflow-const-prop') diff --git a/tests/mir-opt/dataflow-const-prop/cast.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/cast.main.DataflowConstProp.diff index bf9ab8669..0ca446c89 100644 --- a/tests/mir-opt/dataflow-const-prop/cast.main.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/cast.main.DataflowConstProp.diff @@ -2,36 +2,36 @@ + // MIR for `main` after DataflowConstProp fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/cast.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/cast.rs:+1:9: +1:10 - let mut _3: u8; // in scope 0 at $DIR/cast.rs:+2:13: +2:20 - let mut _4: i32; // in scope 0 at $DIR/cast.rs:+2:13: +2:14 + let mut _0: (); + let _1: i32; + let mut _3: u8; + let mut _4: i32; scope 1 { - debug a => _1; // in scope 1 at $DIR/cast.rs:+1:9: +1:10 - let _2: u8; // in scope 1 at $DIR/cast.rs:+2:9: +2:10 + debug a => _1; + let _2: u8; scope 2 { - debug b => _2; // in scope 2 at $DIR/cast.rs:+2:9: +2:10 + debug b => _2; } } bb0: { - StorageLive(_1); // scope 0 at $DIR/cast.rs:+1:9: +1:10 - _1 = const 257_i32; // scope 0 at $DIR/cast.rs:+1:13: +1:16 - StorageLive(_2); // scope 1 at $DIR/cast.rs:+2:9: +2:10 - StorageLive(_3); // scope 1 at $DIR/cast.rs:+2:13: +2:20 - StorageLive(_4); // scope 1 at $DIR/cast.rs:+2:13: +2:14 -- _4 = _1; // scope 1 at $DIR/cast.rs:+2:13: +2:14 -- _3 = move _4 as u8 (IntToInt); // scope 1 at $DIR/cast.rs:+2:13: +2:20 -+ _4 = const 257_i32; // scope 1 at $DIR/cast.rs:+2:13: +2:14 -+ _3 = const 1_u8; // scope 1 at $DIR/cast.rs:+2:13: +2:20 - StorageDead(_4); // scope 1 at $DIR/cast.rs:+2:19: +2:20 -- _2 = Add(move _3, const 1_u8); // scope 1 at $DIR/cast.rs:+2:13: +2:24 -+ _2 = const 2_u8; // scope 1 at $DIR/cast.rs:+2:13: +2:24 - StorageDead(_3); // scope 1 at $DIR/cast.rs:+2:23: +2:24 - _0 = const (); // scope 0 at $DIR/cast.rs:+0:11: +3:2 - StorageDead(_2); // scope 1 at $DIR/cast.rs:+3:1: +3:2 - StorageDead(_1); // scope 0 at $DIR/cast.rs:+3:1: +3:2 - return; // scope 0 at $DIR/cast.rs:+3:2: +3:2 + StorageLive(_1); + _1 = const 257_i32; + StorageLive(_2); + StorageLive(_3); + StorageLive(_4); +- _4 = _1; +- _3 = move _4 as u8 (IntToInt); ++ _4 = const 257_i32; ++ _3 = const 1_u8; + StorageDead(_4); +- _2 = Add(move _3, const 1_u8); ++ _2 = const 2_u8; + StorageDead(_3); + _0 = const (); + StorageDead(_2); + StorageDead(_1); + return; } } diff --git a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.diff deleted file mode 100644 index 944afed8f..000000000 --- a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.diff +++ /dev/null @@ -1,80 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/checked.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/checked.rs:+1:9: +1:10 - let mut _4: i32; // in scope 0 at $DIR/checked.rs:+3:13: +3:14 - let mut _5: i32; // in scope 0 at $DIR/checked.rs:+3:17: +3:18 - let mut _6: (i32, bool); // in scope 0 at $DIR/checked.rs:+3:13: +3:18 - let mut _9: i32; // in scope 0 at $DIR/checked.rs:+6:13: +6:14 - let mut _10: (i32, bool); // in scope 0 at $DIR/checked.rs:+6:13: +6:18 - scope 1 { - debug a => _1; // in scope 1 at $DIR/checked.rs:+1:9: +1:10 - let _2: i32; // in scope 1 at $DIR/checked.rs:+2:9: +2:10 - scope 2 { - debug b => _2; // in scope 2 at $DIR/checked.rs:+2:9: +2:10 - let _3: i32; // in scope 2 at $DIR/checked.rs:+3:9: +3:10 - scope 3 { - debug c => _3; // in scope 3 at $DIR/checked.rs:+3:9: +3:10 - let _7: i32; // in scope 3 at $DIR/checked.rs:+5:9: +5:10 - scope 4 { - debug d => _7; // in scope 4 at $DIR/checked.rs:+5:9: +5:10 - let _8: i32; // in scope 4 at $DIR/checked.rs:+6:9: +6:10 - scope 5 { - debug e => _8; // in scope 5 at $DIR/checked.rs:+6:9: +6:10 - } - } - } - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/checked.rs:+1:9: +1:10 - _1 = const 1_i32; // scope 0 at $DIR/checked.rs:+1:13: +1:14 - StorageLive(_2); // scope 1 at $DIR/checked.rs:+2:9: +2:10 - _2 = const 2_i32; // scope 1 at $DIR/checked.rs:+2:13: +2:14 - StorageLive(_3); // scope 2 at $DIR/checked.rs:+3:9: +3:10 - StorageLive(_4); // scope 2 at $DIR/checked.rs:+3:13: +3:14 -- _4 = _1; // scope 2 at $DIR/checked.rs:+3:13: +3:14 -+ _4 = const 1_i32; // scope 2 at $DIR/checked.rs:+3:13: +3:14 - StorageLive(_5); // scope 2 at $DIR/checked.rs:+3:17: +3:18 -- _5 = _2; // scope 2 at $DIR/checked.rs:+3:17: +3:18 -- _6 = CheckedAdd(_4, _5); // scope 2 at $DIR/checked.rs:+3:13: +3:18 -- assert(!move (_6.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, move _5) -> bb1; // scope 2 at $DIR/checked.rs:+3:13: +3:18 -+ _5 = const 2_i32; // scope 2 at $DIR/checked.rs:+3:17: +3:18 -+ _6 = CheckedAdd(const 1_i32, const 2_i32); // scope 2 at $DIR/checked.rs:+3:13: +3:18 -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 1_i32, const 2_i32) -> bb1; // scope 2 at $DIR/checked.rs:+3:13: +3:18 - } - - bb1: { -- _3 = move (_6.0: i32); // scope 2 at $DIR/checked.rs:+3:13: +3:18 -+ _3 = const 3_i32; // scope 2 at $DIR/checked.rs:+3:13: +3:18 - StorageDead(_5); // scope 2 at $DIR/checked.rs:+3:17: +3:18 - StorageDead(_4); // scope 2 at $DIR/checked.rs:+3:17: +3:18 - StorageLive(_7); // scope 3 at $DIR/checked.rs:+5:9: +5:10 - _7 = const _; // scope 3 at $DIR/checked.rs:+5:13: +5:21 - StorageLive(_8); // scope 4 at $DIR/checked.rs:+6:9: +6:10 - StorageLive(_9); // scope 4 at $DIR/checked.rs:+6:13: +6:14 -- _9 = _7; // scope 4 at $DIR/checked.rs:+6:13: +6:14 -- _10 = CheckedAdd(_9, const 1_i32); // scope 4 at $DIR/checked.rs:+6:13: +6:18 -- assert(!move (_10.1: bool), "attempt to compute `{} + {}`, which would overflow", move _9, const 1_i32) -> bb2; // scope 4 at $DIR/checked.rs:+6:13: +6:18 -+ _9 = const i32::MAX; // scope 4 at $DIR/checked.rs:+6:13: +6:14 -+ _10 = CheckedAdd(const i32::MAX, const 1_i32); // scope 4 at $DIR/checked.rs:+6:13: +6:18 -+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const i32::MAX, const 1_i32) -> bb2; // scope 4 at $DIR/checked.rs:+6:13: +6:18 - } - - bb2: { -- _8 = move (_10.0: i32); // scope 4 at $DIR/checked.rs:+6:13: +6:18 -+ _8 = const i32::MIN; // scope 4 at $DIR/checked.rs:+6:13: +6:18 - StorageDead(_9); // scope 4 at $DIR/checked.rs:+6:17: +6:18 - _0 = const (); // scope 0 at $DIR/checked.rs:+0:11: +7:2 - StorageDead(_8); // scope 4 at $DIR/checked.rs:+7:1: +7:2 - StorageDead(_7); // scope 3 at $DIR/checked.rs:+7:1: +7:2 - StorageDead(_3); // scope 2 at $DIR/checked.rs:+7:1: +7:2 - StorageDead(_2); // scope 1 at $DIR/checked.rs:+7:1: +7:2 - StorageDead(_1); // scope 0 at $DIR/checked.rs:+7:1: +7:2 - return; // scope 0 at $DIR/checked.rs:+7:2: +7:2 - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff new file mode 100644 index 000000000..2f1a70f32 --- /dev/null +++ b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff @@ -0,0 +1,80 @@ +- // MIR for `main` before DataflowConstProp ++ // MIR for `main` after DataflowConstProp + + fn main() -> () { + let mut _0: (); + let _1: i32; + let mut _4: i32; + let mut _5: i32; + let mut _6: (i32, bool); + let mut _9: i32; + let mut _10: (i32, bool); + scope 1 { + debug a => _1; + let _2: i32; + scope 2 { + debug b => _2; + let _3: i32; + scope 3 { + debug c => _3; + let _7: i32; + scope 4 { + debug d => _7; + let _8: i32; + scope 5 { + debug e => _8; + } + } + } + } + } + + bb0: { + StorageLive(_1); + _1 = const 1_i32; + StorageLive(_2); + _2 = const 2_i32; + StorageLive(_3); + StorageLive(_4); +- _4 = _1; ++ _4 = const 1_i32; + StorageLive(_5); +- _5 = _2; +- _6 = CheckedAdd(_4, _5); +- assert(!move (_6.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, move _5) -> [success: bb1, unwind unreachable]; ++ _5 = const 2_i32; ++ _6 = CheckedAdd(const 1_i32, const 2_i32); ++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 1_i32, const 2_i32) -> [success: bb1, unwind unreachable]; + } + + bb1: { +- _3 = move (_6.0: i32); ++ _3 = const 3_i32; + StorageDead(_5); + StorageDead(_4); + StorageLive(_7); + _7 = const _; + StorageLive(_8); + StorageLive(_9); +- _9 = _7; +- _10 = CheckedAdd(_9, const 1_i32); +- assert(!move (_10.1: bool), "attempt to compute `{} + {}`, which would overflow", move _9, const 1_i32) -> [success: bb2, unwind unreachable]; ++ _9 = const i32::MAX; ++ _10 = CheckedAdd(const i32::MAX, const 1_i32); ++ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const i32::MAX, const 1_i32) -> [success: bb2, unwind unreachable]; + } + + bb2: { +- _8 = move (_10.0: i32); ++ _8 = const i32::MIN; + StorageDead(_9); + _0 = const (); + StorageDead(_8); + StorageDead(_7); + StorageDead(_3); + StorageDead(_2); + StorageDead(_1); + return; + } + } + diff --git a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff new file mode 100644 index 000000000..0d8a9aca3 --- /dev/null +++ b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff @@ -0,0 +1,80 @@ +- // MIR for `main` before DataflowConstProp ++ // MIR for `main` after DataflowConstProp + + fn main() -> () { + let mut _0: (); + let _1: i32; + let mut _4: i32; + let mut _5: i32; + let mut _6: (i32, bool); + let mut _9: i32; + let mut _10: (i32, bool); + scope 1 { + debug a => _1; + let _2: i32; + scope 2 { + debug b => _2; + let _3: i32; + scope 3 { + debug c => _3; + let _7: i32; + scope 4 { + debug d => _7; + let _8: i32; + scope 5 { + debug e => _8; + } + } + } + } + } + + bb0: { + StorageLive(_1); + _1 = const 1_i32; + StorageLive(_2); + _2 = const 2_i32; + StorageLive(_3); + StorageLive(_4); +- _4 = _1; ++ _4 = const 1_i32; + StorageLive(_5); +- _5 = _2; +- _6 = CheckedAdd(_4, _5); +- assert(!move (_6.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, move _5) -> [success: bb1, unwind continue]; ++ _5 = const 2_i32; ++ _6 = CheckedAdd(const 1_i32, const 2_i32); ++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 1_i32, const 2_i32) -> [success: bb1, unwind continue]; + } + + bb1: { +- _3 = move (_6.0: i32); ++ _3 = const 3_i32; + StorageDead(_5); + StorageDead(_4); + StorageLive(_7); + _7 = const _; + StorageLive(_8); + StorageLive(_9); +- _9 = _7; +- _10 = CheckedAdd(_9, const 1_i32); +- assert(!move (_10.1: bool), "attempt to compute `{} + {}`, which would overflow", move _9, const 1_i32) -> [success: bb2, unwind continue]; ++ _9 = const i32::MAX; ++ _10 = CheckedAdd(const i32::MAX, const 1_i32); ++ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const i32::MAX, const 1_i32) -> [success: bb2, unwind continue]; + } + + bb2: { +- _8 = move (_10.0: i32); ++ _8 = const i32::MIN; + StorageDead(_9); + _0 = const (); + StorageDead(_8); + StorageDead(_7); + StorageDead(_3); + StorageDead(_2); + StorageDead(_1); + return; + } + } + diff --git a/tests/mir-opt/dataflow-const-prop/checked.rs b/tests/mir-opt/dataflow-const-prop/checked.rs index 0f9f5a97f..1c301460f 100644 --- a/tests/mir-opt/dataflow-const-prop/checked.rs +++ b/tests/mir-opt/dataflow-const-prop/checked.rs @@ -1,4 +1,4 @@ -// ignore-wasm32 compiled with panic=abort by default +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: DataflowConstProp // compile-flags: -Coverflow-checks=on diff --git a/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.diff index c4002d65e..775325c4d 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.diff @@ -2,81 +2,81 @@ + // MIR for `multiple` after DataflowConstProp fn multiple(_1: bool, _2: u8) -> () { - debug x => _1; // in scope 0 at $DIR/enum.rs:+0:13: +0:14 - debug i => _2; // in scope 0 at $DIR/enum.rs:+0:22: +0:23 - let mut _0: (); // return place in scope 0 at $DIR/enum.rs:+0:29: +0:29 - let _3: std::option::Option; // in scope 0 at $DIR/enum.rs:+1:9: +1:10 - let mut _4: bool; // in scope 0 at $DIR/enum.rs:+1:16: +1:17 - let mut _5: u8; // in scope 0 at $DIR/enum.rs:+2:14: +2:15 - let mut _7: isize; // in scope 0 at $DIR/enum.rs:+9:23: +9:30 + debug x => _1; + debug i => _2; + let mut _0: (); + let _3: std::option::Option; + let mut _4: bool; + let mut _5: u8; + let mut _7: isize; scope 1 { - debug e => _3; // in scope 1 at $DIR/enum.rs:+1:9: +1:10 - let _6: u8; // in scope 1 at $DIR/enum.rs:+9:9: +9:10 - let _8: u8; // in scope 1 at $DIR/enum.rs:+9:28: +9:29 + debug e => _3; + let _6: u8; + let _8: u8; scope 2 { - debug x => _6; // in scope 2 at $DIR/enum.rs:+9:9: +9:10 - let _9: u8; // in scope 2 at $DIR/enum.rs:+11:9: +11:10 + debug x => _6; + let _9: u8; scope 4 { - debug y => _9; // in scope 4 at $DIR/enum.rs:+11:9: +11:10 + debug y => _9; } } scope 3 { - debug i => _8; // in scope 3 at $DIR/enum.rs:+9:28: +9:29 + debug i => _8; } } bb0: { - StorageLive(_3); // scope 0 at $DIR/enum.rs:+1:9: +1:10 - StorageLive(_4); // scope 0 at $DIR/enum.rs:+1:16: +1:17 - _4 = _1; // scope 0 at $DIR/enum.rs:+1:16: +1:17 - switchInt(move _4) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/enum.rs:+1:16: +1:17 + StorageLive(_3); + StorageLive(_4); + _4 = _1; + switchInt(move _4) -> [0: bb2, otherwise: bb1]; } bb1: { - StorageLive(_5); // scope 0 at $DIR/enum.rs:+2:14: +2:15 - _5 = _2; // scope 0 at $DIR/enum.rs:+2:14: +2:15 - _3 = Option::::Some(move _5); // scope 0 at $DIR/enum.rs:+2:9: +2:16 - StorageDead(_5); // scope 0 at $DIR/enum.rs:+2:15: +2:16 - goto -> bb3; // scope 0 at $DIR/enum.rs:+1:13: +5:6 + StorageLive(_5); + _5 = _2; + _3 = Option::::Some(move _5); + StorageDead(_5); + goto -> bb3; } bb2: { - _3 = Option::::None; // scope 0 at $DIR/enum.rs:+4:9: +4:13 - goto -> bb3; // scope 0 at $DIR/enum.rs:+1:13: +5:6 + _3 = Option::::None; + goto -> bb3; } bb3: { - StorageDead(_4); // scope 0 at $DIR/enum.rs:+5:5: +5:6 - StorageLive(_6); // scope 1 at $DIR/enum.rs:+9:9: +9:10 - _7 = discriminant(_3); // scope 1 at $DIR/enum.rs:+9:19: +9:20 - switchInt(move _7) -> [0: bb4, 1: bb6, otherwise: bb5]; // scope 1 at $DIR/enum.rs:+9:13: +9:20 + StorageDead(_4); + StorageLive(_6); + _7 = discriminant(_3); + switchInt(move _7) -> [0: bb4, 1: bb6, otherwise: bb5]; } bb4: { - _6 = const 0_u8; // scope 1 at $DIR/enum.rs:+9:45: +9:46 - goto -> bb7; // scope 1 at $DIR/enum.rs:+9:45: +9:46 + _6 = const 0_u8; + goto -> bb7; } bb5: { - unreachable; // scope 1 at $DIR/enum.rs:+9:19: +9:20 + unreachable; } bb6: { - StorageLive(_8); // scope 1 at $DIR/enum.rs:+9:28: +9:29 - _8 = ((_3 as Some).0: u8); // scope 1 at $DIR/enum.rs:+9:28: +9:29 - _6 = _8; // scope 3 at $DIR/enum.rs:+9:34: +9:35 - StorageDead(_8); // scope 1 at $DIR/enum.rs:+9:34: +9:35 - goto -> bb7; // scope 1 at $DIR/enum.rs:+9:34: +9:35 + StorageLive(_8); + _8 = ((_3 as Some).0: u8); + _6 = _8; + StorageDead(_8); + goto -> bb7; } bb7: { - StorageLive(_9); // scope 2 at $DIR/enum.rs:+11:9: +11:10 - _9 = _6; // scope 2 at $DIR/enum.rs:+11:13: +11:14 - _0 = const (); // scope 0 at $DIR/enum.rs:+0:29: +12:2 - StorageDead(_9); // scope 2 at $DIR/enum.rs:+12:1: +12:2 - StorageDead(_6); // scope 1 at $DIR/enum.rs:+12:1: +12:2 - StorageDead(_3); // scope 0 at $DIR/enum.rs:+12:1: +12:2 - return; // scope 0 at $DIR/enum.rs:+12:2: +12:2 + StorageLive(_9); + _9 = _6; + _0 = const (); + StorageDead(_9); + StorageDead(_6); + StorageDead(_3); + return; } } diff --git a/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.diff index 038e6c6bd..960e69ee9 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.diff @@ -2,25 +2,25 @@ + // MIR for `mutate_discriminant` after DataflowConstProp fn mutate_discriminant() -> u8 { - let mut _0: u8; // return place in scope 0 at $DIR/enum.rs:+0:29: +0:31 - let mut _1: std::option::Option; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL - let mut _2: isize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _0: u8; + let mut _1: std::option::Option; + let mut _2: isize; bb0: { - discriminant(_1) = 1; // scope 0 at $DIR/enum.rs:+4:13: +4:34 - (((_1 as variant#1).0: NonZeroUsize).0: usize) = const 0_usize; // scope 0 at $DIR/enum.rs:+6:13: +6:64 - _2 = discriminant(_1); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL - switchInt(_2) -> [0: bb1, otherwise: bb2]; // scope 0 at $DIR/enum.rs:+9:13: +12:14 + discriminant(_1) = 1; + (((_1 as variant#1).0: NonZeroUsize).0: usize) = const 0_usize; + _2 = discriminant(_1); + switchInt(_2) -> [0: bb1, otherwise: bb2]; } bb1: { - _0 = const 1_u8; // scope 0 at $DIR/enum.rs:+15:13: +15:20 - return; // scope 0 at $DIR/enum.rs:+16:13: +16:21 + _0 = const 1_u8; + return; } bb2: { - _0 = const 2_u8; // scope 0 at $DIR/enum.rs:+19:13: +19:20 - unreachable; // scope 0 at $DIR/enum.rs:+20:13: +20:26 + _0 = const 2_u8; + unreachable; } } diff --git a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.diff index 22bdc35d6..3946e7c7d 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.diff @@ -2,62 +2,62 @@ + // MIR for `simple` after DataflowConstProp fn simple() -> () { - let mut _0: (); // return place in scope 0 at $DIR/enum.rs:+0:13: +0:13 - let _1: E; // in scope 0 at $DIR/enum.rs:+1:9: +1:10 - let mut _3: isize; // in scope 0 at $DIR/enum.rs:+2:23: +2:31 + let mut _0: (); + let _1: E; + let mut _3: isize; scope 1 { - debug e => _1; // in scope 1 at $DIR/enum.rs:+1:9: +1:10 - let _2: i32; // in scope 1 at $DIR/enum.rs:+2:9: +2:10 - let _4: i32; // in scope 1 at $DIR/enum.rs:+2:29: +2:30 - let _5: i32; // in scope 1 at $DIR/enum.rs:+2:44: +2:45 + debug e => _1; + let _2: i32; + let _4: i32; + let _5: i32; scope 2 { - debug x => _2; // in scope 2 at $DIR/enum.rs:+2:9: +2:10 + debug x => _2; } scope 3 { - debug x => _4; // in scope 3 at $DIR/enum.rs:+2:29: +2:30 + debug x => _4; } scope 4 { - debug x => _5; // in scope 4 at $DIR/enum.rs:+2:44: +2:45 + debug x => _5; } } bb0: { - StorageLive(_1); // scope 0 at $DIR/enum.rs:+1:9: +1:10 - _1 = E::V1(const 0_i32); // scope 0 at $DIR/enum.rs:+1:13: +1:21 - StorageLive(_2); // scope 1 at $DIR/enum.rs:+2:9: +2:10 -- _3 = discriminant(_1); // scope 1 at $DIR/enum.rs:+2:19: +2:20 -- switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 1 at $DIR/enum.rs:+2:13: +2:20 -+ _3 = const 0_isize; // scope 1 at $DIR/enum.rs:+2:19: +2:20 -+ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 1 at $DIR/enum.rs:+2:13: +2:20 + StorageLive(_1); + _1 = E::V1(const 0_i32); + StorageLive(_2); +- _3 = discriminant(_1); +- switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; ++ _3 = const 0_isize; ++ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2]; } bb1: { - StorageLive(_5); // scope 1 at $DIR/enum.rs:+2:44: +2:45 - _5 = ((_1 as V2).0: i32); // scope 1 at $DIR/enum.rs:+2:44: +2:45 - _2 = _5; // scope 4 at $DIR/enum.rs:+2:50: +2:51 - StorageDead(_5); // scope 1 at $DIR/enum.rs:+2:50: +2:51 - goto -> bb4; // scope 1 at $DIR/enum.rs:+2:50: +2:51 + StorageLive(_5); + _5 = ((_1 as V2).0: i32); + _2 = _5; + StorageDead(_5); + goto -> bb4; } bb2: { - unreachable; // scope 1 at $DIR/enum.rs:+2:19: +2:20 + unreachable; } bb3: { - StorageLive(_4); // scope 1 at $DIR/enum.rs:+2:29: +2:30 -- _4 = ((_1 as V1).0: i32); // scope 1 at $DIR/enum.rs:+2:29: +2:30 -- _2 = _4; // scope 3 at $DIR/enum.rs:+2:35: +2:36 -+ _4 = const 0_i32; // scope 1 at $DIR/enum.rs:+2:29: +2:30 -+ _2 = const 0_i32; // scope 3 at $DIR/enum.rs:+2:35: +2:36 - StorageDead(_4); // scope 1 at $DIR/enum.rs:+2:35: +2:36 - goto -> bb4; // scope 1 at $DIR/enum.rs:+2:35: +2:36 + StorageLive(_4); +- _4 = ((_1 as V1).0: i32); +- _2 = _4; ++ _4 = const 0_i32; ++ _2 = const 0_i32; + StorageDead(_4); + goto -> bb4; } bb4: { - _0 = const (); // scope 0 at $DIR/enum.rs:+0:13: +3:2 - StorageDead(_2); // scope 1 at $DIR/enum.rs:+3:1: +3:2 - StorageDead(_1); // scope 0 at $DIR/enum.rs:+3:1: +3:2 - return; // scope 0 at $DIR/enum.rs:+3:2: +3:2 + _0 = const (); + StorageDead(_2); + StorageDead(_1); + return; } } diff --git a/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff index 32489b4bd..08b599f9f 100644 --- a/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff @@ -2,29 +2,29 @@ + // MIR for `main` after DataflowConstProp fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/if.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/if.rs:+1:9: +1:10 - let mut _3: bool; // in scope 0 at $DIR/if.rs:+2:16: +2:22 - let mut _4: i32; // in scope 0 at $DIR/if.rs:+2:16: +2:17 - let mut _6: i32; // in scope 0 at $DIR/if.rs:+3:13: +3:14 - let mut _8: bool; // in scope 0 at $DIR/if.rs:+5:16: +5:22 - let mut _9: i32; // in scope 0 at $DIR/if.rs:+5:16: +5:17 - let mut _10: i32; // in scope 0 at $DIR/if.rs:+5:36: +5:37 - let mut _12: i32; // in scope 0 at $DIR/if.rs:+6:13: +6:14 + let mut _0: (); + let _1: i32; + let mut _3: bool; + let mut _4: i32; + let mut _6: i32; + let mut _8: bool; + let mut _9: i32; + let mut _10: i32; + let mut _12: i32; scope 1 { - debug a => _1; // in scope 1 at $DIR/if.rs:+1:9: +1:10 - let _2: i32; // in scope 1 at $DIR/if.rs:+2:9: +2:10 + debug a => _1; + let _2: i32; scope 2 { - debug b => _2; // in scope 2 at $DIR/if.rs:+2:9: +2:10 - let _5: i32; // in scope 2 at $DIR/if.rs:+3:9: +3:10 + debug b => _2; + let _5: i32; scope 3 { - debug c => _5; // in scope 3 at $DIR/if.rs:+3:9: +3:10 - let _7: i32; // in scope 3 at $DIR/if.rs:+5:9: +5:10 + debug c => _5; + let _7: i32; scope 4 { - debug d => _7; // in scope 4 at $DIR/if.rs:+5:9: +5:10 - let _11: i32; // in scope 4 at $DIR/if.rs:+6:9: +6:10 + debug d => _7; + let _11: i32; scope 5 { - debug e => _11; // in scope 5 at $DIR/if.rs:+6:9: +6:10 + debug e => _11; } } } @@ -32,81 +32,81 @@ } bb0: { - StorageLive(_1); // scope 0 at $DIR/if.rs:+1:9: +1:10 - _1 = const 1_i32; // scope 0 at $DIR/if.rs:+1:13: +1:14 - StorageLive(_2); // scope 1 at $DIR/if.rs:+2:9: +2:10 - StorageLive(_3); // scope 1 at $DIR/if.rs:+2:16: +2:22 - StorageLive(_4); // scope 1 at $DIR/if.rs:+2:16: +2:17 -- _4 = _1; // scope 1 at $DIR/if.rs:+2:16: +2:17 -- _3 = Eq(move _4, const 1_i32); // scope 1 at $DIR/if.rs:+2:16: +2:22 -+ _4 = const 1_i32; // scope 1 at $DIR/if.rs:+2:16: +2:17 -+ _3 = const true; // scope 1 at $DIR/if.rs:+2:16: +2:22 - StorageDead(_4); // scope 1 at $DIR/if.rs:+2:21: +2:22 -- switchInt(move _3) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/if.rs:+2:16: +2:22 -+ switchInt(const true) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/if.rs:+2:16: +2:22 + StorageLive(_1); + _1 = const 1_i32; + StorageLive(_2); + StorageLive(_3); + StorageLive(_4); +- _4 = _1; +- _3 = Eq(move _4, const 1_i32); ++ _4 = const 1_i32; ++ _3 = const true; + StorageDead(_4); +- switchInt(move _3) -> [0: bb2, otherwise: bb1]; ++ switchInt(const true) -> [0: bb2, otherwise: bb1]; } bb1: { - _2 = const 2_i32; // scope 1 at $DIR/if.rs:+2:25: +2:26 - goto -> bb3; // scope 1 at $DIR/if.rs:+2:13: +2:39 + _2 = const 2_i32; + goto -> bb3; } bb2: { - _2 = const 3_i32; // scope 1 at $DIR/if.rs:+2:36: +2:37 - goto -> bb3; // scope 1 at $DIR/if.rs:+2:13: +2:39 + _2 = const 3_i32; + goto -> bb3; } bb3: { - StorageDead(_3); // scope 1 at $DIR/if.rs:+2:38: +2:39 - StorageLive(_5); // scope 2 at $DIR/if.rs:+3:9: +3:10 - StorageLive(_6); // scope 2 at $DIR/if.rs:+3:13: +3:14 -- _6 = _2; // scope 2 at $DIR/if.rs:+3:13: +3:14 -- _5 = Add(move _6, const 1_i32); // scope 2 at $DIR/if.rs:+3:13: +3:18 -+ _6 = const 2_i32; // scope 2 at $DIR/if.rs:+3:13: +3:14 -+ _5 = const 3_i32; // scope 2 at $DIR/if.rs:+3:13: +3:18 - StorageDead(_6); // scope 2 at $DIR/if.rs:+3:17: +3:18 - StorageLive(_7); // scope 3 at $DIR/if.rs:+5:9: +5:10 - StorageLive(_8); // scope 3 at $DIR/if.rs:+5:16: +5:22 - StorageLive(_9); // scope 3 at $DIR/if.rs:+5:16: +5:17 -- _9 = _1; // scope 3 at $DIR/if.rs:+5:16: +5:17 -- _8 = Eq(move _9, const 1_i32); // scope 3 at $DIR/if.rs:+5:16: +5:22 -+ _9 = const 1_i32; // scope 3 at $DIR/if.rs:+5:16: +5:17 -+ _8 = const true; // scope 3 at $DIR/if.rs:+5:16: +5:22 - StorageDead(_9); // scope 3 at $DIR/if.rs:+5:21: +5:22 -- switchInt(move _8) -> [0: bb5, otherwise: bb4]; // scope 3 at $DIR/if.rs:+5:16: +5:22 -+ switchInt(const true) -> [0: bb5, otherwise: bb4]; // scope 3 at $DIR/if.rs:+5:16: +5:22 + StorageDead(_3); + StorageLive(_5); + StorageLive(_6); +- _6 = _2; +- _5 = Add(move _6, const 1_i32); ++ _6 = const 2_i32; ++ _5 = const 3_i32; + StorageDead(_6); + StorageLive(_7); + StorageLive(_8); + StorageLive(_9); +- _9 = _1; +- _8 = Eq(move _9, const 1_i32); ++ _9 = const 1_i32; ++ _8 = const true; + StorageDead(_9); +- switchInt(move _8) -> [0: bb5, otherwise: bb4]; ++ switchInt(const true) -> [0: bb5, otherwise: bb4]; } bb4: { -- _7 = _1; // scope 3 at $DIR/if.rs:+5:25: +5:26 -+ _7 = const 1_i32; // scope 3 at $DIR/if.rs:+5:25: +5:26 - goto -> bb6; // scope 3 at $DIR/if.rs:+5:13: +5:43 +- _7 = _1; ++ _7 = const 1_i32; + goto -> bb6; } bb5: { - StorageLive(_10); // scope 3 at $DIR/if.rs:+5:36: +5:37 - _10 = _1; // scope 3 at $DIR/if.rs:+5:36: +5:37 - _7 = Add(move _10, const 1_i32); // scope 3 at $DIR/if.rs:+5:36: +5:41 - StorageDead(_10); // scope 3 at $DIR/if.rs:+5:40: +5:41 - goto -> bb6; // scope 3 at $DIR/if.rs:+5:13: +5:43 + StorageLive(_10); + _10 = _1; + _7 = Add(move _10, const 1_i32); + StorageDead(_10); + goto -> bb6; } bb6: { - StorageDead(_8); // scope 3 at $DIR/if.rs:+5:42: +5:43 - StorageLive(_11); // scope 4 at $DIR/if.rs:+6:9: +6:10 - StorageLive(_12); // scope 4 at $DIR/if.rs:+6:13: +6:14 -- _12 = _7; // scope 4 at $DIR/if.rs:+6:13: +6:14 -- _11 = Add(move _12, const 1_i32); // scope 4 at $DIR/if.rs:+6:13: +6:18 -+ _12 = const 1_i32; // scope 4 at $DIR/if.rs:+6:13: +6:14 -+ _11 = const 2_i32; // scope 4 at $DIR/if.rs:+6:13: +6:18 - StorageDead(_12); // scope 4 at $DIR/if.rs:+6:17: +6:18 - _0 = const (); // scope 0 at $DIR/if.rs:+0:11: +7:2 - StorageDead(_11); // scope 4 at $DIR/if.rs:+7:1: +7:2 - StorageDead(_7); // scope 3 at $DIR/if.rs:+7:1: +7:2 - StorageDead(_5); // scope 2 at $DIR/if.rs:+7:1: +7:2 - StorageDead(_2); // scope 1 at $DIR/if.rs:+7:1: +7:2 - StorageDead(_1); // scope 0 at $DIR/if.rs:+7:1: +7:2 - return; // scope 0 at $DIR/if.rs:+7:2: +7:2 + StorageDead(_8); + StorageLive(_11); + StorageLive(_12); +- _12 = _7; +- _11 = Add(move _12, const 1_i32); ++ _12 = const 1_i32; ++ _11 = const 2_i32; + StorageDead(_12); + _0 = const (); + StorageDead(_11); + StorageDead(_7); + StorageDead(_5); + StorageDead(_2); + StorageDead(_1); + return; } } diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.diff deleted file mode 100644 index 1edcc28e6..000000000 --- a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.diff +++ /dev/null @@ -1,39 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/inherit_overflow.rs:+0:11: +0:11 - let mut _1: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 - let mut _2: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 - let mut _3: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 - scope 1 { - } - scope 2 (inlined ::add) { // at $DIR/inherit_overflow.rs:9:13: 9:47 - debug self => _2; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL - debug other => _3; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL - let mut _4: (u8, bool); // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 - StorageLive(_2); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 - _2 = const u8::MAX; // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 - StorageLive(_3); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 - _3 = const 1_u8; // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 -- _4 = CheckedAdd(_2, _3); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL -- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> bb1; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL -+ _4 = CheckedAdd(const u8::MAX, const 1_u8); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL -+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> bb1; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL - } - - bb1: { -- _1 = move (_4.0: u8); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL -+ _1 = const 0_u8; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL - StorageDead(_3); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 - StorageDead(_2); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 - StorageDead(_1); // scope 0 at $DIR/inherit_overflow.rs:+3:47: +3:48 - _0 = const (); // scope 0 at $DIR/inherit_overflow.rs:+0:11: +4:2 - return; // scope 0 at $DIR/inherit_overflow.rs:+4:2: +4:2 - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff new file mode 100644 index 000000000..9a68d3b51 --- /dev/null +++ b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff @@ -0,0 +1,39 @@ +- // MIR for `main` before DataflowConstProp ++ // MIR for `main` after DataflowConstProp + + fn main() -> () { + let mut _0: (); + let mut _1: u8; + let mut _2: u8; + let mut _3: u8; + scope 1 { + } + scope 2 (inlined ::add) { + debug self => _2; + debug other => _3; + let mut _4: (u8, bool); + } + + bb0: { + StorageLive(_1); + StorageLive(_2); + _2 = const u8::MAX; + StorageLive(_3); + _3 = const 1_u8; +- _4 = CheckedAdd(_2, _3); +- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind unreachable]; ++ _4 = CheckedAdd(const u8::MAX, const 1_u8); ++ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> [success: bb1, unwind unreachable]; + } + + bb1: { +- _1 = move (_4.0: u8); ++ _1 = const 0_u8; + StorageDead(_3); + StorageDead(_2); + StorageDead(_1); + _0 = const (); + return; + } + } + diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff new file mode 100644 index 000000000..c1d281ab7 --- /dev/null +++ b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff @@ -0,0 +1,39 @@ +- // MIR for `main` before DataflowConstProp ++ // MIR for `main` after DataflowConstProp + + fn main() -> () { + let mut _0: (); + let mut _1: u8; + let mut _2: u8; + let mut _3: u8; + scope 1 { + } + scope 2 (inlined ::add) { + debug self => _2; + debug other => _3; + let mut _4: (u8, bool); + } + + bb0: { + StorageLive(_1); + StorageLive(_2); + _2 = const u8::MAX; + StorageLive(_3); + _3 = const 1_u8; +- _4 = CheckedAdd(_2, _3); +- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind continue]; ++ _4 = CheckedAdd(const u8::MAX, const 1_u8); ++ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> [success: bb1, unwind continue]; + } + + bb1: { +- _1 = move (_4.0: u8); ++ _1 = const 0_u8; + StorageDead(_3); + StorageDead(_2); + StorageDead(_1); + _0 = const (); + return; + } + } + diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs b/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs index 90349d527..964c58966 100644 --- a/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs +++ b/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs @@ -1,4 +1,4 @@ -// ignore-wasm32 compiled with panic=abort by default +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: DataflowConstProp // compile-flags: -Zmir-enable-passes=+Inline diff --git a/tests/mir-opt/dataflow-const-prop/issue_81605.f.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/issue_81605.f.DataflowConstProp.diff index 5a8788497..3f65d3fff 100644 --- a/tests/mir-opt/dataflow-const-prop/issue_81605.f.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/issue_81605.f.DataflowConstProp.diff @@ -2,34 +2,34 @@ + // MIR for `f` after DataflowConstProp fn f() -> usize { - let mut _0: usize; // return place in scope 0 at $DIR/issue_81605.rs:+0:11: +0:16 - let mut _1: usize; // in scope 0 at $DIR/issue_81605.rs:+1:9: +1:33 - let mut _2: bool; // in scope 0 at $DIR/issue_81605.rs:+1:12: +1:16 + let mut _0: usize; + let mut _1: usize; + let mut _2: bool; bb0: { - StorageLive(_1); // scope 0 at $DIR/issue_81605.rs:+1:9: +1:33 - StorageLive(_2); // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16 - _2 = const true; // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16 -- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16 -+ switchInt(const true) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16 + StorageLive(_1); + StorageLive(_2); + _2 = const true; +- switchInt(move _2) -> [0: bb2, otherwise: bb1]; ++ switchInt(const true) -> [0: bb2, otherwise: bb1]; } bb1: { - _1 = const 1_usize; // scope 0 at $DIR/issue_81605.rs:+1:19: +1:20 - goto -> bb3; // scope 0 at $DIR/issue_81605.rs:+1:9: +1:33 + _1 = const 1_usize; + goto -> bb3; } bb2: { - _1 = const 2_usize; // scope 0 at $DIR/issue_81605.rs:+1:30: +1:31 - goto -> bb3; // scope 0 at $DIR/issue_81605.rs:+1:9: +1:33 + _1 = const 2_usize; + goto -> bb3; } bb3: { - StorageDead(_2); // scope 0 at $DIR/issue_81605.rs:+1:32: +1:33 -- _0 = Add(const 1_usize, move _1); // scope 0 at $DIR/issue_81605.rs:+1:5: +1:33 -+ _0 = const 2_usize; // scope 0 at $DIR/issue_81605.rs:+1:5: +1:33 - StorageDead(_1); // scope 0 at $DIR/issue_81605.rs:+1:32: +1:33 - return; // scope 0 at $DIR/issue_81605.rs:+2:2: +2:2 + StorageDead(_2); +- _0 = Add(const 1_usize, move _1); ++ _0 = const 2_usize; + StorageDead(_1); + return; } } diff --git a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.diff deleted file mode 100644 index 70ef17afd..000000000 --- a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.diff +++ /dev/null @@ -1,55 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/ref_without_sb.rs:+0:11: +0:11 - let mut _1: i32; // in scope 0 at $DIR/ref_without_sb.rs:+1:9: +1:14 - let _2: (); // in scope 0 at $DIR/ref_without_sb.rs:+2:5: +2:15 - let mut _3: &i32; // in scope 0 at $DIR/ref_without_sb.rs:+2:12: +2:14 - let _4: &i32; // in scope 0 at $DIR/ref_without_sb.rs:+2:12: +2:14 - let _5: (); // in scope 0 at $DIR/ref_without_sb.rs:+4:5: +4:20 - scope 1 { - debug a => _1; // in scope 1 at $DIR/ref_without_sb.rs:+1:9: +1:14 - let _6: i32; // in scope 1 at $DIR/ref_without_sb.rs:+6:9: +6:10 - scope 2 { - debug b => _6; // in scope 2 at $DIR/ref_without_sb.rs:+6:9: +6:10 - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/ref_without_sb.rs:+1:9: +1:14 - _1 = const 0_i32; // scope 0 at $DIR/ref_without_sb.rs:+1:17: +1:18 - StorageLive(_2); // scope 1 at $DIR/ref_without_sb.rs:+2:5: +2:15 - StorageLive(_3); // scope 1 at $DIR/ref_without_sb.rs:+2:12: +2:14 - StorageLive(_4); // scope 1 at $DIR/ref_without_sb.rs:+2:12: +2:14 - _4 = &_1; // scope 1 at $DIR/ref_without_sb.rs:+2:12: +2:14 - _3 = &(*_4); // scope 1 at $DIR/ref_without_sb.rs:+2:12: +2:14 - _2 = escape::(move _3) -> bb1; // scope 1 at $DIR/ref_without_sb.rs:+2:5: +2:15 - // mir::Constant - // + span: $DIR/ref_without_sb.rs:13:5: 13:11 - // + literal: Const { ty: for<'a> fn(&'a i32) {escape::}, val: Value() } - } - - bb1: { - StorageDead(_3); // scope 1 at $DIR/ref_without_sb.rs:+2:14: +2:15 - StorageDead(_4); // scope 1 at $DIR/ref_without_sb.rs:+2:15: +2:16 - StorageDead(_2); // scope 1 at $DIR/ref_without_sb.rs:+2:15: +2:16 - _1 = const 1_i32; // scope 1 at $DIR/ref_without_sb.rs:+3:5: +3:10 - StorageLive(_5); // scope 1 at $DIR/ref_without_sb.rs:+4:5: +4:20 - _5 = some_function() -> bb2; // scope 1 at $DIR/ref_without_sb.rs:+4:5: +4:20 - // mir::Constant - // + span: $DIR/ref_without_sb.rs:15:5: 15:18 - // + literal: Const { ty: fn() {some_function}, val: Value() } - } - - bb2: { - StorageDead(_5); // scope 1 at $DIR/ref_without_sb.rs:+4:20: +4:21 - StorageLive(_6); // scope 1 at $DIR/ref_without_sb.rs:+6:9: +6:10 - _6 = _1; // scope 1 at $DIR/ref_without_sb.rs:+6:13: +6:14 - _0 = const (); // scope 0 at $DIR/ref_without_sb.rs:+0:11: +7:2 - StorageDead(_6); // scope 1 at $DIR/ref_without_sb.rs:+7:1: +7:2 - StorageDead(_1); // scope 0 at $DIR/ref_without_sb.rs:+7:1: +7:2 - return; // scope 0 at $DIR/ref_without_sb.rs:+7:2: +7:2 - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-abort.diff new file mode 100644 index 000000000..fbbfd61bb --- /dev/null +++ b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-abort.diff @@ -0,0 +1,49 @@ +- // MIR for `main` before DataflowConstProp ++ // MIR for `main` after DataflowConstProp + + fn main() -> () { + let mut _0: (); + let mut _1: i32; + let _2: (); + let mut _3: &i32; + let _4: &i32; + let _5: (); + scope 1 { + debug a => _1; + let _6: i32; + scope 2 { + debug b => _6; + } + } + + bb0: { + StorageLive(_1); + _1 = const 0_i32; + StorageLive(_2); + StorageLive(_3); + StorageLive(_4); + _4 = &_1; + _3 = &(*_4); + _2 = escape::(move _3) -> [return: bb1, unwind unreachable]; + } + + bb1: { + StorageDead(_3); + StorageDead(_4); + StorageDead(_2); + _1 = const 1_i32; + StorageLive(_5); + _5 = some_function() -> [return: bb2, unwind unreachable]; + } + + bb2: { + StorageDead(_5); + StorageLive(_6); + _6 = _1; + _0 = const (); + StorageDead(_6); + StorageDead(_1); + return; + } + } + diff --git a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff new file mode 100644 index 000000000..4e1d26acf --- /dev/null +++ b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff @@ -0,0 +1,49 @@ +- // MIR for `main` before DataflowConstProp ++ // MIR for `main` after DataflowConstProp + + fn main() -> () { + let mut _0: (); + let mut _1: i32; + let _2: (); + let mut _3: &i32; + let _4: &i32; + let _5: (); + scope 1 { + debug a => _1; + let _6: i32; + scope 2 { + debug b => _6; + } + } + + bb0: { + StorageLive(_1); + _1 = const 0_i32; + StorageLive(_2); + StorageLive(_3); + StorageLive(_4); + _4 = &_1; + _3 = &(*_4); + _2 = escape::(move _3) -> [return: bb1, unwind continue]; + } + + bb1: { + StorageDead(_3); + StorageDead(_4); + StorageDead(_2); + _1 = const 1_i32; + StorageLive(_5); + _5 = some_function() -> [return: bb2, unwind continue]; + } + + bb2: { + StorageDead(_5); + StorageLive(_6); + _6 = _1; + _0 = const (); + StorageDead(_6); + StorageDead(_1); + return; + } + } + diff --git a/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs b/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs index f53de3cf2..4ac0a5b32 100644 --- a/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs +++ b/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs @@ -1,4 +1,4 @@ -// ignore-wasm32 compiled with panic=abort by default +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: DataflowConstProp #[inline(never)] diff --git a/tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff index 8f045eedf..4b1a8d932 100644 --- a/tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff @@ -2,41 +2,41 @@ + // MIR for `main` after DataflowConstProp fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/repr_transparent.rs:+0:11: +0:11 - let _1: I32; // in scope 0 at $DIR/repr_transparent.rs:+1:9: +1:10 - let mut _3: i32; // in scope 0 at $DIR/repr_transparent.rs:+2:17: +2:26 - let mut _4: i32; // in scope 0 at $DIR/repr_transparent.rs:+2:17: +2:20 - let mut _5: i32; // in scope 0 at $DIR/repr_transparent.rs:+2:23: +2:26 + let mut _0: (); + let _1: I32; + let mut _3: i32; + let mut _4: i32; + let mut _5: i32; scope 1 { - debug x => _1; // in scope 1 at $DIR/repr_transparent.rs:+1:9: +1:10 - let _2: I32; // in scope 1 at $DIR/repr_transparent.rs:+2:9: +2:10 + debug x => _1; + let _2: I32; scope 2 { - debug y => _2; // in scope 2 at $DIR/repr_transparent.rs:+2:9: +2:10 + debug y => _2; } } bb0: { - StorageLive(_1); // scope 0 at $DIR/repr_transparent.rs:+1:9: +1:10 - _1 = I32(const 0_i32); // scope 0 at $DIR/repr_transparent.rs:+1:13: +1:19 - StorageLive(_2); // scope 1 at $DIR/repr_transparent.rs:+2:9: +2:10 - StorageLive(_3); // scope 1 at $DIR/repr_transparent.rs:+2:17: +2:26 - StorageLive(_4); // scope 1 at $DIR/repr_transparent.rs:+2:17: +2:20 -- _4 = (_1.0: i32); // scope 1 at $DIR/repr_transparent.rs:+2:17: +2:20 -+ _4 = const 0_i32; // scope 1 at $DIR/repr_transparent.rs:+2:17: +2:20 - StorageLive(_5); // scope 1 at $DIR/repr_transparent.rs:+2:23: +2:26 -- _5 = (_1.0: i32); // scope 1 at $DIR/repr_transparent.rs:+2:23: +2:26 -- _3 = Add(move _4, move _5); // scope 1 at $DIR/repr_transparent.rs:+2:17: +2:26 -+ _5 = const 0_i32; // scope 1 at $DIR/repr_transparent.rs:+2:23: +2:26 -+ _3 = const 0_i32; // scope 1 at $DIR/repr_transparent.rs:+2:17: +2:26 - StorageDead(_5); // scope 1 at $DIR/repr_transparent.rs:+2:25: +2:26 - StorageDead(_4); // scope 1 at $DIR/repr_transparent.rs:+2:25: +2:26 -- _2 = I32(move _3); // scope 1 at $DIR/repr_transparent.rs:+2:13: +2:27 -+ _2 = I32(const 0_i32); // scope 1 at $DIR/repr_transparent.rs:+2:13: +2:27 - StorageDead(_3); // scope 1 at $DIR/repr_transparent.rs:+2:26: +2:27 - _0 = const (); // scope 0 at $DIR/repr_transparent.rs:+0:11: +3:2 - StorageDead(_2); // scope 1 at $DIR/repr_transparent.rs:+3:1: +3:2 - StorageDead(_1); // scope 0 at $DIR/repr_transparent.rs:+3:1: +3:2 - return; // scope 0 at $DIR/repr_transparent.rs:+3:2: +3:2 + StorageLive(_1); + _1 = I32(const 0_i32); + StorageLive(_2); + StorageLive(_3); + StorageLive(_4); +- _4 = (_1.0: i32); ++ _4 = const 0_i32; + StorageLive(_5); +- _5 = (_1.0: i32); +- _3 = Add(move _4, move _5); ++ _5 = const 0_i32; ++ _3 = const 0_i32; + StorageDead(_5); + StorageDead(_4); +- _2 = I32(move _3); ++ _2 = I32(const 0_i32); + StorageDead(_3); + _0 = const (); + StorageDead(_2); + StorageDead(_1); + return; } } diff --git a/tests/mir-opt/dataflow-const-prop/self_assign.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/self_assign.main.DataflowConstProp.diff index df08eff94..fbdbb3fa3 100644 --- a/tests/mir-opt/dataflow-const-prop/self_assign.main.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/self_assign.main.DataflowConstProp.diff @@ -2,45 +2,45 @@ + // MIR for `main` after DataflowConstProp fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/self_assign.rs:+0:11: +0:11 - let mut _1: i32; // in scope 0 at $DIR/self_assign.rs:+1:9: +1:14 - let mut _2: i32; // in scope 0 at $DIR/self_assign.rs:+2:9: +2:10 - let mut _3: i32; // in scope 0 at $DIR/self_assign.rs:+3:9: +3:10 - let mut _5: &i32; // in scope 0 at $DIR/self_assign.rs:+6:9: +6:10 - let mut _6: i32; // in scope 0 at $DIR/self_assign.rs:+7:9: +7:11 + let mut _0: (); + let mut _1: i32; + let mut _2: i32; + let mut _3: i32; + let mut _5: &i32; + let mut _6: i32; scope 1 { - debug a => _1; // in scope 1 at $DIR/self_assign.rs:+1:9: +1:14 - let mut _4: &i32; // in scope 1 at $DIR/self_assign.rs:+5:9: +5:14 + debug a => _1; + let mut _4: &i32; scope 2 { - debug b => _4; // in scope 2 at $DIR/self_assign.rs:+5:9: +5:14 + debug b => _4; } } bb0: { - StorageLive(_1); // scope 0 at $DIR/self_assign.rs:+1:9: +1:14 - _1 = const 0_i32; // scope 0 at $DIR/self_assign.rs:+1:17: +1:18 - StorageLive(_2); // scope 1 at $DIR/self_assign.rs:+2:9: +2:10 - _2 = _1; // scope 1 at $DIR/self_assign.rs:+2:9: +2:10 - _1 = Add(move _2, const 1_i32); // scope 1 at $DIR/self_assign.rs:+2:5: +2:14 - StorageDead(_2); // scope 1 at $DIR/self_assign.rs:+2:13: +2:14 - StorageLive(_3); // scope 1 at $DIR/self_assign.rs:+3:9: +3:10 - _3 = _1; // scope 1 at $DIR/self_assign.rs:+3:9: +3:10 - _1 = move _3; // scope 1 at $DIR/self_assign.rs:+3:5: +3:10 - StorageDead(_3); // scope 1 at $DIR/self_assign.rs:+3:9: +3:10 - StorageLive(_4); // scope 1 at $DIR/self_assign.rs:+5:9: +5:14 - _4 = &_1; // scope 1 at $DIR/self_assign.rs:+5:17: +5:19 - StorageLive(_5); // scope 2 at $DIR/self_assign.rs:+6:9: +6:10 - _5 = _4; // scope 2 at $DIR/self_assign.rs:+6:9: +6:10 - _4 = move _5; // scope 2 at $DIR/self_assign.rs:+6:5: +6:10 - StorageDead(_5); // scope 2 at $DIR/self_assign.rs:+6:9: +6:10 - StorageLive(_6); // scope 2 at $DIR/self_assign.rs:+7:9: +7:11 - _6 = (*_4); // scope 2 at $DIR/self_assign.rs:+7:9: +7:11 - _1 = move _6; // scope 2 at $DIR/self_assign.rs:+7:5: +7:11 - StorageDead(_6); // scope 2 at $DIR/self_assign.rs:+7:10: +7:11 - _0 = const (); // scope 0 at $DIR/self_assign.rs:+0:11: +8:2 - StorageDead(_4); // scope 1 at $DIR/self_assign.rs:+8:1: +8:2 - StorageDead(_1); // scope 0 at $DIR/self_assign.rs:+8:1: +8:2 - return; // scope 0 at $DIR/self_assign.rs:+8:2: +8:2 + StorageLive(_1); + _1 = const 0_i32; + StorageLive(_2); + _2 = _1; + _1 = Add(move _2, const 1_i32); + StorageDead(_2); + StorageLive(_3); + _3 = _1; + _1 = move _3; + StorageDead(_3); + StorageLive(_4); + _4 = &_1; + StorageLive(_5); + _5 = _4; + _4 = move _5; + StorageDead(_5); + StorageLive(_6); + _6 = (*_4); + _1 = move _6; + StorageDead(_6); + _0 = const (); + StorageDead(_4); + StorageDead(_1); + return; } } diff --git a/tests/mir-opt/dataflow-const-prop/self_assign_add.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/self_assign_add.main.DataflowConstProp.diff index c09e4061e..e2468a964 100644 --- a/tests/mir-opt/dataflow-const-prop/self_assign_add.main.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/self_assign_add.main.DataflowConstProp.diff @@ -2,22 +2,22 @@ + // MIR for `main` after DataflowConstProp fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/self_assign_add.rs:+0:11: +0:11 - let mut _1: i32; // in scope 0 at $DIR/self_assign_add.rs:+1:9: +1:14 + let mut _0: (); + let mut _1: i32; scope 1 { - debug a => _1; // in scope 1 at $DIR/self_assign_add.rs:+1:9: +1:14 + debug a => _1; } bb0: { - StorageLive(_1); // scope 0 at $DIR/self_assign_add.rs:+1:9: +1:14 - _1 = const 0_i32; // scope 0 at $DIR/self_assign_add.rs:+1:17: +1:18 -- _1 = Add(_1, const 1_i32); // scope 1 at $DIR/self_assign_add.rs:+2:5: +2:11 -- _1 = Add(_1, const 1_i32); // scope 1 at $DIR/self_assign_add.rs:+3:5: +3:11 -+ _1 = const 1_i32; // scope 1 at $DIR/self_assign_add.rs:+2:5: +2:11 -+ _1 = const 2_i32; // scope 1 at $DIR/self_assign_add.rs:+3:5: +3:11 - _0 = const (); // scope 0 at $DIR/self_assign_add.rs:+0:11: +4:2 - StorageDead(_1); // scope 0 at $DIR/self_assign_add.rs:+4:1: +4:2 - return; // scope 0 at $DIR/self_assign_add.rs:+4:2: +4:2 + StorageLive(_1); + _1 = const 0_i32; +- _1 = Add(_1, const 1_i32); +- _1 = Add(_1, const 1_i32); ++ _1 = const 1_i32; ++ _1 = const 2_i32; + _0 = const (); + StorageDead(_1); + return; } } diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.diff deleted file mode 100644 index 6ca569f3d..000000000 --- a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.diff +++ /dev/null @@ -1,54 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/sibling_ptr.rs:+0:11: +0:11 - let mut _1: (u8, u8); // in scope 0 at $DIR/sibling_ptr.rs:+1:9: +1:14 - let _2: (); // in scope 0 at $DIR/sibling_ptr.rs:+2:5: +5:6 - let mut _4: *mut u8; // in scope 0 at $DIR/sibling_ptr.rs:+4:10: +4:18 - let mut _5: *mut u8; // in scope 0 at $DIR/sibling_ptr.rs:+4:10: +4:11 - scope 1 { - debug x => _1; // in scope 1 at $DIR/sibling_ptr.rs:+1:9: +1:14 - let _6: u8; // in scope 1 at $DIR/sibling_ptr.rs:+6:9: +6:11 - scope 2 { - let _3: *mut u8; // in scope 2 at $DIR/sibling_ptr.rs:+3:13: +3:14 - scope 3 { - debug p => _3; // in scope 3 at $DIR/sibling_ptr.rs:+3:13: +3:14 - } - } - scope 4 { - debug x1 => _6; // in scope 4 at $DIR/sibling_ptr.rs:+6:9: +6:11 - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/sibling_ptr.rs:+1:9: +1:14 - _1 = (const 0_u8, const 0_u8); // scope 0 at $DIR/sibling_ptr.rs:+1:27: +1:33 - StorageLive(_2); // scope 1 at $DIR/sibling_ptr.rs:+2:5: +5:6 - StorageLive(_3); // scope 2 at $DIR/sibling_ptr.rs:+3:13: +3:14 - _3 = &raw mut (_1.0: u8); // scope 2 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - StorageLive(_4); // scope 3 at $DIR/sibling_ptr.rs:+4:10: +4:18 - StorageLive(_5); // scope 3 at $DIR/sibling_ptr.rs:+4:10: +4:11 - _5 = _3; // scope 3 at $DIR/sibling_ptr.rs:+4:10: +4:11 - _4 = ptr::mut_ptr::::add(move _5, const 1_usize) -> bb1; // scope 3 at $DIR/sibling_ptr.rs:+4:10: +4:18 - // mir::Constant - // + span: $DIR/sibling_ptr.rs:16:12: 16:15 - // + literal: Const { ty: unsafe fn(*mut u8, usize) -> *mut u8 {ptr::mut_ptr::::add}, val: Value() } - } - - bb1: { - StorageDead(_5); // scope 3 at $DIR/sibling_ptr.rs:+4:17: +4:18 - (*_4) = const 1_u8; // scope 3 at $DIR/sibling_ptr.rs:+4:9: +4:22 - StorageDead(_4); // scope 3 at $DIR/sibling_ptr.rs:+4:22: +4:23 - _2 = const (); // scope 2 at $DIR/sibling_ptr.rs:+2:5: +5:6 - StorageDead(_3); // scope 2 at $DIR/sibling_ptr.rs:+5:5: +5:6 - StorageDead(_2); // scope 1 at $DIR/sibling_ptr.rs:+5:5: +5:6 - StorageLive(_6); // scope 1 at $DIR/sibling_ptr.rs:+6:9: +6:11 - _6 = (_1.1: u8); // scope 1 at $DIR/sibling_ptr.rs:+6:14: +6:17 - _0 = const (); // scope 0 at $DIR/sibling_ptr.rs:+0:11: +7:2 - StorageDead(_6); // scope 1 at $DIR/sibling_ptr.rs:+7:1: +7:2 - StorageDead(_1); // scope 0 at $DIR/sibling_ptr.rs:+7:1: +7:2 - return; // scope 0 at $DIR/sibling_ptr.rs:+7:2: +7:2 - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff new file mode 100644 index 000000000..cc96cbef2 --- /dev/null +++ b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff @@ -0,0 +1,51 @@ +- // MIR for `main` before DataflowConstProp ++ // MIR for `main` after DataflowConstProp + + fn main() -> () { + let mut _0: (); + let mut _1: (u8, u8); + let _2: (); + let mut _4: *mut u8; + let mut _5: *mut u8; + scope 1 { + debug x => _1; + let _6: u8; + scope 2 { + let _3: *mut u8; + scope 3 { + debug p => _3; + } + } + scope 4 { + debug x1 => _6; + } + } + + bb0: { + StorageLive(_1); + _1 = (const 0_u8, const 0_u8); + StorageLive(_2); + StorageLive(_3); + _3 = &raw mut (_1.0: u8); + StorageLive(_4); + StorageLive(_5); + _5 = _3; + _4 = ptr::mut_ptr::::add(move _5, const 1_usize) -> [return: bb1, unwind unreachable]; + } + + bb1: { + StorageDead(_5); + (*_4) = const 1_u8; + StorageDead(_4); + _2 = const (); + StorageDead(_3); + StorageDead(_2); + StorageLive(_6); + _6 = (_1.1: u8); + _0 = const (); + StorageDead(_6); + StorageDead(_1); + return; + } + } + diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff new file mode 100644 index 000000000..ebeb8619d --- /dev/null +++ b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff @@ -0,0 +1,51 @@ +- // MIR for `main` before DataflowConstProp ++ // MIR for `main` after DataflowConstProp + + fn main() -> () { + let mut _0: (); + let mut _1: (u8, u8); + let _2: (); + let mut _4: *mut u8; + let mut _5: *mut u8; + scope 1 { + debug x => _1; + let _6: u8; + scope 2 { + let _3: *mut u8; + scope 3 { + debug p => _3; + } + } + scope 4 { + debug x1 => _6; + } + } + + bb0: { + StorageLive(_1); + _1 = (const 0_u8, const 0_u8); + StorageLive(_2); + StorageLive(_3); + _3 = &raw mut (_1.0: u8); + StorageLive(_4); + StorageLive(_5); + _5 = _3; + _4 = ptr::mut_ptr::::add(move _5, const 1_usize) -> [return: bb1, unwind continue]; + } + + bb1: { + StorageDead(_5); + (*_4) = const 1_u8; + StorageDead(_4); + _2 = const (); + StorageDead(_3); + StorageDead(_2); + StorageLive(_6); + _6 = (_1.1: u8); + _0 = const (); + StorageDead(_6); + StorageDead(_1); + return; + } + } + diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs b/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs index 81fc3c2f4..87842f347 100644 --- a/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs +++ b/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs @@ -1,4 +1,4 @@ -// ignore-wasm32 compiled with panic=abort by default +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY // This attempts to modify `x.1` via a pointer derived from `addr_of_mut!(x.0)`. // According to Miri, that is UB. However, T-opsem has not finalized that // decision and as such we cannot rely on it in optimizations. Consequently, diff --git a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.diff index 53c62c081..914bc8ac4 100644 --- a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.diff @@ -2,50 +2,50 @@ + // MIR for `main` after DataflowConstProp fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/struct.rs:+0:11: +0:11 - let mut _1: S; // in scope 0 at $DIR/struct.rs:+1:9: +1:14 - let mut _3: i32; // in scope 0 at $DIR/struct.rs:+2:13: +2:16 - let mut _5: i32; // in scope 0 at $DIR/struct.rs:+4:13: +4:14 - let mut _6: i32; // in scope 0 at $DIR/struct.rs:+4:17: +4:20 + let mut _0: (); + let mut _1: S; + let mut _3: i32; + let mut _5: i32; + let mut _6: i32; scope 1 { - debug s => _1; // in scope 1 at $DIR/struct.rs:+1:9: +1:14 - let _2: i32; // in scope 1 at $DIR/struct.rs:+2:9: +2:10 + debug s => _1; + let _2: i32; scope 2 { - debug a => _2; // in scope 2 at $DIR/struct.rs:+2:9: +2:10 - let _4: i32; // in scope 2 at $DIR/struct.rs:+4:9: +4:10 + debug a => _2; + let _4: i32; scope 3 { - debug b => _4; // in scope 3 at $DIR/struct.rs:+4:9: +4:10 + debug b => _4; } } } bb0: { - StorageLive(_1); // scope 0 at $DIR/struct.rs:+1:9: +1:14 - _1 = S(const 1_i32); // scope 0 at $DIR/struct.rs:+1:17: +1:21 - StorageLive(_2); // scope 1 at $DIR/struct.rs:+2:9: +2:10 - StorageLive(_3); // scope 1 at $DIR/struct.rs:+2:13: +2:16 -- _3 = (_1.0: i32); // scope 1 at $DIR/struct.rs:+2:13: +2:16 -- _2 = Add(move _3, const 2_i32); // scope 1 at $DIR/struct.rs:+2:13: +2:20 -+ _3 = const 1_i32; // scope 1 at $DIR/struct.rs:+2:13: +2:16 -+ _2 = const 3_i32; // scope 1 at $DIR/struct.rs:+2:13: +2:20 - StorageDead(_3); // scope 1 at $DIR/struct.rs:+2:19: +2:20 - (_1.0: i32) = const 3_i32; // scope 2 at $DIR/struct.rs:+3:5: +3:12 - StorageLive(_4); // scope 2 at $DIR/struct.rs:+4:9: +4:10 - StorageLive(_5); // scope 2 at $DIR/struct.rs:+4:13: +4:14 -- _5 = _2; // scope 2 at $DIR/struct.rs:+4:13: +4:14 -+ _5 = const 3_i32; // scope 2 at $DIR/struct.rs:+4:13: +4:14 - StorageLive(_6); // scope 2 at $DIR/struct.rs:+4:17: +4:20 -- _6 = (_1.0: i32); // scope 2 at $DIR/struct.rs:+4:17: +4:20 -- _4 = Add(move _5, move _6); // scope 2 at $DIR/struct.rs:+4:13: +4:20 -+ _6 = const 3_i32; // scope 2 at $DIR/struct.rs:+4:17: +4:20 -+ _4 = const 6_i32; // scope 2 at $DIR/struct.rs:+4:13: +4:20 - StorageDead(_6); // scope 2 at $DIR/struct.rs:+4:19: +4:20 - StorageDead(_5); // scope 2 at $DIR/struct.rs:+4:19: +4:20 - _0 = const (); // scope 0 at $DIR/struct.rs:+0:11: +5:2 - StorageDead(_4); // scope 2 at $DIR/struct.rs:+5:1: +5:2 - StorageDead(_2); // scope 1 at $DIR/struct.rs:+5:1: +5:2 - StorageDead(_1); // scope 0 at $DIR/struct.rs:+5:1: +5:2 - return; // scope 0 at $DIR/struct.rs:+5:2: +5:2 + StorageLive(_1); + _1 = S(const 1_i32); + StorageLive(_2); + StorageLive(_3); +- _3 = (_1.0: i32); +- _2 = Add(move _3, const 2_i32); ++ _3 = const 1_i32; ++ _2 = const 3_i32; + StorageDead(_3); + (_1.0: i32) = const 3_i32; + StorageLive(_4); + StorageLive(_5); +- _5 = _2; ++ _5 = const 3_i32; + StorageLive(_6); +- _6 = (_1.0: i32); +- _4 = Add(move _5, move _6); ++ _6 = const 3_i32; ++ _4 = const 6_i32; + StorageDead(_6); + StorageDead(_5); + _0 = const (); + StorageDead(_4); + StorageDead(_2); + StorageDead(_1); + return; } } diff --git a/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.diff deleted file mode 100644 index 9854beaeb..000000000 --- a/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.diff +++ /dev/null @@ -1,40 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/terminator.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/terminator.rs:+1:9: +1:10 - let _2: (); // in scope 0 at $DIR/terminator.rs:+3:5: +3:15 - let mut _3: i32; // in scope 0 at $DIR/terminator.rs:+3:9: +3:14 - let mut _4: i32; // in scope 0 at $DIR/terminator.rs:+3:9: +3:10 - scope 1 { - debug a => _1; // in scope 1 at $DIR/terminator.rs:+1:9: +1:10 - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/terminator.rs:+1:9: +1:10 - _1 = const 1_i32; // scope 0 at $DIR/terminator.rs:+1:13: +1:14 - StorageLive(_2); // scope 1 at $DIR/terminator.rs:+3:5: +3:15 - StorageLive(_3); // scope 1 at $DIR/terminator.rs:+3:9: +3:14 - StorageLive(_4); // scope 1 at $DIR/terminator.rs:+3:9: +3:10 -- _4 = _1; // scope 1 at $DIR/terminator.rs:+3:9: +3:10 -- _3 = Add(move _4, const 1_i32); // scope 1 at $DIR/terminator.rs:+3:9: +3:14 -+ _4 = const 1_i32; // scope 1 at $DIR/terminator.rs:+3:9: +3:10 -+ _3 = const 2_i32; // scope 1 at $DIR/terminator.rs:+3:9: +3:14 - StorageDead(_4); // scope 1 at $DIR/terminator.rs:+3:13: +3:14 -- _2 = foo(move _3) -> bb1; // scope 1 at $DIR/terminator.rs:+3:5: +3:15 -+ _2 = foo(const 2_i32) -> bb1; // scope 1 at $DIR/terminator.rs:+3:5: +3:15 - // mir::Constant - // + span: $DIR/terminator.rs:10:5: 10:8 - // + literal: Const { ty: fn(i32) {foo}, val: Value() } - } - - bb1: { - StorageDead(_3); // scope 1 at $DIR/terminator.rs:+3:14: +3:15 - StorageDead(_2); // scope 1 at $DIR/terminator.rs:+3:15: +3:16 - _0 = const (); // scope 0 at $DIR/terminator.rs:+0:11: +4:2 - StorageDead(_1); // scope 0 at $DIR/terminator.rs:+4:1: +4:2 - return; // scope 0 at $DIR/terminator.rs:+4:2: +4:2 - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-abort.diff new file mode 100644 index 000000000..c0f378cc2 --- /dev/null +++ b/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-abort.diff @@ -0,0 +1,37 @@ +- // MIR for `main` before DataflowConstProp ++ // MIR for `main` after DataflowConstProp + + fn main() -> () { + let mut _0: (); + let _1: i32; + let _2: (); + let mut _3: i32; + let mut _4: i32; + scope 1 { + debug a => _1; + } + + bb0: { + StorageLive(_1); + _1 = const 1_i32; + StorageLive(_2); + StorageLive(_3); + StorageLive(_4); +- _4 = _1; +- _3 = Add(move _4, const 1_i32); ++ _4 = const 1_i32; ++ _3 = const 2_i32; + StorageDead(_4); +- _2 = foo(move _3) -> [return: bb1, unwind unreachable]; ++ _2 = foo(const 2_i32) -> [return: bb1, unwind unreachable]; + } + + bb1: { + StorageDead(_3); + StorageDead(_2); + _0 = const (); + StorageDead(_1); + return; + } + } + diff --git a/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-unwind.diff new file mode 100644 index 000000000..395620fec --- /dev/null +++ b/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-unwind.diff @@ -0,0 +1,37 @@ +- // MIR for `main` before DataflowConstProp ++ // MIR for `main` after DataflowConstProp + + fn main() -> () { + let mut _0: (); + let _1: i32; + let _2: (); + let mut _3: i32; + let mut _4: i32; + scope 1 { + debug a => _1; + } + + bb0: { + StorageLive(_1); + _1 = const 1_i32; + StorageLive(_2); + StorageLive(_3); + StorageLive(_4); +- _4 = _1; +- _3 = Add(move _4, const 1_i32); ++ _4 = const 1_i32; ++ _3 = const 2_i32; + StorageDead(_4); +- _2 = foo(move _3) -> [return: bb1, unwind continue]; ++ _2 = foo(const 2_i32) -> [return: bb1, unwind continue]; + } + + bb1: { + StorageDead(_3); + StorageDead(_2); + _0 = const (); + StorageDead(_1); + return; + } + } + diff --git a/tests/mir-opt/dataflow-const-prop/terminator.rs b/tests/mir-opt/dataflow-const-prop/terminator.rs index 4f001df35..114dbeca5 100644 --- a/tests/mir-opt/dataflow-const-prop/terminator.rs +++ b/tests/mir-opt/dataflow-const-prop/terminator.rs @@ -1,4 +1,4 @@ -// ignore-wasm32 compiled with panic=abort by default +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: DataflowConstProp fn foo(n: i32) {} diff --git a/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.diff index 8ce4ce4ba..5e385d21e 100644 --- a/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.diff @@ -2,70 +2,70 @@ + // MIR for `main` after DataflowConstProp fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/tuple.rs:+0:11: +0:11 - let mut _1: (i32, i32); // in scope 0 at $DIR/tuple.rs:+1:9: +1:14 - let mut _3: i32; // in scope 0 at $DIR/tuple.rs:+2:13: +2:22 - let mut _4: i32; // in scope 0 at $DIR/tuple.rs:+2:13: +2:16 - let mut _5: i32; // in scope 0 at $DIR/tuple.rs:+2:19: +2:22 - let mut _7: i32; // in scope 0 at $DIR/tuple.rs:+4:13: +4:22 - let mut _8: i32; // in scope 0 at $DIR/tuple.rs:+4:13: +4:16 - let mut _9: i32; // in scope 0 at $DIR/tuple.rs:+4:19: +4:22 - let mut _10: i32; // in scope 0 at $DIR/tuple.rs:+4:25: +4:26 + let mut _0: (); + let mut _1: (i32, i32); + let mut _3: i32; + let mut _4: i32; + let mut _5: i32; + let mut _7: i32; + let mut _8: i32; + let mut _9: i32; + let mut _10: i32; scope 1 { - debug a => _1; // in scope 1 at $DIR/tuple.rs:+1:9: +1:14 - let _2: i32; // in scope 1 at $DIR/tuple.rs:+2:9: +2:10 + debug a => _1; + let _2: i32; scope 2 { - debug b => _2; // in scope 2 at $DIR/tuple.rs:+2:9: +2:10 - let _6: i32; // in scope 2 at $DIR/tuple.rs:+4:9: +4:10 + debug b => _2; + let _6: i32; scope 3 { - debug c => _6; // in scope 3 at $DIR/tuple.rs:+4:9: +4:10 + debug c => _6; } } } bb0: { - StorageLive(_1); // scope 0 at $DIR/tuple.rs:+1:9: +1:14 - _1 = (const 1_i32, const 2_i32); // scope 0 at $DIR/tuple.rs:+1:17: +1:23 - StorageLive(_2); // scope 1 at $DIR/tuple.rs:+2:9: +2:10 - StorageLive(_3); // scope 1 at $DIR/tuple.rs:+2:13: +2:22 - StorageLive(_4); // scope 1 at $DIR/tuple.rs:+2:13: +2:16 -- _4 = (_1.0: i32); // scope 1 at $DIR/tuple.rs:+2:13: +2:16 -+ _4 = const 1_i32; // scope 1 at $DIR/tuple.rs:+2:13: +2:16 - StorageLive(_5); // scope 1 at $DIR/tuple.rs:+2:19: +2:22 -- _5 = (_1.1: i32); // scope 1 at $DIR/tuple.rs:+2:19: +2:22 -- _3 = Add(move _4, move _5); // scope 1 at $DIR/tuple.rs:+2:13: +2:22 -+ _5 = const 2_i32; // scope 1 at $DIR/tuple.rs:+2:19: +2:22 -+ _3 = const 3_i32; // scope 1 at $DIR/tuple.rs:+2:13: +2:22 - StorageDead(_5); // scope 1 at $DIR/tuple.rs:+2:21: +2:22 - StorageDead(_4); // scope 1 at $DIR/tuple.rs:+2:21: +2:22 -- _2 = Add(move _3, const 3_i32); // scope 1 at $DIR/tuple.rs:+2:13: +2:26 -+ _2 = const 6_i32; // scope 1 at $DIR/tuple.rs:+2:13: +2:26 - StorageDead(_3); // scope 1 at $DIR/tuple.rs:+2:25: +2:26 - _1 = (const 2_i32, const 3_i32); // scope 2 at $DIR/tuple.rs:+3:5: +3:15 - StorageLive(_6); // scope 2 at $DIR/tuple.rs:+4:9: +4:10 - StorageLive(_7); // scope 2 at $DIR/tuple.rs:+4:13: +4:22 - StorageLive(_8); // scope 2 at $DIR/tuple.rs:+4:13: +4:16 -- _8 = (_1.0: i32); // scope 2 at $DIR/tuple.rs:+4:13: +4:16 -+ _8 = const 2_i32; // scope 2 at $DIR/tuple.rs:+4:13: +4:16 - StorageLive(_9); // scope 2 at $DIR/tuple.rs:+4:19: +4:22 -- _9 = (_1.1: i32); // scope 2 at $DIR/tuple.rs:+4:19: +4:22 -- _7 = Add(move _8, move _9); // scope 2 at $DIR/tuple.rs:+4:13: +4:22 -+ _9 = const 3_i32; // scope 2 at $DIR/tuple.rs:+4:19: +4:22 -+ _7 = const 5_i32; // scope 2 at $DIR/tuple.rs:+4:13: +4:22 - StorageDead(_9); // scope 2 at $DIR/tuple.rs:+4:21: +4:22 - StorageDead(_8); // scope 2 at $DIR/tuple.rs:+4:21: +4:22 - StorageLive(_10); // scope 2 at $DIR/tuple.rs:+4:25: +4:26 -- _10 = _2; // scope 2 at $DIR/tuple.rs:+4:25: +4:26 -- _6 = Add(move _7, move _10); // scope 2 at $DIR/tuple.rs:+4:13: +4:26 -+ _10 = const 6_i32; // scope 2 at $DIR/tuple.rs:+4:25: +4:26 -+ _6 = const 11_i32; // scope 2 at $DIR/tuple.rs:+4:13: +4:26 - StorageDead(_10); // scope 2 at $DIR/tuple.rs:+4:25: +4:26 - StorageDead(_7); // scope 2 at $DIR/tuple.rs:+4:25: +4:26 - _0 = const (); // scope 0 at $DIR/tuple.rs:+0:11: +5:2 - StorageDead(_6); // scope 2 at $DIR/tuple.rs:+5:1: +5:2 - StorageDead(_2); // scope 1 at $DIR/tuple.rs:+5:1: +5:2 - StorageDead(_1); // scope 0 at $DIR/tuple.rs:+5:1: +5:2 - return; // scope 0 at $DIR/tuple.rs:+5:2: +5:2 + StorageLive(_1); + _1 = (const 1_i32, const 2_i32); + StorageLive(_2); + StorageLive(_3); + StorageLive(_4); +- _4 = (_1.0: i32); ++ _4 = const 1_i32; + StorageLive(_5); +- _5 = (_1.1: i32); +- _3 = Add(move _4, move _5); ++ _5 = const 2_i32; ++ _3 = const 3_i32; + StorageDead(_5); + StorageDead(_4); +- _2 = Add(move _3, const 3_i32); ++ _2 = const 6_i32; + StorageDead(_3); + _1 = (const 2_i32, const 3_i32); + StorageLive(_6); + StorageLive(_7); + StorageLive(_8); +- _8 = (_1.0: i32); ++ _8 = const 2_i32; + StorageLive(_9); +- _9 = (_1.1: i32); +- _7 = Add(move _8, move _9); ++ _9 = const 3_i32; ++ _7 = const 5_i32; + StorageDead(_9); + StorageDead(_8); + StorageLive(_10); +- _10 = _2; +- _6 = Add(move _7, move _10); ++ _10 = const 6_i32; ++ _6 = const 11_i32; + StorageDead(_10); + StorageDead(_7); + _0 = const (); + StorageDead(_6); + StorageDead(_2); + StorageDead(_1); + return; } } -- cgit v1.2.3