diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:59:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:59:35 +0000 |
commit | d1b2d29528b7794b41e66fc2136e395a02f8529b (patch) | |
tree | a4a17504b260206dec3cf55b2dca82929a348ac2 /tests/mir-opt | |
parent | Releasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip |
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/mir-opt')
153 files changed, 1612 insertions, 1618 deletions
diff --git a/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff b/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff index 9c7b3c519..15269fb8f 100644 --- a/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff +++ b/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff @@ -47,7 +47,8 @@ bb2 (cleanup): { _5 = move _6; - drop(_6) -> [return: bb6, unwind terminate]; +- drop(_6) -> [return: bb6, unwind terminate]; ++ goto -> bb6; } bb3: { @@ -70,7 +71,8 @@ } bb6 (cleanup): { - drop(_5) -> [return: bb7, unwind terminate]; +- drop(_5) -> [return: bb7, unwind terminate]; ++ goto -> bb7; } bb7 (cleanup): { @@ -80,10 +82,6 @@ bb8 (cleanup): { resume; -+ } -+ -+ bb9 (cleanup): { -+ unreachable; } } diff --git a/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir b/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir index 074ebddf7..9be5b8509 100644 --- a/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir +++ b/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir @@ -30,7 +30,7 @@ fn a::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:11:14: 11:16]> } bb2: { - assert(const false, "`async fn` resumed after completion") -> [success: bb2, unwind continue]; + assert(const false, "`async fn` resumed after completion") -> [success: bb2, unwind unreachable]; } bb3: { diff --git a/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir b/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir index f774f32eb..80ac92d59 100644 --- a/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir +++ b/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir @@ -310,7 +310,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, } bb28: { - assert(const false, "`async fn` resumed after completion") -> [success: bb28, unwind continue]; + assert(const false, "`async fn` resumed after completion") -> [success: bb28, unwind unreachable]; } bb29: { diff --git a/tests/mir-opt/building/custom/terminators.rs b/tests/mir-opt/building/custom/terminators.rs index f12405661..123118f65 100644 --- a/tests/mir-opt/building/custom/terminators.rs +++ b/tests/mir-opt/building/custom/terminators.rs @@ -12,7 +12,7 @@ fn ident<T>(t: T) -> T { fn direct_call(x: i32) -> i32 { mir!( { - Call(RET, retblock, ident(x)) + Call(RET = ident(x), retblock) } retblock = { @@ -26,7 +26,7 @@ fn direct_call(x: i32) -> i32 { fn indirect_call(x: i32, f: fn(i32) -> i32) -> i32 { mir!( { - Call(RET, retblock, f(x)) + Call(RET = f(x), retblock) } retblock = { diff --git a/tests/mir-opt/casts.redundant.InstSimplify.diff b/tests/mir-opt/casts.redundant.InstSimplify.diff index ff6d11c45..f5ea78aec 100644 --- a/tests/mir-opt/casts.redundant.InstSimplify.diff +++ b/tests/mir-opt/casts.redundant.InstSimplify.diff @@ -7,7 +7,7 @@ let mut _2: *const &u8; let mut _3: *const &u8; scope 1 (inlined generic_cast::<&u8, &u8>) { - debug x => _3; + debug x => _1; } bb0: { diff --git a/tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir b/tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir index 3797dbabb..8c8e69595 100644 --- a/tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir +++ b/tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir @@ -23,17 +23,17 @@ alloc1 (static: FOO, size: 8, align: 4) { alloc19 (size: 48, align: 4) { 0x00 │ 00 00 00 00 __ __ __ __ ╾─alloc6──╼ 00 00 00 00 │ ....░░░░╾──╼.... - 0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc9──╼ 02 00 00 00 │ ....░░░░╾──╼.... - 0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc14─╼ 03 00 00 00 │ ....*...╾──╼.... + 0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc10─╼ 02 00 00 00 │ ....░░░░╾──╼.... + 0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc15─╼ 03 00 00 00 │ ....*...╾──╼.... } alloc6 (size: 0, align: 4) {} -alloc9 (size: 16, align: 4) { - ╾─alloc10─╼ 03 00 00 00 ╾─alloc11─╼ 03 00 00 00 │ ╾──╼....╾──╼.... +alloc10 (size: 16, align: 4) { + ╾─alloc9──╼ 03 00 00 00 ╾─alloc11─╼ 03 00 00 00 │ ╾──╼....╾──╼.... } -alloc10 (size: 3, align: 1) { +alloc9 (size: 3, align: 1) { 66 6f 6f │ foo } @@ -41,12 +41,12 @@ alloc11 (size: 3, align: 1) { 62 61 72 │ bar } -alloc14 (size: 24, align: 4) { - 0x00 │ ╾─alloc15─╼ 03 00 00 00 ╾─alloc16─╼ 03 00 00 00 │ ╾──╼....╾──╼.... +alloc15 (size: 24, align: 4) { + 0x00 │ ╾─alloc14─╼ 03 00 00 00 ╾─alloc16─╼ 03 00 00 00 │ ╾──╼....╾──╼.... 0x10 │ ╾─alloc17─╼ 04 00 00 00 │ ╾──╼.... } -alloc15 (size: 3, align: 1) { +alloc14 (size: 3, align: 1) { 6d 65 68 │ meh } diff --git a/tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir b/tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir index dc16c0640..e22547032 100644 --- a/tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir +++ b/tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir @@ -24,19 +24,19 @@ alloc1 (static: FOO, size: 16, align: 8) { alloc19 (size: 72, align: 8) { 0x00 │ 00 00 00 00 __ __ __ __ ╾───────alloc6────────╼ │ ....░░░░╾──────╼ 0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ │ ............░░░░ - 0x20 │ ╾───────alloc9────────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........ - 0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc14───────╼ │ ....*...╾──────╼ + 0x20 │ ╾───────alloc10───────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........ + 0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc15───────╼ │ ....*...╾──────╼ 0x40 │ 03 00 00 00 00 00 00 00 │ ........ } alloc6 (size: 0, align: 8) {} -alloc9 (size: 32, align: 8) { - 0x00 │ ╾───────alloc10───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........ +alloc10 (size: 32, align: 8) { + 0x00 │ ╾───────alloc9────────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........ 0x10 │ ╾───────alloc11───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........ } -alloc10 (size: 3, align: 1) { +alloc9 (size: 3, align: 1) { 66 6f 6f │ foo } @@ -44,13 +44,13 @@ alloc11 (size: 3, align: 1) { 62 61 72 │ bar } -alloc14 (size: 48, align: 8) { - 0x00 │ ╾───────alloc15───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........ +alloc15 (size: 48, align: 8) { + 0x00 │ ╾───────alloc14───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........ 0x10 │ ╾───────alloc16───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........ 0x20 │ ╾───────alloc17───────╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........ } -alloc15 (size: 3, align: 1) { +alloc14 (size: 3, align: 1) { 6d 65 68 │ meh } diff --git a/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-abort.diff index 0fad23104..a4911a6d4 100644 --- a/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-abort.diff +++ b/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-abort.diff @@ -26,8 +26,9 @@ StorageLive(_4); StorageLive(_5); - _5 = _1; +- _4 = foo(move _5) -> [return: bb1, unwind unreachable]; + _5 = const 1_u8; - _4 = foo(move _5) -> [return: bb1, unwind unreachable]; ++ _4 = foo(const 1_u8) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-unwind.diff index e4650046b..b8b9fa5cc 100644 --- a/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-unwind.diff @@ -26,8 +26,9 @@ StorageLive(_4); StorageLive(_5); - _5 = _1; +- _4 = foo(move _5) -> [return: bb1, unwind continue]; + _5 = const 1_u8; - _4 = foo(move _5) -> [return: bb1, unwind continue]; ++ _4 = foo(const 1_u8) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.panic-abort.mir b/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.panic-abort.mir index 2ab6c1bf3..44a85a563 100644 --- a/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.panic-abort.mir @@ -23,7 +23,7 @@ fn main() -> () { StorageLive(_4); StorageLive(_5); _5 = const 1_u8; - _4 = foo(move _5) -> [return: bb1, unwind unreachable]; + _4 = foo(const 1_u8) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.panic-unwind.mir index 9590c7f90..2c7bdbb50 100644 --- a/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.panic-unwind.mir @@ -23,7 +23,7 @@ fn main() -> () { StorageLive(_4); StorageLive(_5); _5 = const 1_u8; - _4 = foo(move _5) -> [return: bb1, unwind continue]; + _4 = foo(const 1_u8) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-abort.diff index 012b11e0e..b2f58f8f7 100644 --- a/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-abort.diff @@ -23,7 +23,7 @@ - assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; + _4 = const 4_usize; + _5 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-unwind.diff index ec11395c3..f9e3f8f17 100644 --- a/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-unwind.diff @@ -23,7 +23,7 @@ - assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; + _4 = const 4_usize; + _5 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-abort.diff index 012b11e0e..b2f58f8f7 100644 --- a/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-abort.diff @@ -23,7 +23,7 @@ - assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; + _4 = const 4_usize; + _5 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-unwind.diff index ec11395c3..f9e3f8f17 100644 --- a/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-unwind.diff @@ -23,7 +23,7 @@ - assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; + _4 = const 4_usize; + _5 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-abort.diff index 34163d4d8..cead70110 100644 --- a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-abort.diff +++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-abort.diff @@ -38,11 +38,12 @@ + _5 = const false; + _6 = const false; + _7 = const false; -+ assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind unreachable]; ++ assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, const 0_i32) -> [success: bb2, unwind unreachable]; } bb2: { - _2 = Div(const 1_i32, move _3); +- _2 = Div(const 1_i32, move _3); ++ _2 = Div(const 1_i32, const 0_i32); StorageDead(_3); _0 = const (); StorageDead(_2); diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-unwind.diff index a5b51681e..c9c4ba854 100644 --- a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-unwind.diff @@ -38,11 +38,12 @@ + _5 = const false; + _6 = const false; + _7 = const false; -+ assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind continue]; ++ assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, const 0_i32) -> [success: bb2, unwind continue]; } bb2: { - _2 = Div(const 1_i32, move _3); +- _2 = Div(const 1_i32, move _3); ++ _2 = Div(const 1_i32, const 0_i32); StorageDead(_3); _0 = const (); StorageDead(_2); diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-abort.diff index eb1c7d34f..2666fd9eb 100644 --- a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-abort.diff +++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-abort.diff @@ -38,11 +38,12 @@ + _5 = const false; + _6 = const false; + _7 = const false; -+ assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind unreachable]; ++ assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, const 0_i32) -> [success: bb2, unwind unreachable]; } bb2: { - _2 = Rem(const 1_i32, move _3); +- _2 = Rem(const 1_i32, move _3); ++ _2 = Rem(const 1_i32, const 0_i32); StorageDead(_3); _0 = const (); StorageDead(_2); diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-unwind.diff index 4afddf3c9..679df90f1 100644 --- a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-unwind.diff @@ -38,11 +38,12 @@ + _5 = const false; + _6 = const false; + _7 = const false; -+ assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind continue]; ++ assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, const 0_i32) -> [success: bb2, unwind continue]; } bb2: { - _2 = Rem(const 1_i32, move _3); +- _2 = Rem(const 1_i32, move _3); ++ _2 = Rem(const 1_i32, const 0_i32); StorageDead(_3); _0 = const (); StorageDead(_2); diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff index 30402df47..55c774d55 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff @@ -38,7 +38,7 @@ - _8 = Lt(_6, _7); - assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; + _8 = const false; -+ assert(const false, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; ++ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> [success: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff index 16d62daed..dcab570ea 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff @@ -38,7 +38,7 @@ - _8 = Lt(_6, _7); - assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; + _8 = const false; -+ assert(const false, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; ++ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff index 30402df47..55c774d55 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff @@ -38,7 +38,7 @@ - _8 = Lt(_6, _7); - assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; + _8 = const false; -+ assert(const false, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; ++ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> [success: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff index 16d62daed..dcab570ea 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff @@ -38,7 +38,7 @@ - _8 = Lt(_6, _7); - assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; + _8 = const false; -+ assert(const false, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; ++ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-abort.diff index 24b479694..c9670a5ee 100644 --- a/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-abort.diff +++ b/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-abort.diff @@ -24,9 +24,10 @@ StorageLive(_3); - _4 = SizeOf(i32); - _5 = AlignOf(i32); +- _6 = alloc::alloc::exchange_malloc(move _4, move _5) -> [return: bb1, unwind unreachable]; + _4 = const 4_usize; + _5 = const 4_usize; - _6 = alloc::alloc::exchange_malloc(move _4, move _5) -> [return: bb1, unwind unreachable]; ++ _6 = alloc::alloc::exchange_malloc(const 4_usize, const 4_usize) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-unwind.diff index 6214766c7..64fe72be5 100644 --- a/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-unwind.diff @@ -24,9 +24,10 @@ StorageLive(_3); - _4 = SizeOf(i32); - _5 = AlignOf(i32); +- _6 = alloc::alloc::exchange_malloc(move _4, move _5) -> [return: bb1, unwind continue]; + _4 = const 4_usize; + _5 = const 4_usize; - _6 = alloc::alloc::exchange_malloc(move _4, move _5) -> [return: bb1, unwind continue]; ++ _6 = alloc::alloc::exchange_malloc(const 4_usize, const 4_usize) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-abort.diff index e77c09848..ba2e89f0a 100644 --- a/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-abort.diff +++ b/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-abort.diff @@ -8,8 +8,9 @@ bb0: { StorageLive(_1); - _1 = const _; +- _1 = const _; - switchInt(move _1) -> [0: bb2, otherwise: bb1]; ++ _1 = const false; + switchInt(const false) -> [0: bb2, otherwise: bb1]; } diff --git a/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-unwind.diff index 7496d2543..e0a610f60 100644 --- a/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-unwind.diff @@ -8,8 +8,9 @@ bb0: { StorageLive(_1); - _1 = const _; +- _1 = const _; - switchInt(move _1) -> [0: bb2, otherwise: bb1]; ++ _1 = const false; + switchInt(const false) -> [0: bb2, otherwise: bb1]; } diff --git a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff index eef9282c2..ca0ce2888 100644 --- a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff +++ b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff @@ -18,7 +18,7 @@ - assert(!move (_3.1: bool), "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> [success: bb1, unwind unreachable]; + _2 = const 2_u8; + _3 = const (3_u8, false); -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> [success: bb1, unwind unreachable]; ++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u8, const 1_u8) -> [success: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff index ccfa35f00..d63fb9255 100644 --- a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff @@ -18,7 +18,7 @@ - assert(!move (_3.1: bool), "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> [success: bb1, unwind continue]; + _2 = const 2_u8; + _3 = const (3_u8, false); -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> [success: bb1, unwind continue]; ++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u8, const 1_u8) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff index e0467e3fc..51e17cf69 100644 --- a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff +++ b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff @@ -23,7 +23,7 @@ - _4 = CheckedAdd(_2, _3); - assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind unreachable]; + _4 = const (0_u8, true); -+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind unreachable]; ++ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> [success: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff index 4f8e0f0f5..5ef201497 100644 --- a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff @@ -23,7 +23,7 @@ - _4 = CheckedAdd(_2, _3); - assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind continue]; + _4 = const (0_u8, true); -+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind continue]; ++ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff b/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff index 0c9d1f4a3..10e978a68 100644 --- a/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff @@ -43,8 +43,9 @@ StorageLive(_5); _5 = InvalidTag { int: const 4_u32 }; - _4 = (_5.1: E); +- _3 = [move _4]; + _4 = const Scalar(0x00000004): E; - _3 = [move _4]; ++ _3 = [const Scalar(0x00000004): E]; StorageDead(_4); StorageDead(_5); nop; diff --git a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff index 516f13586..170c01978 100644 --- a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff +++ b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff @@ -8,8 +8,10 @@ bb0: { StorageLive(_2); - _2 = (const (), const 0_u8, const 0_u8); - _1 = encode(move _2) -> [return: bb1, unwind unreachable]; +- _2 = (const (), const 0_u8, const 0_u8); +- _1 = encode(move _2) -> [return: bb1, unwind unreachable]; ++ _2 = const ((), 0_u8, 0_u8); ++ _1 = encode(const ((), 0_u8, 0_u8)) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff index 5e3443228..64227dfd7 100644 --- a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff @@ -8,8 +8,10 @@ bb0: { StorageLive(_2); - _2 = (const (), const 0_u8, const 0_u8); - _1 = encode(move _2) -> [return: bb1, unwind continue]; +- _2 = (const (), const 0_u8, const 0_u8); +- _1 = encode(move _2) -> [return: bb1, unwind continue]; ++ _2 = const ((), 0_u8, 0_u8); ++ _1 = encode(const ((), 0_u8, 0_u8)) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff index 96b409372..e1f3f37b3 100644 --- a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff +++ b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff @@ -11,10 +11,12 @@ StorageLive(_2); StorageLive(_3); - _3 = (const 1_u8, const 2_u8); +- _2 = (move _3,); + _3 = const (1_u8, 2_u8); - _2 = (move _3,); ++ _2 = const ((1_u8, 2_u8),); StorageDead(_3); - _1 = test(move _2) -> [return: bb1, unwind unreachable]; +- _1 = test(move _2) -> [return: bb1, unwind unreachable]; ++ _1 = test(const ((1_u8, 2_u8),)) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff index 957760301..aaa376a95 100644 --- a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff @@ -11,10 +11,12 @@ StorageLive(_2); StorageLive(_3); - _3 = (const 1_u8, const 2_u8); +- _2 = (move _3,); + _3 = const (1_u8, 2_u8); - _2 = (move _3,); ++ _2 = const ((1_u8, 2_u8),); StorageDead(_3); - _1 = test(move _2) -> [return: bb1, unwind continue]; +- _1 = test(move _2) -> [return: bb1, unwind continue]; ++ _1 = test(const ((1_u8, 2_u8),)) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-abort.diff index 61ba52fb0..20e2ee326 100644 --- a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-abort.diff @@ -23,7 +23,7 @@ - assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; + _4 = const 5000_usize; + _5 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-unwind.diff index 658607116..1bdbbbf78 100644 --- a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-unwind.diff @@ -23,7 +23,7 @@ - assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; + _4 = const 5000_usize; + _5 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-abort.diff index 61ba52fb0..20e2ee326 100644 --- a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-abort.diff @@ -23,7 +23,7 @@ - assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; + _4 = const 5000_usize; + _5 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-unwind.diff index 658607116..1bdbbbf78 100644 --- a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-unwind.diff @@ -23,7 +23,7 @@ - assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; + _4 = const 5000_usize; + _5 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-abort.diff index 046a79b4b..c73d217ae 100644 --- a/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-abort.diff +++ b/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-abort.diff @@ -28,8 +28,9 @@ StorageLive(_1); StorageLive(_2); - _2 = OffsetOf(Alpha, [0]); +- _1 = must_use::<usize>(move _2) -> [return: bb1, unwind unreachable]; + _2 = const 4_usize; - _1 = must_use::<usize>(move _2) -> [return: bb1, unwind unreachable]; ++ _1 = must_use::<usize>(const 4_usize) -> [return: bb1, unwind unreachable]; } bb1: { @@ -37,8 +38,9 @@ StorageLive(_3); StorageLive(_4); - _4 = OffsetOf(Alpha, [1]); +- _3 = must_use::<usize>(move _4) -> [return: bb2, unwind unreachable]; + _4 = const 0_usize; - _3 = must_use::<usize>(move _4) -> [return: bb2, unwind unreachable]; ++ _3 = must_use::<usize>(const 0_usize) -> [return: bb2, unwind unreachable]; } bb2: { @@ -46,8 +48,9 @@ StorageLive(_5); StorageLive(_6); - _6 = OffsetOf(Alpha, [2, 0]); +- _5 = must_use::<usize>(move _6) -> [return: bb3, unwind unreachable]; + _6 = const 2_usize; - _5 = must_use::<usize>(move _6) -> [return: bb3, unwind unreachable]; ++ _5 = must_use::<usize>(const 2_usize) -> [return: bb3, unwind unreachable]; } bb3: { @@ -55,8 +58,9 @@ StorageLive(_7); StorageLive(_8); - _8 = OffsetOf(Alpha, [2, 1]); +- _7 = must_use::<usize>(move _8) -> [return: bb4, unwind unreachable]; + _8 = const 3_usize; - _7 = must_use::<usize>(move _8) -> [return: bb4, unwind unreachable]; ++ _7 = must_use::<usize>(const 3_usize) -> [return: bb4, unwind unreachable]; } bb4: { diff --git a/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-unwind.diff index bbb807d8f..913ffca4a 100644 --- a/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-unwind.diff @@ -28,8 +28,9 @@ StorageLive(_1); StorageLive(_2); - _2 = OffsetOf(Alpha, [0]); +- _1 = must_use::<usize>(move _2) -> [return: bb1, unwind continue]; + _2 = const 4_usize; - _1 = must_use::<usize>(move _2) -> [return: bb1, unwind continue]; ++ _1 = must_use::<usize>(const 4_usize) -> [return: bb1, unwind continue]; } bb1: { @@ -37,8 +38,9 @@ StorageLive(_3); StorageLive(_4); - _4 = OffsetOf(Alpha, [1]); +- _3 = must_use::<usize>(move _4) -> [return: bb2, unwind continue]; + _4 = const 0_usize; - _3 = must_use::<usize>(move _4) -> [return: bb2, unwind continue]; ++ _3 = must_use::<usize>(const 0_usize) -> [return: bb2, unwind continue]; } bb2: { @@ -46,8 +48,9 @@ StorageLive(_5); StorageLive(_6); - _6 = OffsetOf(Alpha, [2, 0]); +- _5 = must_use::<usize>(move _6) -> [return: bb3, unwind continue]; + _6 = const 2_usize; - _5 = must_use::<usize>(move _6) -> [return: bb3, unwind continue]; ++ _5 = must_use::<usize>(const 2_usize) -> [return: bb3, unwind continue]; } bb3: { @@ -55,8 +58,9 @@ StorageLive(_7); StorageLive(_8); - _8 = OffsetOf(Alpha, [2, 1]); +- _7 = must_use::<usize>(move _8) -> [return: bb4, unwind continue]; + _8 = const 3_usize; - _7 = must_use::<usize>(move _8) -> [return: bb4, unwind continue]; ++ _7 = must_use::<usize>(const 3_usize) -> [return: bb4, unwind continue]; } bb4: { diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-abort.diff index e095dd01d..a55bd029e 100644 --- a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-abort.diff @@ -25,7 +25,7 @@ - assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable]; + _5 = const 8_usize; + _6 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable]; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-unwind.diff index 571f279a8..d49ef2e01 100644 --- a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-unwind.diff @@ -25,7 +25,7 @@ - assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind continue]; + _5 = const 8_usize; + _6 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind continue]; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-abort.diff index e095dd01d..a55bd029e 100644 --- a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-abort.diff @@ -25,7 +25,7 @@ - assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable]; + _5 = const 8_usize; + _6 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable]; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-unwind.diff index 571f279a8..d49ef2e01 100644 --- a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-unwind.diff @@ -25,7 +25,7 @@ - assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind continue]; + _5 = const 8_usize; + _6 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind continue]; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-abort.diff index 0677295d0..c5c09c8ed 100644 --- a/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-abort.diff +++ b/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-abort.diff @@ -16,8 +16,9 @@ StorageLive(_2); StorageLive(_3); - _3 = _1; +- _2 = consume(move _3) -> [return: bb1, unwind unreachable]; + _3 = const 1_u32; - _2 = consume(move _3) -> [return: bb1, unwind unreachable]; ++ _2 = consume(const 1_u32) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-unwind.diff index a7d7a7224..b256c5676 100644 --- a/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-unwind.diff @@ -16,8 +16,9 @@ StorageLive(_2); StorageLive(_3); - _3 = _1; +- _2 = consume(move _3) -> [return: bb1, unwind continue]; + _3 = const 1_u32; - _2 = consume(move _3) -> [return: bb1, unwind continue]; ++ _2 = consume(const 1_u32) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-abort.diff index 3c2b8e111..c2e1288b4 100644 --- a/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-abort.diff @@ -30,7 +30,7 @@ - assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; + _7 = const 3_usize; + _8 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-unwind.diff index 303096030..23646c3c9 100644 --- a/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-unwind.diff @@ -30,7 +30,7 @@ - assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; + _7 = const 3_usize; + _8 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-abort.diff index 3c2b8e111..c2e1288b4 100644 --- a/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-abort.diff @@ -30,7 +30,7 @@ - assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; + _7 = const 3_usize; + _8 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-unwind.diff index 303096030..23646c3c9 100644 --- a/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-unwind.diff @@ -30,7 +30,7 @@ - assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; + _7 = const 3_usize; + _8 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff index a72f24152..9e705695a 100644 --- a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff +++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff @@ -17,8 +17,9 @@ StorageLive(_2); StorageLive(_3); - _3 = _1; +- _2 = consume(move _3) -> [return: bb1, unwind unreachable]; + _3 = const (1_u32, 2_u32); - _2 = consume(move _3) -> [return: bb1, unwind unreachable]; ++ _2 = consume(const (1_u32, 2_u32)) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff index 6255f9ec5..882dd97cc 100644 --- a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff @@ -17,8 +17,9 @@ StorageLive(_2); StorageLive(_3); - _3 = _1; +- _2 = consume(move _3) -> [return: bb1, unwind continue]; + _3 = const (1_u32, 2_u32); - _2 = consume(move _3) -> [return: bb1, unwind continue]; ++ _2 = consume(const (1_u32, 2_u32)) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/copy-prop/borrowed_local.rs b/tests/mir-opt/copy-prop/borrowed_local.rs index a89b64441..bf94dc57d 100644 --- a/tests/mir-opt/copy-prop/borrowed_local.rs +++ b/tests/mir-opt/copy-prop/borrowed_local.rs @@ -21,11 +21,11 @@ fn f() -> bool { let b = a; // We cannot propagate the place `a`. let r2 = &b; - Call(RET, next, cmp_ref(r1, r2)) + Call(RET = cmp_ref(r1, r2), next) } next = { // But we can propagate the value `a`. - Call(RET, ret, opaque(b)) + Call(RET = opaque(b), ret) } ret = { Return() diff --git a/tests/mir-opt/copy-prop/custom_move_arg.rs b/tests/mir-opt/copy-prop/custom_move_arg.rs index a90db08fa..d1c5ffdff 100644 --- a/tests/mir-opt/copy-prop/custom_move_arg.rs +++ b/tests/mir-opt/copy-prop/custom_move_arg.rs @@ -13,11 +13,11 @@ struct NotCopy(bool); fn f(_1: NotCopy) { mir!({ let _2 = _1; - Call(RET, bb1, opaque(Move(_1))) + Call(RET = opaque(Move(_1)), bb1) } bb1 = { let _3 = Move(_2); - Call(RET, bb2, opaque(_3)) + Call(RET = opaque(_3), bb2) } bb2 = { Return() diff --git a/tests/mir-opt/copy-prop/move_projection.rs b/tests/mir-opt/copy-prop/move_projection.rs index 40f51ce84..f94addb56 100644 --- a/tests/mir-opt/copy-prop/move_projection.rs +++ b/tests/mir-opt/copy-prop/move_projection.rs @@ -17,10 +17,10 @@ fn f(a: Foo) -> bool { let b = a; // This is a move out of a copy, so must become a copy of `a.0`. let c = Move(b.0); - Call(RET, bb1, opaque(Move(a))) + Call(RET = opaque(Move(a)), bb1) } bb1 = { - Call(RET, ret, opaque(Move(c))) + Call(RET = opaque(Move(c)), ret) } ret = { Return() diff --git a/tests/mir-opt/copy-prop/mutate_through_pointer.rs b/tests/mir-opt/copy-prop/mutate_through_pointer.rs index da142e339..753787089 100644 --- a/tests/mir-opt/copy-prop/mutate_through_pointer.rs +++ b/tests/mir-opt/copy-prop/mutate_through_pointer.rs @@ -1,3 +1,5 @@ +// unit-test: CopyProp +// // This attempts to mutate `a` via a pointer derived from `addr_of!(a)`. That is UB // according to Miri. However, the decision to make this UB - and to allow // rustc to rely on that fact for the purpose of optimizations - has not been diff --git a/tests/mir-opt/coverage_graphviz.bar.InstrumentCoverage.0.dot b/tests/mir-opt/coverage_graphviz.bar.InstrumentCoverage.0.dot index 03df5c950..3b90aaeae 100644 --- a/tests/mir-opt/coverage_graphviz.bar.InstrumentCoverage.0.dot +++ b/tests/mir-opt/coverage_graphviz.bar.InstrumentCoverage.0.dot @@ -2,5 +2,5 @@ digraph Cov_0_4 { graph [fontname="Courier, monospace"]; node [fontname="Courier, monospace"]; edge [fontname="Courier, monospace"]; - bcb0__Cov_0_4 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb0</td></tr><tr><td align="left" balign="left"></td></tr><tr><td align="left" balign="left">Counter(bcb0) at 18:1-20:2<br align="left"/> 19:5-19:9: @0[0]: Coverage::Counter(1) for $DIR/coverage_graphviz.rs:18:1 - 20:2<br align="left"/> 20:2-20:2: @0.Return: return</td></tr><tr><td align="left" balign="left">bb0: Return</td></tr></table>>]; + bcb0__Cov_0_4 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb0</td></tr><tr><td align="left" balign="left"></td></tr><tr><td align="left" balign="left">Counter(bcb0) at 18:1-20:2<br align="left"/> 19:5-19:9: @0[0]: Coverage::Counter(0) for $DIR/coverage_graphviz.rs:18:1 - 20:2<br align="left"/> 20:2-20:2: @0.Return: return</td></tr><tr><td align="left" balign="left">bb0: Return</td></tr></table>>]; } diff --git a/tests/mir-opt/coverage_graphviz.main.InstrumentCoverage.0.dot b/tests/mir-opt/coverage_graphviz.main.InstrumentCoverage.0.dot index c4d389b2d..19c220e2e 100644 --- a/tests/mir-opt/coverage_graphviz.main.InstrumentCoverage.0.dot +++ b/tests/mir-opt/coverage_graphviz.main.InstrumentCoverage.0.dot @@ -2,8 +2,8 @@ digraph Cov_0_3 { graph [fontname="Courier, monospace"]; node [fontname="Courier, monospace"]; edge [fontname="Courier, monospace"]; - bcb3__Cov_0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb3</td></tr><tr><td align="left" balign="left">Counter(bcb3) at 13:10-13:10<br align="left"/> 13:10-13:10: @5[0]: Coverage::Counter(2) for $DIR/coverage_graphviz.rs:13:10 - 13:11</td></tr><tr><td align="left" balign="left">bb5: Goto</td></tr></table>>]; - bcb2__Cov_0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb2</td></tr><tr><td align="left" balign="left">Expression(bcb1:(bcb0 + bcb3) - bcb3) at 12:13-12:18<br align="left"/> 12:13-12:18: @4[0]: Coverage::Expression(4294967293) = 4294967294 + 0 for $DIR/coverage_graphviz.rs:15:1 - 15:2<br align="left"/>Expression(bcb2:(bcb1:(bcb0 + bcb3) - bcb3) + 0) at 15:2-15:2<br align="left"/> 15:2-15:2: @4.Return: return</td></tr><tr><td align="left" balign="left">bb4: Return</td></tr></table>>]; + bcb3__Cov_0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb3</td></tr><tr><td align="left" balign="left">Counter(bcb3) at 13:10-13:10<br align="left"/> 13:10-13:10: @5[0]: Coverage::Counter(1) for $DIR/coverage_graphviz.rs:13:10 - 13:11</td></tr><tr><td align="left" balign="left">bb5: Goto</td></tr></table>>]; + bcb2__Cov_0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb2</td></tr><tr><td align="left" balign="left">Expression(bcb1:(bcb0 + bcb3) - bcb3) at 12:13-12:18<br align="left"/> 12:13-12:18: @4[0]: Coverage::Expression(2) = Expression(1) + Zero for $DIR/coverage_graphviz.rs:15:1 - 15:2<br align="left"/>Expression(bcb2:(bcb1:(bcb0 + bcb3) - bcb3) + 0) at 15:2-15:2<br align="left"/> 15:2-15:2: @4.Return: return</td></tr><tr><td align="left" balign="left">bb4: Return</td></tr></table>>]; bcb1__Cov_0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb1</td></tr><tr><td align="left" balign="left">Expression(bcb0 + bcb3) at 10:5-11:17<br align="left"/> 11:12-11:17: @2.Call: _2 = bar() -> [return: bb3, unwind: bb6]</td></tr><tr><td align="left" balign="left">bb1: FalseUnwind<br align="left"/>bb2: Call</td></tr><tr><td align="left" balign="left">bb3: SwitchInt</td></tr></table>>]; bcb0__Cov_0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb0</td></tr><tr><td align="left" balign="left"></td></tr><tr><td align="left" balign="left">Counter(bcb0) at 9:1-9:11<br align="left"/> </td></tr><tr><td align="left" balign="left">bb0: Goto</td></tr></table>>]; bcb3__Cov_0_3 -> bcb1__Cov_0_3 [label=<>]; diff --git a/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination.panic-abort.diff b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination.panic-abort.diff new file mode 100644 index 000000000..8f799b33f --- /dev/null +++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination.panic-abort.diff @@ -0,0 +1,23 @@ +- // MIR for `move_simple` before DeadStoreElimination ++ // MIR for `move_simple` after DeadStoreElimination + + fn move_simple(_1: i32) -> () { + debug x => _1; + let mut _0: (); + let _2: (); +- let mut _3: i32; +- let mut _4: i32; + + bb0: { + StorageLive(_2); +- _2 = use_both(_1, _1) -> [return: bb1, unwind unreachable]; ++ _2 = use_both(_1, move _1) -> [return: bb1, unwind unreachable]; + } + + bb1: { + StorageDead(_2); + _0 = const (); + return; + } + } + diff --git a/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination.panic-unwind.diff b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination.panic-unwind.diff new file mode 100644 index 000000000..0551d663b --- /dev/null +++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination.panic-unwind.diff @@ -0,0 +1,23 @@ +- // MIR for `move_simple` before DeadStoreElimination ++ // MIR for `move_simple` after DeadStoreElimination + + fn move_simple(_1: i32) -> () { + debug x => _1; + let mut _0: (); + let _2: (); +- let mut _3: i32; +- let mut _4: i32; + + bb0: { + StorageLive(_2); +- _2 = use_both(_1, _1) -> [return: bb1, unwind continue]; ++ _2 = use_both(_1, move _1) -> [return: bb1, unwind continue]; + } + + bb1: { + StorageDead(_2); + _0 = const (); + return; + } + } + diff --git a/tests/mir-opt/dead-store-elimination/call_arg_copy.rs b/tests/mir-opt/dead-store-elimination/call_arg_copy.rs new file mode 100644 index 000000000..41f91fc13 --- /dev/null +++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.rs @@ -0,0 +1,15 @@ +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY +// unit-test: DeadStoreElimination +// compile-flags: -Zmir-enable-passes=+CopyProp + +#[inline(never)] +fn use_both(_: i32, _: i32) {} + +// EMIT_MIR call_arg_copy.move_simple.DeadStoreElimination.diff +fn move_simple(x: i32) { + use_both(x, x); +} + +fn main() { + move_simple(1); +} diff --git a/tests/mir-opt/inline/cycle.g.Inline.panic-abort.diff b/tests/mir-opt/inline/cycle.g.Inline.panic-abort.diff index f3f4d895a..8f2baf4a3 100644 --- a/tests/mir-opt/inline/cycle.g.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/cycle.g.Inline.panic-abort.diff @@ -5,13 +5,10 @@ let mut _0: (); let _1: (); + let mut _2: fn() {main}; -+ let mut _5: (); + scope 1 (inlined f::<fn() {main}>) { + debug g => _2; + let mut _3: &fn() {main}; + let _4: (); -+ scope 2 (inlined <fn() {main} as Fn<()>>::call - shim(fn() {main})) { -+ } + } bb0: { @@ -22,9 +19,7 @@ + StorageLive(_4); + StorageLive(_3); + _3 = &_2; -+ StorageLive(_5); -+ _5 = const (); -+ _4 = move (*_3)() -> [return: bb2, unwind unreachable]; ++ _4 = <fn() {main} as Fn<()>>::call(move _3, const ()) -> [return: bb2, unwind unreachable]; } bb1: { @@ -36,7 +31,6 @@ + } + + bb2: { -+ StorageDead(_5); + StorageDead(_3); + drop(_2) -> [return: bb1, unwind unreachable]; } diff --git a/tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff b/tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff index 3ce8d9acf..ad801fd28 100644 --- a/tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff @@ -5,13 +5,10 @@ let mut _0: (); let _1: (); + let mut _2: fn() {main}; -+ let mut _5: (); + scope 1 (inlined f::<fn() {main}>) { + debug g => _2; + let mut _3: &fn() {main}; + let _4: (); -+ scope 2 (inlined <fn() {main} as Fn<()>>::call - shim(fn() {main})) { -+ } + } bb0: { @@ -22,9 +19,7 @@ + StorageLive(_4); + StorageLive(_3); + _3 = &_2; -+ StorageLive(_5); -+ _5 = const (); -+ _4 = move (*_3)() -> [return: bb4, unwind: bb2]; ++ _4 = <fn() {main} as Fn<()>>::call(move _3, const ()) -> [return: bb2, unwind: bb3]; } bb1: { @@ -35,18 +30,17 @@ return; + } + -+ bb2 (cleanup): { -+ drop(_2) -> [return: bb3, unwind terminate]; ++ bb2: { ++ StorageDead(_3); ++ drop(_2) -> [return: bb1, unwind continue]; + } + + bb3 (cleanup): { -+ resume; ++ drop(_2) -> [return: bb4, unwind terminate]; + } + -+ bb4: { -+ StorageDead(_5); -+ StorageDead(_3); -+ drop(_2) -> [return: bb1, unwind continue]; ++ bb4 (cleanup): { ++ resume; } } diff --git a/tests/mir-opt/inline/cycle.main.Inline.panic-abort.diff b/tests/mir-opt/inline/cycle.main.Inline.panic-abort.diff index eb0076354..fd1f698c6 100644 --- a/tests/mir-opt/inline/cycle.main.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/cycle.main.Inline.panic-abort.diff @@ -5,21 +5,10 @@ let mut _0: (); let _1: (); + let mut _2: fn() {g}; -+ let mut _5: (); + scope 1 (inlined f::<fn() {g}>) { + debug g => _2; + let mut _3: &fn() {g}; + let _4: (); -+ scope 2 (inlined <fn() {g} as Fn<()>>::call - shim(fn() {g})) { -+ scope 3 (inlined g) { -+ scope 4 (inlined f::<fn() {main}>) { -+ debug g => main; -+ let _6: (); -+ scope 5 (inlined <fn() {main} as Fn<()>>::call - shim(fn() {main})) { -+ } -+ } -+ } -+ } + } bb0: { @@ -30,10 +19,7 @@ + StorageLive(_4); + StorageLive(_3); + _3 = &_2; -+ StorageLive(_5); -+ _5 = const (); -+ StorageLive(_6); -+ _6 = main() -> [return: bb2, unwind unreachable]; ++ _4 = <fn() {g} as Fn<()>>::call(move _3, const ()) -> [return: bb2, unwind unreachable]; } bb1: { @@ -45,8 +31,6 @@ + } + + bb2: { -+ StorageDead(_6); -+ StorageDead(_5); + StorageDead(_3); + drop(_2) -> [return: bb1, unwind unreachable]; } diff --git a/tests/mir-opt/inline/cycle.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/cycle.main.Inline.panic-unwind.diff index 198a23226..99dc64115 100644 --- a/tests/mir-opt/inline/cycle.main.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/cycle.main.Inline.panic-unwind.diff @@ -5,21 +5,10 @@ let mut _0: (); let _1: (); + let mut _2: fn() {g}; -+ let mut _5: (); + scope 1 (inlined f::<fn() {g}>) { + debug g => _2; + let mut _3: &fn() {g}; + let _4: (); -+ scope 2 (inlined <fn() {g} as Fn<()>>::call - shim(fn() {g})) { -+ scope 3 (inlined g) { -+ scope 4 (inlined f::<fn() {main}>) { -+ debug g => main; -+ let _6: (); -+ scope 5 (inlined <fn() {main} as Fn<()>>::call - shim(fn() {main})) { -+ } -+ } -+ } -+ } + } bb0: { @@ -30,10 +19,7 @@ + StorageLive(_4); + StorageLive(_3); + _3 = &_2; -+ StorageLive(_5); -+ _5 = const (); -+ StorageLive(_6); -+ _6 = main() -> [return: bb4, unwind: bb2]; ++ _4 = <fn() {g} as Fn<()>>::call(move _3, const ()) -> [return: bb2, unwind: bb3]; } bb1: { @@ -44,19 +30,17 @@ return; + } + -+ bb2 (cleanup): { -+ drop(_2) -> [return: bb3, unwind terminate]; ++ bb2: { ++ StorageDead(_3); ++ drop(_2) -> [return: bb1, unwind continue]; + } + + bb3 (cleanup): { -+ resume; ++ drop(_2) -> [return: bb4, unwind terminate]; + } + -+ bb4: { -+ StorageDead(_6); -+ StorageDead(_5); -+ StorageDead(_3); -+ drop(_2) -> [return: bb1, unwind continue]; ++ bb4 (cleanup): { ++ resume; } } diff --git a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-abort.diff b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-abort.diff new file mode 100644 index 000000000..757617e59 --- /dev/null +++ b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-abort.diff @@ -0,0 +1,29 @@ +- // MIR for `call` before Inline ++ // MIR for `call` after Inline + + fn call(_1: Box<dyn FnMut<I, Output = ()>>, _2: I) -> () { + debug mock => _1; + debug input => _2; + let mut _0: (); + let mut _3: &mut std::boxed::Box<dyn std::ops::FnMut<I, Output = ()>>; + let mut _4: I; + + bb0: { + StorageLive(_3); + _3 = &mut _1; + StorageLive(_4); + _4 = move _2; + _0 = <Box<dyn FnMut<I, Output = ()>> as FnMut<I>>::call_mut(move _3, move _4) -> [return: bb1, unwind unreachable]; + } + + bb1: { + StorageDead(_4); + StorageDead(_3); + drop(_1) -> [return: bb2, unwind unreachable]; + } + + bb2: { + return; + } + } + diff --git a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-unwind.diff b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-unwind.diff new file mode 100644 index 000000000..ef85e075e --- /dev/null +++ b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-unwind.diff @@ -0,0 +1,37 @@ +- // MIR for `call` before Inline ++ // MIR for `call` after Inline + + fn call(_1: Box<dyn FnMut<I, Output = ()>>, _2: I) -> () { + debug mock => _1; + debug input => _2; + let mut _0: (); + let mut _3: &mut std::boxed::Box<dyn std::ops::FnMut<I, Output = ()>>; + let mut _4: I; + + bb0: { + StorageLive(_3); + _3 = &mut _1; + StorageLive(_4); + _4 = move _2; + _0 = <Box<dyn FnMut<I, Output = ()>> as FnMut<I>>::call_mut(move _3, move _4) -> [return: bb1, unwind: bb3]; + } + + bb1: { + StorageDead(_4); + StorageDead(_3); + drop(_1) -> [return: bb2, unwind: bb4]; + } + + bb2: { + return; + } + + bb3 (cleanup): { + drop(_1) -> [return: bb4, unwind terminate]; + } + + bb4 (cleanup): { + resume; + } + } + diff --git a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs new file mode 100644 index 000000000..971223c72 --- /dev/null +++ b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs @@ -0,0 +1,11 @@ +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY +// compile-flags: -Zmir-enable-passes=+Inline --crate-type=lib + +#![feature(fn_traits, tuple_trait, unboxed_closures)] + +use std::marker::Tuple; + +// EMIT_MIR dont_ice_on_generic_rust_call.call.Inline.diff +pub fn call<I: Tuple>(mut mock: Box<dyn FnMut<I, Output = ()>>, input: I) { + mock.call_mut(input) +} diff --git a/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-abort.diff b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-abort.diff index 57b0849e1..9d5042caa 100644 --- a/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-abort.diff @@ -32,7 +32,7 @@ - _0 = try_execute_query::<<Q as Query>::C>(move _4) -> [return: bb2, unwind unreachable]; + StorageLive(_5); + _5 = _4 as &dyn Cache<V = <Q as Query>::V> (PointerCoercion(Unsize)); -+ _0 = <dyn Cache<V = <Q as Query>::V> as Cache>::store_nocache(_5) -> [return: bb2, unwind unreachable]; ++ _0 = <dyn Cache<V = <Q as Query>::V> as Cache>::store_nocache(move _5) -> [return: bb2, unwind unreachable]; } bb2: { diff --git a/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff index 706c1d481..9bd3855c5 100644 --- a/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff @@ -32,7 +32,7 @@ - _0 = try_execute_query::<<Q as Query>::C>(move _4) -> [return: bb2, unwind continue]; + StorageLive(_5); + _5 = _4 as &dyn Cache<V = <Q as Query>::V> (PointerCoercion(Unsize)); -+ _0 = <dyn Cache<V = <Q as Query>::V> as Cache>::store_nocache(_5) -> [return: bb2, unwind continue]; ++ _0 = <dyn Cache<V = <Q as Query>::V> as Cache>::store_nocache(move _5) -> [return: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-abort.diff b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-abort.diff index 9a6d3596f..96e16d023 100644 --- a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-abort.diff @@ -17,7 +17,7 @@ _2 = move _3 as &dyn Cache<V = <C as Cache>::V> (PointerCoercion(Unsize)); StorageDead(_3); - _0 = mk_cycle::<<C as Cache>::V>(move _2) -> [return: bb1, unwind unreachable]; -+ _0 = <dyn Cache<V = <C as Cache>::V> as Cache>::store_nocache(_2) -> [return: bb1, unwind unreachable]; ++ _0 = <dyn Cache<V = <C as Cache>::V> as Cache>::store_nocache(move _2) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff index 1a08df2b0..06d65abcb 100644 --- a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff @@ -17,7 +17,7 @@ _2 = move _3 as &dyn Cache<V = <C as Cache>::V> (PointerCoercion(Unsize)); StorageDead(_3); - _0 = mk_cycle::<<C as Cache>::V>(move _2) -> [return: bb1, unwind continue]; -+ _0 = <dyn Cache<V = <C as Cache>::V> as Cache>::store_nocache(_2) -> [return: bb1, unwind continue]; ++ _0 = <dyn Cache<V = <C as Cache>::V> as Cache>::store_nocache(move _2) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-abort.diff new file mode 100644 index 000000000..4fa04b05e --- /dev/null +++ b/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-abort.diff @@ -0,0 +1,32 @@ +- // MIR for `call` before Inline ++ // MIR for `call` after Inline + + fn call(_1: Box<dyn Fn(i32)>) -> () { + debug x => _1; + let mut _0: (); + let _2: (); + let mut _3: &std::boxed::Box<dyn std::ops::Fn(i32)>; + let mut _4: (i32,); + + bb0: { + StorageLive(_2); + StorageLive(_3); + _3 = &_1; + StorageLive(_4); + _4 = (const 1_i32,); + _2 = <Box<dyn Fn(i32)> as Fn<(i32,)>>::call(move _3, move _4) -> [return: bb1, unwind unreachable]; + } + + bb1: { + StorageDead(_4); + StorageDead(_3); + StorageDead(_2); + _0 = const (); + drop(_1) -> [return: bb2, unwind unreachable]; + } + + bb2: { + return; + } + } + diff --git a/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-unwind.diff new file mode 100644 index 000000000..5df730a99 --- /dev/null +++ b/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-unwind.diff @@ -0,0 +1,40 @@ +- // MIR for `call` before Inline ++ // MIR for `call` after Inline + + fn call(_1: Box<dyn Fn(i32)>) -> () { + debug x => _1; + let mut _0: (); + let _2: (); + let mut _3: &std::boxed::Box<dyn std::ops::Fn(i32)>; + let mut _4: (i32,); + + bb0: { + StorageLive(_2); + StorageLive(_3); + _3 = &_1; + StorageLive(_4); + _4 = (const 1_i32,); + _2 = <Box<dyn Fn(i32)> as Fn<(i32,)>>::call(move _3, move _4) -> [return: bb1, unwind: bb3]; + } + + bb1: { + StorageDead(_4); + StorageDead(_3); + StorageDead(_2); + _0 = const (); + drop(_1) -> [return: bb2, unwind: bb4]; + } + + bb2: { + return; + } + + bb3 (cleanup): { + drop(_1) -> [return: bb4, unwind terminate]; + } + + bb4 (cleanup): { + resume; + } + } + diff --git a/tests/mir-opt/inline/inline_box_fn.rs b/tests/mir-opt/inline/inline_box_fn.rs new file mode 100644 index 000000000..348f0e77f --- /dev/null +++ b/tests/mir-opt/inline/inline_box_fn.rs @@ -0,0 +1,8 @@ +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY +// unit-test: Inline +// compile-flags: --crate-type=lib + +// EMIT_MIR inline_box_fn.call.Inline.diff +fn call(x: Box<dyn Fn(i32)>) { + x(1); +} diff --git a/tests/mir-opt/inline/inline_cycle.two.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_cycle.two.Inline.panic-abort.diff index d83c8d585..8a6eec335 100644 --- a/tests/mir-opt/inline/inline_cycle.two.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_cycle.two.Inline.panic-abort.diff @@ -5,20 +5,9 @@ let mut _0: (); let _1: (); + let mut _2: fn() {f}; -+ let mut _4: (); + scope 1 (inlined call::<fn() {f}>) { + debug f => _2; + let _3: (); -+ scope 2 (inlined <fn() {f} as FnOnce<()>>::call_once - shim(fn() {f})) { -+ scope 3 (inlined f) { -+ scope 4 (inlined call::<fn() {f}>) { -+ debug f => f; -+ let _5: (); -+ scope 5 (inlined <fn() {f} as FnOnce<()>>::call_once - shim(fn() {f})) { -+ } -+ } -+ } -+ } + } bb0: { @@ -27,15 +16,10 @@ + StorageLive(_2); + _2 = f; + StorageLive(_3); -+ StorageLive(_4); -+ _4 = const (); -+ StorageLive(_5); -+ _5 = f() -> [return: bb1, unwind unreachable]; ++ _3 = <fn() {f} as FnOnce<()>>::call_once(move _2, const ()) -> [return: bb1, unwind unreachable]; } bb1: { -+ StorageDead(_5); -+ StorageDead(_4); + StorageDead(_3); + StorageDead(_2); StorageDead(_1); diff --git a/tests/mir-opt/inline/inline_cycle.two.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_cycle.two.Inline.panic-unwind.diff index a08662959..a24649c1e 100644 --- a/tests/mir-opt/inline/inline_cycle.two.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_cycle.two.Inline.panic-unwind.diff @@ -5,20 +5,9 @@ let mut _0: (); let _1: (); + let mut _2: fn() {f}; -+ let mut _4: (); + scope 1 (inlined call::<fn() {f}>) { + debug f => _2; + let _3: (); -+ scope 2 (inlined <fn() {f} as FnOnce<()>>::call_once - shim(fn() {f})) { -+ scope 3 (inlined f) { -+ scope 4 (inlined call::<fn() {f}>) { -+ debug f => f; -+ let _5: (); -+ scope 5 (inlined <fn() {f} as FnOnce<()>>::call_once - shim(fn() {f})) { -+ } -+ } -+ } -+ } + } bb0: { @@ -27,15 +16,10 @@ + StorageLive(_2); + _2 = f; + StorageLive(_3); -+ StorageLive(_4); -+ _4 = const (); -+ StorageLive(_5); -+ _5 = f() -> [return: bb1, unwind continue]; ++ _3 = <fn() {f} as FnOnce<()>>::call_once(move _2, const ()) -> [return: bb1, unwind continue]; } bb1: { -+ StorageDead(_5); -+ StorageDead(_4); + StorageDead(_3); + StorageDead(_2); StorageDead(_1); diff --git a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff index 0dcd5fae8..7d5553b2f 100644 --- a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff @@ -5,7 +5,6 @@ let mut _0: (); let _1: (!, !); + let mut _2: fn() -> ! {sleep}; -+ let mut _7: (); + scope 1 (inlined call_twice::<!, fn() -> ! {sleep}>) { + debug f => _2; + let mut _3: &fn() -> ! {sleep}; @@ -18,10 +17,6 @@ + debug b => _6; + } + } -+ scope 4 (inlined <fn() -> ! {sleep} as Fn<()>>::call - shim(fn() -> ! {sleep})) { -+ scope 5 (inlined sleep) { -+ } -+ } + } bb0: { @@ -33,13 +28,24 @@ + StorageLive(_6); + StorageLive(_3); + _3 = &_2; -+ StorageLive(_7); -+ _7 = const (); -+ goto -> bb1; ++ _4 = <fn() -> ! {sleep} as Fn<()>>::call(move _3, const ()) -> [return: bb1, unwind unreachable]; + } + + bb1: { -+ goto -> bb1; ++ StorageDead(_3); ++ StorageLive(_5); ++ _5 = &_2; ++ _6 = <fn() -> ! {sleep} as Fn<()>>::call(move _5, const ()) -> [return: bb2, unwind unreachable]; ++ } ++ ++ bb2: { ++ StorageDead(_5); ++ _1 = (move _4, move _6); ++ drop(_2) -> [return: bb3, unwind unreachable]; ++ } ++ ++ bb3: { ++ unreachable; } } diff --git a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff index dfc12db12..073ddeff7 100644 --- a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff @@ -5,7 +5,6 @@ let mut _0: (); let _1: (!, !); + let mut _2: fn() -> ! {sleep}; -+ let mut _8: (); + scope 1 (inlined call_twice::<!, fn() -> ! {sleep}>) { + debug f => _2; + let mut _3: &fn() -> ! {sleep}; @@ -19,10 +18,6 @@ + debug b => _6; + } + } -+ scope 4 (inlined <fn() -> ! {sleep} as Fn<()>>::call - shim(fn() -> ! {sleep})) { -+ scope 5 (inlined sleep) { -+ } -+ } + } bb0: { @@ -34,13 +29,40 @@ + StorageLive(_4); + StorageLive(_3); + _3 = &_2; -+ StorageLive(_8); -+ _8 = const (); -+ goto -> bb1; ++ _4 = <fn() -> ! {sleep} as Fn<()>>::call(move _3, const ()) -> [return: bb1, unwind: bb5]; + } + + bb1: { -+ goto -> bb1; ++ StorageDead(_3); ++ StorageLive(_5); ++ _5 = &_2; ++ _6 = <fn() -> ! {sleep} as Fn<()>>::call(move _5, const ()) -> [return: bb2, unwind: bb4]; ++ } ++ ++ bb2: { ++ StorageDead(_5); ++ StorageLive(_7); ++ _7 = move _4; ++ _1 = (move _7, move _6); ++ StorageDead(_7); ++ StorageDead(_4); ++ drop(_2) -> [return: bb3, unwind continue]; ++ } ++ ++ bb3: { ++ unreachable; ++ } ++ ++ bb4 (cleanup): { ++ drop(_4) -> [return: bb5, unwind terminate]; ++ } ++ ++ bb5 (cleanup): { ++ drop(_2) -> [return: bb6, unwind terminate]; ++ } ++ ++ bb6 (cleanup): { ++ resume; } } diff --git a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff index 3848196ec..dc0ab255a 100644 --- a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff @@ -33,37 +33,36 @@ + debug ptr => _11; + scope 18 (inlined NonNull::<[u8]>::as_mut_ptr) { + debug self => _11; -+ let mut _16: std::ptr::NonNull<u8>; ++ let mut _15: std::ptr::NonNull<u8>; + scope 19 (inlined NonNull::<[u8]>::as_non_null_ptr) { + debug self => _11; -+ let mut _17: *mut u8; -+ let mut _18: *mut [u8]; ++ let mut _16: *mut u8; ++ let mut _17: *mut [u8]; + scope 20 { + scope 21 (inlined NonNull::<[u8]>::as_ptr) { + debug self => _11; -+ let mut _19: *const [u8]; ++ let mut _18: *const [u8]; + } + scope 22 (inlined ptr::mut_ptr::<impl *mut [u8]>::as_mut_ptr) { -+ debug self => _18; ++ debug self => _17; + } + scope 23 (inlined NonNull::<u8>::new_unchecked) { -+ debug ptr => _17; -+ let mut _20: *const u8; -+ let mut _21: *mut u8; ++ debug ptr => _16; ++ let mut _19: *const u8; + scope 24 { + scope 25 (inlined NonNull::<T>::new_unchecked::runtime::<u8>) { -+ debug ptr => _21; ++ debug ptr => _16; + scope 26 (inlined ptr::mut_ptr::<impl *mut u8>::is_null) { -+ debug self => _21; -+ let mut _22: *mut u8; ++ debug self => _16; ++ let mut _20: *mut u8; + scope 27 { + scope 28 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) { -+ debug ptr => _22; ++ debug ptr => _20; + scope 29 (inlined ptr::mut_ptr::<impl *mut u8>::addr) { -+ debug self => _22; ++ debug self => _20; + scope 30 { + scope 31 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) { -+ debug self => _22; ++ debug self => _20; + } + } + } @@ -76,8 +75,8 @@ + } + } + scope 32 (inlined NonNull::<u8>::as_ptr) { -+ debug self => _16; -+ let mut _23: *const u8; ++ debug self => _15; ++ let mut _21: *const u8; + } + } + } @@ -94,14 +93,13 @@ + scope 10 { + scope 11 (inlined std::ptr::Alignment::new_unchecked) { + debug align => _5; -+ let mut _15: usize; + scope 12 { + scope 14 (inlined std::ptr::Alignment::new_unchecked::runtime) { -+ debug align => _15; ++ debug align => _5; + scope 15 (inlined core::num::<impl usize>::is_power_of_two) { -+ debug self => _15; ++ debug self => _5; + scope 16 (inlined core::num::<impl usize>::count_ones) { -+ debug self => _15; ++ debug self => _5; + } + } + } @@ -131,14 +129,12 @@ + StorageLive(_12); + StorageLive(_13); + StorageLive(_14); -+ StorageLive(_15); + _14 = _5 as std::ptr::Alignment (Transmute); -+ StorageDead(_15); + _8 = Layout { size: _4, align: move _14 }; + StorageDead(_14); + StorageLive(_9); + _13 = const _; -+ _9 = std::alloc::Global::alloc_impl(_13, _8, const false) -> [return: bb5, unwind unreachable]; ++ _9 = std::alloc::Global::alloc_impl(move _13, _8, const false) -> [return: bb5, unwind unreachable]; } bb1: { @@ -148,7 +144,7 @@ } bb2: { -+ _12 = handle_alloc_error(_8) -> unwind unreachable; ++ _12 = handle_alloc_error(move _8) -> unwind unreachable; + } + + bb3: { @@ -157,29 +153,27 @@ + + bb4: { + _11 = ((_9 as Ok).0: std::ptr::NonNull<[u8]>); ++ StorageLive(_15); + StorageLive(_16); + StorageLive(_17); + StorageLive(_18); -+ StorageLive(_19); -+ _19 = (_11.0: *const [u8]); -+ _18 = move _19 as *mut [u8] (PtrToPtr); -+ StorageDead(_19); -+ _17 = _18 as *mut u8 (PtrToPtr); ++ _18 = (_11.0: *const [u8]); ++ _17 = move _18 as *mut [u8] (PtrToPtr); + StorageDead(_18); ++ _16 = _17 as *mut u8 (PtrToPtr); ++ StorageDead(_17); ++ StorageLive(_19); + StorageLive(_20); -+ StorageLive(_21); -+ StorageLive(_22); -+ _20 = _17 as *const u8 (PointerCoercion(MutToConstPointer)); -+ _16 = NonNull::<u8> { pointer: _20 }; -+ StorageDead(_22); -+ StorageDead(_21); ++ _19 = _16 as *const u8 (PointerCoercion(MutToConstPointer)); ++ _15 = NonNull::<u8> { pointer: _19 }; + StorageDead(_20); -+ StorageDead(_17); -+ StorageLive(_23); -+ _23 = (_16.0: *const u8); -+ _6 = move _23 as *mut u8 (PtrToPtr); -+ StorageDead(_23); ++ StorageDead(_19); + StorageDead(_16); ++ StorageLive(_21); ++ _21 = (_15.0: *const u8); ++ _6 = move _21 as *mut u8 (PtrToPtr); ++ StorageDead(_21); ++ StorageDead(_15); + StorageDead(_9); + StorageDead(_13); + StorageDead(_12); diff --git a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff index 80b5810aa..54c33aac9 100644 --- a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff @@ -33,37 +33,36 @@ + debug ptr => _11; + scope 18 (inlined NonNull::<[u8]>::as_mut_ptr) { + debug self => _11; -+ let mut _16: std::ptr::NonNull<u8>; ++ let mut _15: std::ptr::NonNull<u8>; + scope 19 (inlined NonNull::<[u8]>::as_non_null_ptr) { + debug self => _11; -+ let mut _17: *mut u8; -+ let mut _18: *mut [u8]; ++ let mut _16: *mut u8; ++ let mut _17: *mut [u8]; + scope 20 { + scope 21 (inlined NonNull::<[u8]>::as_ptr) { + debug self => _11; -+ let mut _19: *const [u8]; ++ let mut _18: *const [u8]; + } + scope 22 (inlined ptr::mut_ptr::<impl *mut [u8]>::as_mut_ptr) { -+ debug self => _18; ++ debug self => _17; + } + scope 23 (inlined NonNull::<u8>::new_unchecked) { -+ debug ptr => _17; -+ let mut _20: *const u8; -+ let mut _21: *mut u8; ++ debug ptr => _16; ++ let mut _19: *const u8; + scope 24 { + scope 25 (inlined NonNull::<T>::new_unchecked::runtime::<u8>) { -+ debug ptr => _21; ++ debug ptr => _16; + scope 26 (inlined ptr::mut_ptr::<impl *mut u8>::is_null) { -+ debug self => _21; -+ let mut _22: *mut u8; ++ debug self => _16; ++ let mut _20: *mut u8; + scope 27 { + scope 28 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) { -+ debug ptr => _22; ++ debug ptr => _20; + scope 29 (inlined ptr::mut_ptr::<impl *mut u8>::addr) { -+ debug self => _22; ++ debug self => _20; + scope 30 { + scope 31 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) { -+ debug self => _22; ++ debug self => _20; + } + } + } @@ -76,8 +75,8 @@ + } + } + scope 32 (inlined NonNull::<u8>::as_ptr) { -+ debug self => _16; -+ let mut _23: *const u8; ++ debug self => _15; ++ let mut _21: *const u8; + } + } + } @@ -94,14 +93,13 @@ + scope 10 { + scope 11 (inlined std::ptr::Alignment::new_unchecked) { + debug align => _5; -+ let mut _15: usize; + scope 12 { + scope 14 (inlined std::ptr::Alignment::new_unchecked::runtime) { -+ debug align => _15; ++ debug align => _5; + scope 15 (inlined core::num::<impl usize>::is_power_of_two) { -+ debug self => _15; ++ debug self => _5; + scope 16 (inlined core::num::<impl usize>::count_ones) { -+ debug self => _15; ++ debug self => _5; + } + } + } @@ -131,14 +129,12 @@ + StorageLive(_12); + StorageLive(_13); + StorageLive(_14); -+ StorageLive(_15); + _14 = _5 as std::ptr::Alignment (Transmute); -+ StorageDead(_15); + _8 = Layout { size: _4, align: move _14 }; + StorageDead(_14); + StorageLive(_9); + _13 = const _; -+ _9 = std::alloc::Global::alloc_impl(_13, _8, const false) -> [return: bb7, unwind: bb3]; ++ _9 = std::alloc::Global::alloc_impl(move _13, _8, const false) -> [return: bb7, unwind: bb3]; } bb1: { @@ -165,7 +161,7 @@ - bb4 (cleanup): { - resume; + bb4: { -+ _12 = handle_alloc_error(_8) -> bb3; ++ _12 = handle_alloc_error(move _8) -> bb3; + } + + bb5: { @@ -174,29 +170,27 @@ + + bb6: { + _11 = ((_9 as Ok).0: std::ptr::NonNull<[u8]>); ++ StorageLive(_15); + StorageLive(_16); + StorageLive(_17); + StorageLive(_18); -+ StorageLive(_19); -+ _19 = (_11.0: *const [u8]); -+ _18 = move _19 as *mut [u8] (PtrToPtr); -+ StorageDead(_19); -+ _17 = _18 as *mut u8 (PtrToPtr); ++ _18 = (_11.0: *const [u8]); ++ _17 = move _18 as *mut [u8] (PtrToPtr); + StorageDead(_18); ++ _16 = _17 as *mut u8 (PtrToPtr); ++ StorageDead(_17); ++ StorageLive(_19); + StorageLive(_20); -+ StorageLive(_21); -+ StorageLive(_22); -+ _20 = _17 as *const u8 (PointerCoercion(MutToConstPointer)); -+ _16 = NonNull::<u8> { pointer: _20 }; -+ StorageDead(_22); -+ StorageDead(_21); ++ _19 = _16 as *const u8 (PointerCoercion(MutToConstPointer)); ++ _15 = NonNull::<u8> { pointer: _19 }; + StorageDead(_20); -+ StorageDead(_17); -+ StorageLive(_23); -+ _23 = (_16.0: *const u8); -+ _6 = move _23 as *mut u8 (PtrToPtr); -+ StorageDead(_23); ++ StorageDead(_19); + StorageDead(_16); ++ StorageLive(_21); ++ _21 = (_15.0: *const u8); ++ _6 = move _21 as *mut u8 (PtrToPtr); ++ StorageDead(_21); ++ StorageDead(_15); + StorageDead(_9); + StorageDead(_13); + StorageDead(_12); diff --git a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-abort.mir b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-abort.mir index 503f15308..f0d1cfe03 100644 --- a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-abort.mir +++ b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-abort.mir @@ -15,7 +15,7 @@ fn test2(_1: &dyn X) -> bool { _3 = &(*_1); _2 = move _3 as &dyn X (PointerCoercion(Unsize)); StorageDead(_3); - _0 = <dyn X as X>::y(_2) -> [return: bb1, unwind unreachable]; + _0 = <dyn X as X>::y(move _2) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir index 37bb53e79..f37b08143 100644 --- a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir +++ b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir @@ -15,7 +15,7 @@ fn test2(_1: &dyn X) -> bool { _3 = &(*_1); _2 = move _3 as &dyn X (PointerCoercion(Unsize)); StorageDead(_3); - _0 = <dyn X as X>::y(_2) -> [return: bb1, unwind continue]; + _0 = <dyn X as X>::y(move _2) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff index b86eb5f35..bee01a5f9 100644 --- a/tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff @@ -8,8 +8,6 @@ let mut _3: &fn() {foo}; let _4: fn() {foo}; let mut _5: (); -+ scope 1 (inlined <fn() {foo} as Fn<()>>::call - shim(fn() {foo})) { -+ } bb0: { StorageLive(_2); @@ -22,26 +20,20 @@ _3 = &_4; StorageLive(_5); _5 = (); -- _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind unreachable]; -+ _2 = move (*_3)() -> [return: bb3, unwind unreachable]; + _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind unreachable]; } bb2: { -+ return; -+ } -+ -+ bb3: { StorageDead(_5); StorageDead(_3); StorageDead(_4); StorageDead(_2); _0 = const (); -- drop(_1) -> [return: bb3, unwind unreachable]; -- } -- -- bb3: { -- return; -+ drop(_1) -> [return: bb2, unwind unreachable]; + drop(_1) -> [return: bb3, unwind unreachable]; + } + + bb3: { + return; } } diff --git a/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff index c67babba2..b750330df 100644 --- a/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff @@ -8,55 +8,40 @@ let mut _3: &fn() {foo}; let _4: fn() {foo}; let mut _5: (); -+ scope 1 (inlined <fn() {foo} as Fn<()>>::call - shim(fn() {foo})) { -+ } bb0: { StorageLive(_2); StorageLive(_3); StorageLive(_4); -- _4 = hide_foo() -> [return: bb1, unwind: bb4]; -+ _4 = hide_foo() -> [return: bb1, unwind: bb3]; + _4 = hide_foo() -> [return: bb1, unwind: bb4]; } bb1: { _3 = &_4; StorageLive(_5); _5 = (); -- _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind: bb4]; -+ _2 = move (*_3)() -> [return: bb5, unwind: bb3]; + _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind: bb4]; } bb2: { -- StorageDead(_5); -- StorageDead(_3); -- StorageDead(_4); -- StorageDead(_2); -- _0 = const (); -- drop(_1) -> [return: bb3, unwind: bb5]; -+ return; + StorageDead(_5); + StorageDead(_3); + StorageDead(_4); + StorageDead(_2); + _0 = const (); + drop(_1) -> [return: bb3, unwind: bb5]; } -- bb3: { -- return; -+ bb3 (cleanup): { -+ drop(_1) -> [return: bb4, unwind terminate]; + bb3: { + return; } bb4 (cleanup): { -- drop(_1) -> [return: bb5, unwind terminate]; -+ resume; + drop(_1) -> [return: bb5, unwind terminate]; } -- bb5 (cleanup): { -- resume; -+ bb5: { -+ StorageDead(_5); -+ StorageDead(_3); -+ StorageDead(_4); -+ StorageDead(_2); -+ _0 = const (); -+ drop(_1) -> [return: bb2, unwind: bb4]; + bb5 (cleanup): { + resume; } } diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff index 90b32247c..d05221966 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff @@ -12,7 +12,6 @@ + debug rhs => _4; + let mut _5: u16; + let mut _6: bool; -+ let mut _7: u32; + scope 2 { + } + } @@ -28,10 +27,7 @@ - bb1: { + StorageLive(_5); + StorageLive(_6); -+ StorageLive(_7); -+ _7 = const 65535_u32; -+ _6 = Le(_4, move _7); -+ StorageDead(_7); ++ _6 = Le(_4, const 65535_u32); + assume(move _6); + StorageDead(_6); + _5 = _4 as u16 (IntToInt); diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff index cae25759c..67a5ac248 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff @@ -12,7 +12,6 @@ + debug rhs => _4; + let mut _5: u16; + let mut _6: bool; -+ let mut _7: u32; + scope 2 { + } + } @@ -28,10 +27,7 @@ - bb1: { + StorageLive(_5); + StorageLive(_6); -+ StorageLive(_7); -+ _7 = const 65535_u32; -+ _6 = Le(_4, move _7); -+ StorageDead(_7); ++ _6 = Le(_4, const 65535_u32); + assume(move _6); + StorageDead(_6); + _5 = _4 as u16 (IntToInt); diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir index 3f388a69d..f9dff62e0 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir @@ -7,25 +7,21 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 { scope 1 (inlined core::num::<impl u16>::unchecked_shl) { debug self => _1; debug rhs => _2; - let mut _3: u32; - let mut _4: bool; - let mut _5: u16; + let mut _3: bool; + let mut _4: u16; scope 2 { } } bb0: { - StorageLive(_5); StorageLive(_4); StorageLive(_3); - _3 = const 65535_u32; - _4 = Le(_2, move _3); + _3 = Le(_2, const 65535_u32); + assume(move _3); StorageDead(_3); - assume(move _4); + _4 = _2 as u16 (IntToInt); + _0 = ShlUnchecked(_1, move _4); StorageDead(_4); - _5 = _2 as u16 (IntToInt); - _0 = ShlUnchecked(_1, move _5); - StorageDead(_5); return; } } diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir index 3f388a69d..f9dff62e0 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir @@ -7,25 +7,21 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 { scope 1 (inlined core::num::<impl u16>::unchecked_shl) { debug self => _1; debug rhs => _2; - let mut _3: u32; - let mut _4: bool; - let mut _5: u16; + let mut _3: bool; + let mut _4: u16; scope 2 { } } bb0: { - StorageLive(_5); StorageLive(_4); StorageLive(_3); - _3 = const 65535_u32; - _4 = Le(_2, move _3); + _3 = Le(_2, const 65535_u32); + assume(move _3); StorageDead(_3); - assume(move _4); + _4 = _2 as u16 (IntToInt); + _0 = ShlUnchecked(_1, move _4); StorageDead(_4); - _5 = _2 as u16 (IntToInt); - _0 = ShlUnchecked(_1, move _5); - StorageDead(_5); return; } } diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-abort.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-abort.diff index fa7e5d16e..15b36b284 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-abort.diff @@ -12,7 +12,6 @@ + debug rhs => _4; + let mut _5: i16; + let mut _6: bool; -+ let mut _7: u32; + scope 2 { + } + } @@ -28,10 +27,7 @@ - bb1: { + StorageLive(_5); + StorageLive(_6); -+ StorageLive(_7); -+ _7 = const 32767_u32; -+ _6 = Le(_4, move _7); -+ StorageDead(_7); ++ _6 = Le(_4, const 32767_u32); + assume(move _6); + StorageDead(_6); + _5 = _4 as i16 (IntToInt); diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-unwind.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-unwind.diff index fe5331214..8629f92db 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-unwind.diff @@ -12,7 +12,6 @@ + debug rhs => _4; + let mut _5: i16; + let mut _6: bool; -+ let mut _7: u32; + scope 2 { + } + } @@ -28,10 +27,7 @@ - bb1: { + StorageLive(_5); + StorageLive(_6); -+ StorageLive(_7); -+ _7 = const 32767_u32; -+ _6 = Le(_4, move _7); -+ StorageDead(_7); ++ _6 = Le(_4, const 32767_u32); + assume(move _6); + StorageDead(_6); + _5 = _4 as i16 (IntToInt); diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-abort.mir index 64ea25349..65fa0d956 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-abort.mir @@ -7,25 +7,21 @@ fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 { scope 1 (inlined core::num::<impl i16>::unchecked_shr) { debug self => _1; debug rhs => _2; - let mut _3: u32; - let mut _4: bool; - let mut _5: i16; + let mut _3: bool; + let mut _4: i16; scope 2 { } } bb0: { - StorageLive(_5); StorageLive(_4); StorageLive(_3); - _3 = const 32767_u32; - _4 = Le(_2, move _3); + _3 = Le(_2, const 32767_u32); + assume(move _3); StorageDead(_3); - assume(move _4); + _4 = _2 as i16 (IntToInt); + _0 = ShrUnchecked(_1, move _4); StorageDead(_4); - _5 = _2 as i16 (IntToInt); - _0 = ShrUnchecked(_1, move _5); - StorageDead(_5); return; } } diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-unwind.mir index 64ea25349..65fa0d956 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-unwind.mir @@ -7,25 +7,21 @@ fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 { scope 1 (inlined core::num::<impl i16>::unchecked_shr) { debug self => _1; debug rhs => _2; - let mut _3: u32; - let mut _4: bool; - let mut _5: i16; + let mut _3: bool; + let mut _4: i16; scope 2 { } } bb0: { - StorageLive(_5); StorageLive(_4); StorageLive(_3); - _3 = const 32767_u32; - _4 = Le(_2, move _3); + _3 = Le(_2, const 32767_u32); + assume(move _3); StorageDead(_3); - assume(move _4); + _4 = _2 as i16 (IntToInt); + _0 = ShrUnchecked(_1, move _4); StorageDead(_4); - _5 = _2 as i16 (IntToInt); - _0 = ShrUnchecked(_1, move _5); - StorageDead(_5); return; } } diff --git a/tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff b/tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff index 0aece766b..afcfde09c 100644 --- a/tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff +++ b/tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff @@ -5,7 +5,7 @@ let mut _0: bool; bb0: { -+ Coverage::Counter(1) for /the/src/instrument_coverage.rs:20:1 - 22:2; ++ Coverage::Counter(0) for /the/src/instrument_coverage.rs:20:1 - 22:2; _0 = const true; return; } diff --git a/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff b/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff index 7ec9011a5..e17c6ddc5 100644 --- a/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff +++ b/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff @@ -8,12 +8,12 @@ let mut _3: !; bb0: { -+ Coverage::Counter(1) for /the/src/instrument_coverage.rs:11:1 - 11:11; ++ Coverage::Counter(0) for /the/src/instrument_coverage.rs:11:1 - 11:11; goto -> bb1; } bb1: { -+ Coverage::Expression(4294967295) = 1 + 2 for /the/src/instrument_coverage.rs:12:5 - 13:17; ++ Coverage::Expression(0) = Counter(0) + Counter(1) for /the/src/instrument_coverage.rs:12:5 - 13:17; falseUnwind -> [real: bb2, unwind: bb6]; } @@ -27,15 +27,15 @@ } bb4: { -+ Coverage::Expression(4294967293) = 4294967294 + 0 for /the/src/instrument_coverage.rs:17:1 - 17:2; -+ Coverage::Expression(4294967294) = 4294967295 - 2 for /the/src/instrument_coverage.rs:14:13 - 14:18; ++ Coverage::Expression(2) = Expression(1) + Zero for /the/src/instrument_coverage.rs:17:1 - 17:2; ++ Coverage::Expression(1) = Expression(0) - Counter(1) for /the/src/instrument_coverage.rs:14:13 - 14:18; _0 = const (); StorageDead(_2); return; } bb5: { -+ Coverage::Counter(2) for /the/src/instrument_coverage.rs:15:10 - 15:11; ++ Coverage::Counter(1) for /the/src/instrument_coverage.rs:15:10 - 15:11; _1 = const (); StorageDead(_2); goto -> bb1; diff --git a/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff b/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff index e018563db..ce490e894 100644 --- a/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff +++ b/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff @@ -66,7 +66,7 @@ bb2: { _6 = Shl(move _7, const 1_i32); StorageDead(_7); - _3 = rotate_right::<u32>(_4, _6) -> [return: bb3, unwind unreachable]; + _3 = rotate_right::<u32>(move _4, move _6) -> [return: bb3, unwind unreachable]; } bb3: { diff --git a/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff b/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff index a6bd29e1c..254557b99 100644 --- a/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff @@ -66,7 +66,7 @@ bb2: { _6 = Shl(move _7, const 1_i32); StorageDead(_7); - _3 = rotate_right::<u32>(_4, _6) -> [return: bb3, unwind unreachable]; + _3 = rotate_right::<u32>(move _4, move _6) -> [return: bb3, unwind unreachable]; } bb3: { diff --git a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff index eb03a347a..65f4806aa 100644 --- a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff +++ b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff @@ -47,7 +47,8 @@ bb3 (cleanup): { _2 = move _5; - drop(_5) -> [return: bb8, unwind terminate]; +- drop(_5) -> [return: bb8, unwind terminate]; ++ goto -> bb8; } bb4: { @@ -80,7 +81,7 @@ bb9 (cleanup): { - drop(_1) -> [return: bb10, unwind terminate]; -+ goto -> bb13; ++ goto -> bb12; } bb10 (cleanup): { @@ -88,15 +89,11 @@ + } + + bb11 (cleanup): { -+ unreachable; -+ } -+ -+ bb12 (cleanup): { + drop(_1) -> [return: bb10, unwind terminate]; + } + -+ bb13 (cleanup): { -+ switchInt(_6) -> [0: bb10, otherwise: bb12]; ++ bb12 (cleanup): { ++ switchInt(_6) -> [0: bb10, otherwise: bb11]; } } diff --git a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff index 254658c81..4845fc732 100644 --- a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff +++ b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff @@ -47,7 +47,8 @@ bb3 (cleanup): { _2 = move _5; - drop(_5) -> [return: bb8, unwind terminate]; +- drop(_5) -> [return: bb8, unwind terminate]; ++ goto -> bb8; } bb4: { @@ -80,7 +81,7 @@ bb9 (cleanup): { - drop(_1) -> [return: bb10, unwind terminate]; -+ goto -> bb13; ++ goto -> bb12; } bb10 (cleanup): { @@ -88,15 +89,11 @@ + } + + bb11 (cleanup): { -+ unreachable; -+ } -+ -+ bb12 (cleanup): { + drop(_1) -> [return: bb10, unwind terminate]; + } + -+ bb13 (cleanup): { -+ switchInt(_6) -> [0: bb10, otherwise: bb12]; ++ bb12 (cleanup): { ++ switchInt(_6) -> [0: bb10, otherwise: bb11]; } } diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff index 7c2503f9d..aca7fe95c 100644 --- a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff +++ b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff @@ -54,8 +54,12 @@ } bb4 (cleanup): { ++ _7 = const true; ++ _8 = const true; ++ _9 = const true; _1 = move _3; - drop(_3) -> [return: bb11, unwind terminate]; +- drop(_3) -> [return: bb11, unwind terminate]; ++ goto -> bb11; } bb5: { @@ -86,7 +90,7 @@ bb9: { StorageDead(_2); - drop(_1) -> [return: bb10, unwind: bb12]; -+ goto -> bb19; ++ goto -> bb18; } bb10: { @@ -106,43 +110,39 @@ resume; + } + -+ bb13 (cleanup): { -+ unreachable; -+ } -+ -+ bb14: { ++ bb13: { + _7 = const false; + goto -> bb10; + } + -+ bb15 (cleanup): { ++ bb14 (cleanup): { + goto -> bb12; + } + -+ bb16: { -+ drop(_1) -> [return: bb14, unwind: bb12]; ++ bb15: { ++ drop(_1) -> [return: bb13, unwind: bb12]; + } + -+ bb17 (cleanup): { ++ bb16 (cleanup): { + drop(_1) -> [return: bb12, unwind terminate]; + } + -+ bb18: { ++ bb17: { + _10 = discriminant(_1); -+ switchInt(move _10) -> [0: bb14, otherwise: bb16]; ++ switchInt(move _10) -> [0: bb13, otherwise: bb15]; + } + -+ bb19: { -+ switchInt(_7) -> [0: bb14, otherwise: bb18]; ++ bb18: { ++ switchInt(_7) -> [0: bb13, otherwise: bb17]; + } + -+ bb20 (cleanup): { ++ bb19 (cleanup): { + _11 = discriminant(_1); -+ switchInt(move _11) -> [0: bb15, otherwise: bb17]; ++ switchInt(move _11) -> [0: bb14, otherwise: bb16]; + } + -+ bb21 (cleanup): { -+ switchInt(_7) -> [0: bb12, otherwise: bb20]; ++ bb20 (cleanup): { ++ switchInt(_7) -> [0: bb12, otherwise: bb19]; } } diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff index 4ef3650cd..60ce9cd8a 100644 --- a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff +++ b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff @@ -54,8 +54,12 @@ } bb4 (cleanup): { ++ _7 = const true; ++ _8 = const true; ++ _9 = const true; _1 = move _3; - drop(_3) -> [return: bb11, unwind terminate]; +- drop(_3) -> [return: bb11, unwind terminate]; ++ goto -> bb11; } bb5: { @@ -86,7 +90,7 @@ bb9: { StorageDead(_2); - drop(_1) -> [return: bb10, unwind continue]; -+ goto -> bb19; ++ goto -> bb18; } bb10: { @@ -106,43 +110,39 @@ resume; + } + -+ bb13 (cleanup): { -+ unreachable; -+ } -+ -+ bb14: { ++ bb13: { + _7 = const false; + goto -> bb10; + } + -+ bb15 (cleanup): { ++ bb14 (cleanup): { + goto -> bb12; + } + -+ bb16: { -+ drop(_1) -> [return: bb14, unwind: bb12]; ++ bb15: { ++ drop(_1) -> [return: bb13, unwind: bb12]; + } + -+ bb17 (cleanup): { ++ bb16 (cleanup): { + drop(_1) -> [return: bb12, unwind terminate]; + } + -+ bb18: { ++ bb17: { + _10 = discriminant(_1); -+ switchInt(move _10) -> [0: bb14, otherwise: bb16]; ++ switchInt(move _10) -> [0: bb13, otherwise: bb15]; + } + -+ bb19: { -+ switchInt(_7) -> [0: bb14, otherwise: bb18]; ++ bb18: { ++ switchInt(_7) -> [0: bb13, otherwise: bb17]; + } + -+ bb20 (cleanup): { ++ bb19 (cleanup): { + _11 = discriminant(_1); -+ switchInt(move _11) -> [0: bb15, otherwise: bb17]; ++ switchInt(move _11) -> [0: bb14, otherwise: bb16]; + } + -+ bb21 (cleanup): { -+ switchInt(_7) -> [0: bb12, otherwise: bb20]; ++ bb20 (cleanup): { ++ switchInt(_7) -> [0: bb12, otherwise: bb19]; } } diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff index 1cc44ce06..f61632728 100644 --- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff +++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff @@ -6,48 +6,56 @@ let mut _0: (); let _2: &[T]; let mut _3: &[T; 3]; - let _4: &[T; 3]; - let _5: [T; 3]; + let _4: [T; 3]; + let mut _5: T; let mut _6: T; let mut _7: T; - let mut _8: T; + let mut _8: usize; let mut _9: usize; - let mut _10: usize; - let mut _11: bool; - let mut _15: !; + let mut _10: bool; + let mut _14: !; scope 1 { debug v => _2; + let _11: &T; let _12: &T; let _13: &T; - let _14: &T; scope 2 { - debug v1 => &(*_2)[0 of 3]; - debug v2 => &(*_2)[1 of 3]; - debug v3 => &(*_2)[2 of 3]; + debug v1 => _11; + debug v2 => _12; + debug v3 => _13; } } bb0: { - StorageLive(_2); - StorageLive(_5); - _5 = [_1, _1, _1]; - _4 = &_5; - _2 = _4 as &[T] (PointerCoercion(Unsize)); - _9 = Len((*_2)); - _10 = const 3_usize; -- _11 = Eq(move _9, const 3_usize); -- switchInt(move _11) -> [0: bb1, otherwise: bb2]; + StorageLive(_3); + StorageLive(_4); + _4 = [_1, _1, _1]; + _3 = &_4; + _2 = move _3 as &[T] (PointerCoercion(Unsize)); + StorageDead(_3); + _8 = Len((*_2)); + _9 = const 3_usize; +- _10 = Eq(move _8, const 3_usize); +- switchInt(move _10) -> [0: bb1, otherwise: bb2]; + nop; -+ switchInt(move _9) -> [3: bb2, otherwise: bb1]; ++ switchInt(move _8) -> [3: bb2, otherwise: bb1]; } bb1: { - _15 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind unreachable; + _14 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind unreachable; } bb2: { - StorageDead(_5); - StorageDead(_2); + StorageLive(_11); + _11 = &(*_2)[0 of 3]; + StorageLive(_12); + _12 = &(*_2)[1 of 3]; + StorageLive(_13); + _13 = &(*_2)[2 of 3]; + StorageDead(_13); + StorageDead(_12); + StorageDead(_11); + StorageDead(_4); return; } } diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff index b708f6674..f6c337be1 100644 --- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff +++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff @@ -6,48 +6,56 @@ let mut _0: (); let _2: &[T]; let mut _3: &[T; 3]; - let _4: &[T; 3]; - let _5: [T; 3]; + let _4: [T; 3]; + let mut _5: T; let mut _6: T; let mut _7: T; - let mut _8: T; + let mut _8: usize; let mut _9: usize; - let mut _10: usize; - let mut _11: bool; - let mut _15: !; + let mut _10: bool; + let mut _14: !; scope 1 { debug v => _2; + let _11: &T; let _12: &T; let _13: &T; - let _14: &T; scope 2 { - debug v1 => &(*_2)[0 of 3]; - debug v2 => &(*_2)[1 of 3]; - debug v3 => &(*_2)[2 of 3]; + debug v1 => _11; + debug v2 => _12; + debug v3 => _13; } } bb0: { - StorageLive(_2); - StorageLive(_5); - _5 = [_1, _1, _1]; - _4 = &_5; - _2 = _4 as &[T] (PointerCoercion(Unsize)); - _9 = Len((*_2)); - _10 = const 3_usize; -- _11 = Eq(move _9, const 3_usize); -- switchInt(move _11) -> [0: bb1, otherwise: bb2]; + StorageLive(_3); + StorageLive(_4); + _4 = [_1, _1, _1]; + _3 = &_4; + _2 = move _3 as &[T] (PointerCoercion(Unsize)); + StorageDead(_3); + _8 = Len((*_2)); + _9 = const 3_usize; +- _10 = Eq(move _8, const 3_usize); +- switchInt(move _10) -> [0: bb1, otherwise: bb2]; + nop; -+ switchInt(move _9) -> [3: bb2, otherwise: bb1]; ++ switchInt(move _8) -> [3: bb2, otherwise: bb1]; } bb1: { - _15 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind continue; + _14 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind continue; } bb2: { - StorageDead(_5); - StorageDead(_2); + StorageLive(_11); + _11 = &(*_2)[0 of 3]; + StorageLive(_12); + _12 = &(*_2)[1 of 3]; + StorageLive(_13); + _13 = &(*_2)[2 of 3]; + StorageDead(_13); + StorageDead(_12); + StorageDead(_11); + StorageDead(_4); return; } } diff --git a/tests/mir-opt/issue_99325.main.built.after.mir b/tests/mir-opt/issue_99325.main.built.after.mir index 0fe66d3fb..aef89c7f9 100644 --- a/tests/mir-opt/issue_99325.main.built.after.mir +++ b/tests/mir-opt/issue_99325.main.built.after.mir @@ -1,8 +1,8 @@ // MIR for `main` after built | User Type Annotations -| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserSubsts { substs: [Const { ty: &'static [u8; 4], kind: Branch([Leaf(0x41), Leaf(0x41), Leaf(0x41), Leaf(0x41)]) }], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:10:16: 10:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} -| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserSubsts { substs: [Const { ty: &'static [u8; 4], kind: UnevaluatedConst { def: DefId(0:8 ~ issue_99325[22bb]::main::{constant#1}), substs: [] } }], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:11:16: 11:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} +| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [Const { ty: &'static [u8; 4], kind: Branch([Leaf(0x41), Leaf(0x41), Leaf(0x41), Leaf(0x41)]) }], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:10:16: 10:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} +| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [Const { ty: &'static [u8; 4], kind: UnevaluatedConst { def: DefId(0:8 ~ issue_99325[22bb]::main::{constant#1}), args: [] } }], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:11:16: 11:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} | fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir index 787f9ee09..f8c859418 100644 --- a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir @@ -3,57 +3,56 @@ fn num_to_digit(_1: char) -> u32 { debug num => _1; let mut _0: u32; - let mut _5: std::option::Option<u32>; + let mut _4: std::option::Option<u32>; scope 1 (inlined char::methods::<impl char>::is_digit) { debug self => _1; debug radix => const 8_u32; let _2: std::option::Option<u32>; - let mut _3: &std::option::Option<u32>; + let mut _7: &std::option::Option<u32>; scope 2 (inlined Option::<u32>::is_some) { - debug self => _3; - let mut _4: isize; + debug self => _7; + let mut _3: isize; } } scope 3 (inlined #[track_caller] Option::<u32>::unwrap) { - debug self => _5; - let mut _6: isize; - let mut _7: !; + debug self => _4; + let mut _5: isize; + let mut _6: !; scope 4 { debug val => _0; } } bb0: { - StorageLive(_3); + StorageLive(_7); StorageLive(_2); _2 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> [return: bb1, unwind unreachable]; } bb1: { - _3 = &_2; - _4 = discriminant((*_3)); - StorageDead(_3); + _3 = discriminant(_2); + StorageDead(_7); StorageDead(_2); - switchInt(move _4) -> [1: bb2, otherwise: bb7]; + switchInt(move _3) -> [1: bb2, otherwise: bb7]; } bb2: { - StorageLive(_5); - _5 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> [return: bb3, unwind unreachable]; + StorageLive(_4); + _4 = char::methods::<impl char>::to_digit(move _1, const 8_u32) -> [return: bb3, unwind unreachable]; } bb3: { - _6 = discriminant(_5); - switchInt(move _6) -> [0: bb4, 1: bb5, otherwise: bb6]; + _5 = discriminant(_4); + switchInt(move _5) -> [0: bb4, 1: bb5, otherwise: bb6]; } bb4: { - _7 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind unreachable; + _6 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind unreachable; } bb5: { - _0 = move ((_5 as Some).0: u32); - StorageDead(_5); + _0 = move ((_4 as Some).0: u32); + StorageDead(_4); goto -> bb8; } diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir index 43a1a1eed..df7392edc 100644 --- a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir @@ -3,57 +3,56 @@ fn num_to_digit(_1: char) -> u32 { debug num => _1; let mut _0: u32; - let mut _5: std::option::Option<u32>; + let mut _4: std::option::Option<u32>; scope 1 (inlined char::methods::<impl char>::is_digit) { debug self => _1; debug radix => const 8_u32; let _2: std::option::Option<u32>; - let mut _3: &std::option::Option<u32>; + let mut _7: &std::option::Option<u32>; scope 2 (inlined Option::<u32>::is_some) { - debug self => _3; - let mut _4: isize; + debug self => _7; + let mut _3: isize; } } scope 3 (inlined #[track_caller] Option::<u32>::unwrap) { - debug self => _5; - let mut _6: isize; - let mut _7: !; + debug self => _4; + let mut _5: isize; + let mut _6: !; scope 4 { debug val => _0; } } bb0: { - StorageLive(_3); + StorageLive(_7); StorageLive(_2); _2 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> [return: bb1, unwind continue]; } bb1: { - _3 = &_2; - _4 = discriminant((*_3)); - StorageDead(_3); + _3 = discriminant(_2); + StorageDead(_7); StorageDead(_2); - switchInt(move _4) -> [1: bb2, otherwise: bb7]; + switchInt(move _3) -> [1: bb2, otherwise: bb7]; } bb2: { - StorageLive(_5); - _5 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> [return: bb3, unwind continue]; + StorageLive(_4); + _4 = char::methods::<impl char>::to_digit(move _1, const 8_u32) -> [return: bb3, unwind continue]; } bb3: { - _6 = discriminant(_5); - switchInt(move _6) -> [0: bb4, 1: bb5, otherwise: bb6]; + _5 = discriminant(_4); + switchInt(move _5) -> [0: bb4, 1: bb5, otherwise: bb6]; } bb4: { - _7 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind continue; + _6 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind continue; } bb5: { - _0 = move ((_5 as Some).0: u32); - StorageDead(_5); + _0 = move ((_4 as Some).0: u32); + StorageDead(_4); goto -> bb8; } diff --git a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir index 70461b445..8304cb45b 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir @@ -7,28 +7,24 @@ fn checked_shl(_1: u32, _2: u32) -> Option<u32> { scope 1 (inlined core::num::<impl u32>::checked_shl) { debug self => _1; debug rhs => _2; - let mut _7: (u32, bool); - let _8: u32; - let _9: bool; - let mut _10: bool; + let mut _6: bool; scope 2 { - debug a => _8; - debug b => _9; + debug a => _4; + debug b => _5; } scope 3 (inlined core::num::<impl u32>::overflowing_shl) { debug self => _1; debug rhs => _2; - let mut _5: u32; - let mut _6: bool; + let mut _4: u32; + let mut _5: bool; scope 4 (inlined core::num::<impl u32>::wrapping_shl) { debug self => _1; debug rhs => _2; let mut _3: u32; - let mut _4: u32; scope 5 { scope 6 (inlined core::num::<impl u32>::unchecked_shl) { debug self => _1; - debug rhs => _4; + debug rhs => _3; scope 7 { } } @@ -38,35 +34,23 @@ fn checked_shl(_1: u32, _2: u32) -> Option<u32> { } bb0: { - StorageLive(_8); - StorageLive(_9); - StorageLive(_7); - StorageLive(_5); StorageLive(_4); + StorageLive(_5); StorageLive(_3); - _3 = const 31_u32; - _4 = BitAnd(_2, move _3); + _3 = BitAnd(_2, const 31_u32); + _4 = ShlUnchecked(_1, _3); StorageDead(_3); - _5 = ShlUnchecked(_1, _4); - StorageDead(_4); + _5 = Ge(_2, const _); StorageLive(_6); - _6 = Ge(_2, const _); - _7 = (move _5, move _6); - StorageDead(_6); - StorageDead(_5); - _8 = (_7.0: u32); - _9 = (_7.1: bool); - StorageDead(_7); - StorageLive(_10); - _10 = unlikely(_9) -> [return: bb1, unwind unreachable]; + _6 = unlikely(move _5) -> [return: bb1, unwind unreachable]; } bb1: { - switchInt(move _10) -> [0: bb2, otherwise: bb3]; + switchInt(move _6) -> [0: bb2, otherwise: bb3]; } bb2: { - _0 = Option::<u32>::Some(_8); + _0 = Option::<u32>::Some(_4); goto -> bb4; } @@ -76,9 +60,9 @@ fn checked_shl(_1: u32, _2: u32) -> Option<u32> { } bb4: { - StorageDead(_10); - StorageDead(_9); - StorageDead(_8); + StorageDead(_6); + StorageDead(_5); + StorageDead(_4); return; } } diff --git a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir index 98c267e8e..b2ea96f03 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir @@ -8,42 +8,41 @@ fn step_forward(_1: u32, _2: usize) -> u32 { debug start => _1; debug n => _2; let _3: std::option::Option<u32>; - let mut _4: &std::option::Option<u32>; - let mut _7: bool; - let mut _8: u32; + let mut _6: bool; + let mut _7: u32; + let mut _8: &std::option::Option<u32>; scope 2 { } scope 3 (inlined Option::<u32>::is_none) { - debug self => _4; - let mut _6: bool; + debug self => _8; + let mut _5: bool; scope 4 (inlined Option::<u32>::is_some) { - debug self => _4; - let mut _5: isize; + debug self => _8; + let mut _4: isize; } } scope 5 (inlined core::num::<impl u32>::wrapping_add) { debug self => _1; - debug rhs => _8; + debug rhs => _7; } } bb0: { - StorageLive(_7); - StorageLive(_4); + StorageLive(_6); + StorageLive(_8); StorageLive(_3); _3 = <u32 as Step>::forward_checked(_1, _2) -> [return: bb1, unwind continue]; } bb1: { - _4 = &_3; - StorageLive(_6); - _5 = discriminant((*_4)); - _6 = Eq(_5, const 1_isize); - _7 = Not(move _6); - StorageDead(_6); + StorageLive(_5); + _4 = discriminant(_3); + _5 = Eq(_4, const 1_isize); + _6 = Not(move _5); + StorageDead(_5); StorageDead(_3); - StorageDead(_4); - switchInt(move _7) -> [0: bb3, otherwise: bb2]; + StorageDead(_8); + switchInt(move _6) -> [0: bb3, otherwise: bb2]; } bb2: { @@ -51,11 +50,11 @@ fn step_forward(_1: u32, _2: usize) -> u32 { } bb3: { + StorageDead(_6); + StorageLive(_7); + _7 = _2 as u32 (IntToInt); + _0 = Add(_1, _7); StorageDead(_7); - StorageLive(_8); - _8 = _2 as u32 (IntToInt); - _0 = Add(_1, _8); - StorageDead(_8); return; } } diff --git a/tests/mir-opt/pre-codegen/intrinsics.f_u64.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/intrinsics.f_u64.PreCodegen.after.mir index 66acbbbb2..174fb2c0c 100644 --- a/tests/mir-opt/pre-codegen/intrinsics.f_u64.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/intrinsics.f_u64.PreCodegen.after.mir @@ -2,22 +2,18 @@ fn f_u64() -> () { let mut _0: (); - let mut _1: u64; scope 1 (inlined f_dispatch::<u64>) { debug t => const 0_u64; - let _2: (); + let _1: (); scope 2 (inlined std::mem::size_of::<u64>) { } } bb0: { - StorageLive(_1); - _1 = const 0_u64; - _2 = f_non_zst::<u64>(move _1) -> [return: bb1, unwind unreachable]; + _1 = f_non_zst::<u64>(const 0_u64) -> [return: bb1, unwind unreachable]; } bb1: { - StorageDead(_1); return; } } diff --git a/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir index 3b49cb711..940b9ae11 100644 --- a/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir @@ -7,20 +7,20 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> () let mut _3: std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>; let mut _4: std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>; let mut _5: std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>; - let mut _6: &mut std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>; - let mut _9: std::option::Option<U>; - let mut _10: isize; - let _12: (); + let mut _8: std::option::Option<U>; + let mut _9: isize; + let _11: (); + let mut _12: &mut std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>; scope 1 { debug iter => _5; - let _11: U; + let _10: U; scope 2 { - debug x => _11; + debug x => _10; } scope 4 (inlined <FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>> as Iterator>::next) { - debug self => _6; - let mut _7: &mut impl Iterator<Item = T>; - let mut _8: &mut impl Fn(T) -> Option<U>; + debug self => _12; + let mut _6: &mut impl Iterator<Item = T>; + let mut _7: &mut impl Fn(T) -> Option<U>; } } scope 3 (inlined <FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>> as IntoIterator>::into_iter) { @@ -42,24 +42,23 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> () } bb2: { - StorageLive(_9); - _6 = &mut _5; - StorageLive(_7); - _7 = &mut ((*_6).0: impl Iterator<Item = T>); StorageLive(_8); - _8 = &mut ((*_6).1: impl Fn(T) -> Option<U>); - _9 = <impl Iterator<Item = T> as Iterator>::find_map::<U, &mut impl Fn(T) -> Option<U>>(move _7, move _8) -> [return: bb3, unwind: bb9]; + StorageLive(_6); + _6 = &mut (_5.0: impl Iterator<Item = T>); + StorageLive(_7); + _7 = &mut (_5.1: impl Fn(T) -> Option<U>); + _8 = <impl Iterator<Item = T> as Iterator>::find_map::<U, &mut impl Fn(T) -> Option<U>>(move _6, move _7) -> [return: bb3, unwind: bb9]; } bb3: { - StorageDead(_8); StorageDead(_7); - _10 = discriminant(_9); - switchInt(move _10) -> [0: bb4, 1: bb6, otherwise: bb8]; + StorageDead(_6); + _9 = discriminant(_8); + switchInt(move _9) -> [0: bb4, 1: bb6, otherwise: bb8]; } bb4: { - StorageDead(_9); + StorageDead(_8); drop(_5) -> [return: bb5, unwind continue]; } @@ -70,12 +69,12 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> () } bb6: { - _11 = move ((_9 as Some).0: U); - _12 = opaque::<U>(move _11) -> [return: bb7, unwind: bb9]; + _10 = move ((_8 as Some).0: U); + _11 = opaque::<U>(move _10) -> [return: bb7, unwind: bb9]; } bb7: { - StorageDead(_9); + StorageDead(_8); goto -> bb2; } diff --git a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir index 40bb3a37c..2e51faeba 100644 --- a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir @@ -6,35 +6,35 @@ fn int_range(_1: usize, _2: usize) -> () { let mut _0: (); let mut _3: std::ops::Range<usize>; let mut _4: std::ops::Range<usize>; - let mut _5: &mut std::ops::Range<usize>; - let mut _11: std::option::Option<usize>; - let mut _14: isize; - let _16: (); + let mut _8: std::option::Option<usize>; + let mut _11: isize; + let _13: (); + let mut _14: &mut std::ops::Range<usize>; scope 1 { debug iter => _4; - let _15: usize; + let _12: usize; scope 2 { - debug i => _15; + debug i => _12; } scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) { - debug self => _5; + debug self => _14; scope 5 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) { - debug self => _5; - let mut _6: &usize; - let mut _7: &usize; - let mut _10: bool; - let _12: usize; - let mut _13: usize; + debug self => _14; + let mut _7: bool; + let _9: usize; + let mut _10: usize; + let mut _15: &usize; + let mut _16: &usize; scope 6 { - debug old => _12; + debug old => _9; scope 7 { } } scope 8 (inlined cmp::impls::<impl PartialOrd for usize>::lt) { - debug self => _6; - debug other => _7; - let mut _8: usize; - let mut _9: usize; + debug self => _15; + debug other => _16; + let mut _5: usize; + let mut _6: usize; } } } @@ -51,64 +51,61 @@ fn int_range(_1: usize, _2: usize) -> () { } bb1: { - StorageLive(_11); - _5 = &mut _4; - StorageLive(_12); - StorageLive(_10); - StorageLive(_6); - _6 = &((*_5).0: usize); - StorageLive(_7); - _7 = &((*_5).1: usize); StorageLive(_8); - _8 = (*_6); StorageLive(_9); - _9 = (*_7); - _10 = Lt(move _8, move _9); - StorageDead(_9); - StorageDead(_8); - StorageDead(_7); + StorageLive(_7); + StorageLive(_15); + StorageLive(_16); + StorageLive(_5); + _5 = (_4.0: usize); + StorageLive(_6); + _6 = (_4.1: usize); + _7 = Lt(move _5, move _6); StorageDead(_6); - switchInt(move _10) -> [0: bb2, otherwise: bb3]; + StorageDead(_5); + StorageDead(_16); + StorageDead(_15); + switchInt(move _7) -> [0: bb2, otherwise: bb3]; } bb2: { - _11 = Option::<usize>::None; + _8 = Option::<usize>::None; goto -> bb5; } bb3: { - _12 = ((*_5).0: usize); - StorageLive(_13); - _13 = <usize as Step>::forward_unchecked(_12, const 1_usize) -> [return: bb4, unwind continue]; + _9 = (_4.0: usize); + StorageLive(_10); + _10 = <usize as Step>::forward_unchecked(_9, const 1_usize) -> [return: bb4, unwind continue]; } bb4: { - ((*_5).0: usize) = move _13; - StorageDead(_13); - _11 = Option::<usize>::Some(_12); + (_4.0: usize) = move _10; + StorageDead(_10); + _8 = Option::<usize>::Some(_9); goto -> bb5; } bb5: { - StorageDead(_10); - StorageDead(_12); - _14 = discriminant(_11); - switchInt(move _14) -> [0: bb6, 1: bb7, otherwise: bb9]; + StorageDead(_7); + StorageDead(_9); + _11 = discriminant(_8); + switchInt(move _11) -> [0: bb6, 1: bb7, otherwise: bb9]; } bb6: { - StorageDead(_11); + StorageDead(_8); StorageDead(_4); return; } bb7: { - _15 = ((_11 as Some).0: usize); - _16 = opaque::<usize>(_15) -> [return: bb8, unwind continue]; + _12 = ((_8 as Some).0: usize); + _13 = opaque::<usize>(move _12) -> [return: bb8, unwind continue]; } bb8: { - StorageDead(_11); + StorageDead(_8); goto -> bb1; } diff --git a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir index e4e1d052e..261416036 100644 --- a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir @@ -38,11 +38,13 @@ fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () { bb2: { StorageLive(_7); + StorageLive(_6); _6 = &mut _5; - _7 = <Map<impl Iterator<Item = T>, impl Fn(T) -> U> as Iterator>::next(_6) -> [return: bb3, unwind: bb9]; + _7 = <Map<impl Iterator<Item = T>, impl Fn(T) -> U> as Iterator>::next(move _6) -> [return: bb3, unwind: bb9]; } bb3: { + StorageDead(_6); _8 = discriminant(_7); switchInt(move _8) -> [0: bb4, 1: bb6, otherwise: bb8]; } diff --git a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir index 1b5f2a088..8eff46fb9 100644 --- a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir @@ -30,11 +30,13 @@ fn vec_move(_1: Vec<impl Sized>) -> () { bb2: { StorageLive(_5); + StorageLive(_4); _4 = &mut _3; - _5 = <std::vec::IntoIter<impl Sized> as Iterator>::next(_4) -> [return: bb3, unwind: bb9]; + _5 = <std::vec::IntoIter<impl Sized> as Iterator>::next(move _4) -> [return: bb3, unwind: bb9]; } bb3: { + StorageDead(_4); _6 = discriminant(_5); switchInt(move _6) -> [0: bb4, 1: bb6, otherwise: bb8]; } diff --git a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir index f8f4f5b99..26919dd98 100644 --- a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir @@ -7,47 +7,27 @@ fn mem_replace(_1: &mut u32, _2: u32) -> u32 { scope 1 (inlined std::mem::replace::<u32>) { debug dest => _1; debug src => _2; - let mut _3: *const u32; - let mut _4: *mut u32; scope 2 { scope 3 { debug result => _0; - scope 7 (inlined std::ptr::write::<u32>) { - debug dst => _4; + scope 6 (inlined std::ptr::write::<u32>) { + debug dst => _1; debug src => _2; - let mut _6: *mut u32; - scope 8 { - scope 9 (inlined std::ptr::write::runtime::<u32>) { - debug dst => _6; - } + scope 7 { } } } scope 4 (inlined std::ptr::read::<u32>) { - debug src => _3; - let mut _5: *const u32; + debug src => _1; scope 5 { - scope 6 (inlined std::ptr::read::runtime::<u32>) { - debug src => _5; - } } } } } bb0: { - StorageLive(_3); - _3 = &raw const (*_1); - StorageLive(_5); - _0 = (*_3); - StorageDead(_5); - StorageDead(_3); - StorageLive(_4); - _4 = &raw mut (*_1); - StorageLive(_6); - (*_4) = _2; - StorageDead(_6); - StorageDead(_4); + _0 = (*_1); + (*_1) = _2; return; } } diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir index 2344a3c0f..d76b46bdd 100644 --- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir @@ -7,37 +7,37 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { let mut _0: (); let mut _4: std::ops::Range<u32>; let mut _5: std::ops::Range<u32>; - let mut _6: &mut std::ops::Range<u32>; - let mut _12: std::option::Option<u32>; - let mut _15: isize; - let mut _17: &impl Fn(u32); - let mut _18: (u32,); - let _19: (); + let mut _9: std::option::Option<u32>; + let mut _12: isize; + let mut _14: &impl Fn(u32); + let mut _15: (u32,); + let _16: (); + let mut _17: &mut std::ops::Range<u32>; scope 1 { debug iter => _5; - let _16: u32; + let _13: u32; scope 2 { - debug x => _16; + debug x => _13; } scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) { - debug self => _6; + debug self => _17; scope 5 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) { - debug self => _6; - let mut _7: &u32; - let mut _8: &u32; - let mut _11: bool; - let _13: u32; - let mut _14: u32; + debug self => _17; + let mut _8: bool; + let _10: u32; + let mut _11: u32; + let mut _18: &u32; + let mut _19: &u32; scope 6 { - debug old => _13; + debug old => _10; scope 7 { } } scope 8 (inlined cmp::impls::<impl PartialOrd for u32>::lt) { - debug self => _7; - debug other => _8; - let mut _9: u32; - let mut _10: u32; + debug self => _18; + debug other => _19; + let mut _6: u32; + let mut _7: u32; } } } @@ -54,53 +54,50 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { } bb1: { - StorageLive(_12); - _6 = &mut _5; - StorageLive(_13); - StorageLive(_11); - StorageLive(_7); - _7 = &((*_6).0: u32); - StorageLive(_8); - _8 = &((*_6).1: u32); StorageLive(_9); - _9 = (*_7); StorageLive(_10); - _10 = (*_8); - _11 = Lt(move _9, move _10); - StorageDead(_10); - StorageDead(_9); - StorageDead(_8); + StorageLive(_8); + StorageLive(_18); + StorageLive(_19); + StorageLive(_6); + _6 = (_5.0: u32); + StorageLive(_7); + _7 = (_5.1: u32); + _8 = Lt(move _6, move _7); StorageDead(_7); - switchInt(move _11) -> [0: bb2, otherwise: bb3]; + StorageDead(_6); + StorageDead(_19); + StorageDead(_18); + switchInt(move _8) -> [0: bb2, otherwise: bb3]; } bb2: { - _12 = Option::<u32>::None; + _9 = Option::<u32>::None; goto -> bb5; } bb3: { - _13 = ((*_6).0: u32); - StorageLive(_14); - _14 = <u32 as Step>::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind unreachable]; + _10 = (_5.0: u32); + StorageLive(_11); + _11 = <u32 as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind unreachable]; } bb4: { - ((*_6).0: u32) = move _14; - StorageDead(_14); - _12 = Option::<u32>::Some(_13); + (_5.0: u32) = move _11; + StorageDead(_11); + _9 = Option::<u32>::Some(_10); goto -> bb5; } bb5: { - StorageDead(_11); - StorageDead(_13); - _15 = discriminant(_12); - switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb10]; + StorageDead(_8); + StorageDead(_10); + _12 = discriminant(_9); + switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb10]; } bb6: { - StorageDead(_12); + StorageDead(_9); StorageDead(_5); drop(_3) -> [return: bb7, unwind unreachable]; } @@ -110,18 +107,18 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { } bb8: { - _16 = ((_12 as Some).0: u32); - StorageLive(_17); - _17 = &_3; - StorageLive(_18); - _18 = (_16,); - _19 = <impl Fn(u32) as Fn<(u32,)>>::call(move _17, move _18) -> [return: bb9, unwind unreachable]; + _13 = ((_9 as Some).0: u32); + StorageLive(_14); + _14 = &_3; + StorageLive(_15); + _15 = (_13,); + _16 = <impl Fn(u32) as Fn<(u32,)>>::call(move _14, move _15) -> [return: bb9, unwind unreachable]; } bb9: { - StorageDead(_18); - StorageDead(_17); - StorageDead(_12); + StorageDead(_15); + StorageDead(_14); + StorageDead(_9); goto -> bb1; } diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir index fbe16dc3c..4d7c017da 100644 --- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir @@ -7,37 +7,37 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { let mut _0: (); let mut _4: std::ops::Range<u32>; let mut _5: std::ops::Range<u32>; - let mut _6: &mut std::ops::Range<u32>; - let mut _12: std::option::Option<u32>; - let mut _15: isize; - let mut _17: &impl Fn(u32); - let mut _18: (u32,); - let _19: (); + let mut _9: std::option::Option<u32>; + let mut _12: isize; + let mut _14: &impl Fn(u32); + let mut _15: (u32,); + let _16: (); + let mut _17: &mut std::ops::Range<u32>; scope 1 { debug iter => _5; - let _16: u32; + let _13: u32; scope 2 { - debug x => _16; + debug x => _13; } scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) { - debug self => _6; + debug self => _17; scope 5 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) { - debug self => _6; - let mut _7: &u32; - let mut _8: &u32; - let mut _11: bool; - let _13: u32; - let mut _14: u32; + debug self => _17; + let mut _8: bool; + let _10: u32; + let mut _11: u32; + let mut _18: &u32; + let mut _19: &u32; scope 6 { - debug old => _13; + debug old => _10; scope 7 { } } scope 8 (inlined cmp::impls::<impl PartialOrd for u32>::lt) { - debug self => _7; - debug other => _8; - let mut _9: u32; - let mut _10: u32; + debug self => _18; + debug other => _19; + let mut _6: u32; + let mut _7: u32; } } } @@ -54,53 +54,50 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { } bb1: { - StorageLive(_12); - _6 = &mut _5; - StorageLive(_13); - StorageLive(_11); - StorageLive(_7); - _7 = &((*_6).0: u32); - StorageLive(_8); - _8 = &((*_6).1: u32); StorageLive(_9); - _9 = (*_7); StorageLive(_10); - _10 = (*_8); - _11 = Lt(move _9, move _10); - StorageDead(_10); - StorageDead(_9); - StorageDead(_8); + StorageLive(_8); + StorageLive(_18); + StorageLive(_19); + StorageLive(_6); + _6 = (_5.0: u32); + StorageLive(_7); + _7 = (_5.1: u32); + _8 = Lt(move _6, move _7); StorageDead(_7); - switchInt(move _11) -> [0: bb2, otherwise: bb3]; + StorageDead(_6); + StorageDead(_19); + StorageDead(_18); + switchInt(move _8) -> [0: bb2, otherwise: bb3]; } bb2: { - _12 = Option::<u32>::None; + _9 = Option::<u32>::None; goto -> bb5; } bb3: { - _13 = ((*_6).0: u32); - StorageLive(_14); - _14 = <u32 as Step>::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind: bb11]; + _10 = (_5.0: u32); + StorageLive(_11); + _11 = <u32 as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind: bb11]; } bb4: { - ((*_6).0: u32) = move _14; - StorageDead(_14); - _12 = Option::<u32>::Some(_13); + (_5.0: u32) = move _11; + StorageDead(_11); + _9 = Option::<u32>::Some(_10); goto -> bb5; } bb5: { - StorageDead(_11); - StorageDead(_13); - _15 = discriminant(_12); - switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb10]; + StorageDead(_8); + StorageDead(_10); + _12 = discriminant(_9); + switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb10]; } bb6: { - StorageDead(_12); + StorageDead(_9); StorageDead(_5); drop(_3) -> [return: bb7, unwind continue]; } @@ -110,18 +107,18 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { } bb8: { - _16 = ((_12 as Some).0: u32); - StorageLive(_17); - _17 = &_3; - StorageLive(_18); - _18 = (_16,); - _19 = <impl Fn(u32) as Fn<(u32,)>>::call(move _17, move _18) -> [return: bb9, unwind: bb11]; + _13 = ((_9 as Some).0: u32); + StorageLive(_14); + _14 = &_3; + StorageLive(_15); + _15 = (_13,); + _16 = <impl Fn(u32) as Fn<(u32,)>>::call(move _14, move _15) -> [return: bb9, unwind: bb11]; } bb9: { - StorageDead(_18); - StorageDead(_17); - StorageDead(_12); + StorageDead(_15); + StorageDead(_14); + StorageDead(_9); goto -> bb1; } diff --git a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir index 9737c9a87..1b23e4213 100644 --- a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir @@ -40,11 +40,13 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { bb1: { StorageLive(_7); + StorageLive(_6); _6 = &mut _5; - _7 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(_6) -> [return: bb2, unwind unreachable]; + _7 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(move _6) -> [return: bb2, unwind unreachable]; } bb2: { + StorageDead(_6); _8 = discriminant(_7); switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb7]; } diff --git a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir index 04d6da1d9..bbab4e47a 100644 --- a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir @@ -40,11 +40,13 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { bb1: { StorageLive(_7); + StorageLive(_6); _6 = &mut _5; - _7 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(_6) -> [return: bb2, unwind: bb8]; + _7 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(move _6) -> [return: bb2, unwind: bb8]; } bb2: { + StorageDead(_6); _8 = discriminant(_7); switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb7]; } diff --git a/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-abort.mir index 0a71b6b2c..b0f475b4d 100644 --- a/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-abort.mir @@ -8,7 +8,7 @@ fn range_inclusive_iter_next(_1: &mut RangeInclusive<u32>) -> Option<u32> { } bb0: { - _0 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(_1) -> [return: bb1, unwind unreachable]; + _0 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(move _1) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir index fd565fe75..663ec229f 100644 --- a/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir @@ -8,7 +8,7 @@ fn range_inclusive_iter_next(_1: &mut RangeInclusive<u32>) -> Option<u32> { } bb0: { - _0 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(_1) -> [return: bb1, unwind continue]; + _0 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(move _1) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir index 1dfd00bf3..7360aa3e6 100644 --- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir @@ -7,42 +7,40 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> { debug self => _1; scope 2 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) { debug self => _1; - let mut _2: &u32; - let mut _3: &u32; - let mut _6: bool; - let _7: u32; - let mut _8: u32; + let mut _4: bool; + let _5: u32; + let mut _6: u32; + let mut _7: &u32; + let mut _8: &u32; scope 3 { - debug old => _7; + debug old => _5; scope 4 { } } scope 5 (inlined cmp::impls::<impl PartialOrd for u32>::lt) { - debug self => _2; - debug other => _3; - let mut _4: u32; - let mut _5: u32; + debug self => _7; + debug other => _8; + let mut _2: u32; + let mut _3: u32; } } } bb0: { + StorageLive(_5); + StorageLive(_4); StorageLive(_7); - StorageLive(_6); + StorageLive(_8); StorageLive(_2); - _2 = &((*_1).0: u32); + _2 = ((*_1).0: u32); StorageLive(_3); - _3 = &((*_1).1: u32); - StorageLive(_4); - _4 = (*_2); - StorageLive(_5); - _5 = (*_3); - _6 = Lt(move _4, move _5); - StorageDead(_5); - StorageDead(_4); + _3 = ((*_1).1: u32); + _4 = Lt(move _2, move _3); StorageDead(_3); StorageDead(_2); - switchInt(move _6) -> [0: bb1, otherwise: bb2]; + StorageDead(_8); + StorageDead(_7); + switchInt(move _4) -> [0: bb1, otherwise: bb2]; } bb1: { @@ -51,21 +49,21 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> { } bb2: { - _7 = ((*_1).0: u32); - StorageLive(_8); - _8 = <u32 as Step>::forward_unchecked(_7, const 1_usize) -> [return: bb3, unwind unreachable]; + _5 = ((*_1).0: u32); + StorageLive(_6); + _6 = <u32 as Step>::forward_unchecked(_5, const 1_usize) -> [return: bb3, unwind unreachable]; } bb3: { - ((*_1).0: u32) = move _8; - StorageDead(_8); - _0 = Option::<u32>::Some(_7); + ((*_1).0: u32) = move _6; + StorageDead(_6); + _0 = Option::<u32>::Some(_5); goto -> bb4; } bb4: { - StorageDead(_6); - StorageDead(_7); + StorageDead(_4); + StorageDead(_5); return; } } diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir index 65870f693..61957082d 100644 --- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir @@ -7,42 +7,40 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> { debug self => _1; scope 2 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) { debug self => _1; - let mut _2: &u32; - let mut _3: &u32; - let mut _6: bool; - let _7: u32; - let mut _8: u32; + let mut _4: bool; + let _5: u32; + let mut _6: u32; + let mut _7: &u32; + let mut _8: &u32; scope 3 { - debug old => _7; + debug old => _5; scope 4 { } } scope 5 (inlined cmp::impls::<impl PartialOrd for u32>::lt) { - debug self => _2; - debug other => _3; - let mut _4: u32; - let mut _5: u32; + debug self => _7; + debug other => _8; + let mut _2: u32; + let mut _3: u32; } } } bb0: { + StorageLive(_5); + StorageLive(_4); StorageLive(_7); - StorageLive(_6); + StorageLive(_8); StorageLive(_2); - _2 = &((*_1).0: u32); + _2 = ((*_1).0: u32); StorageLive(_3); - _3 = &((*_1).1: u32); - StorageLive(_4); - _4 = (*_2); - StorageLive(_5); - _5 = (*_3); - _6 = Lt(move _4, move _5); - StorageDead(_5); - StorageDead(_4); + _3 = ((*_1).1: u32); + _4 = Lt(move _2, move _3); StorageDead(_3); StorageDead(_2); - switchInt(move _6) -> [0: bb1, otherwise: bb2]; + StorageDead(_8); + StorageDead(_7); + switchInt(move _4) -> [0: bb1, otherwise: bb2]; } bb1: { @@ -51,21 +49,21 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> { } bb2: { - _7 = ((*_1).0: u32); - StorageLive(_8); - _8 = <u32 as Step>::forward_unchecked(_7, const 1_usize) -> [return: bb3, unwind continue]; + _5 = ((*_1).0: u32); + StorageLive(_6); + _6 = <u32 as Step>::forward_unchecked(_5, const 1_usize) -> [return: bb3, unwind continue]; } bb3: { - ((*_1).0: u32) = move _8; - StorageDead(_8); - _0 = Option::<u32>::Some(_7); + ((*_1).0: u32) = move _6; + StorageDead(_6); + _0 = Option::<u32>::Some(_5); goto -> bb4; } bb4: { - StorageDead(_6); - StorageDead(_7); + StorageDead(_4); + StorageDead(_5); return; } } diff --git a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir index df45b1589..68d78f743 100644 --- a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir @@ -3,24 +3,21 @@ fn ezmap(_1: Option<i32>) -> Option<i32> { debug x => _1; let mut _0: std::option::Option<i32>; - let mut _5: i32; scope 1 (inlined map::<i32, i32, [closure@$DIR/simple_option_map.rs:18:12: 18:15]>) { debug slf => _1; debug f => const ZeroSized: [closure@$DIR/simple_option_map.rs:18:12: 18:15]; let mut _2: isize; let _3: i32; - let mut _4: (i32,); - let mut _6: i32; + let mut _4: i32; scope 2 { debug x => _3; scope 3 (inlined ezmap::{closure#0}) { - debug n => _5; + debug n => _3; } } } bb0: { - StorageLive(_3); _2 = discriminant(_1); switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb4]; } @@ -32,21 +29,14 @@ fn ezmap(_1: Option<i32>) -> Option<i32> { bb2: { _3 = ((_1 as Some).0: i32); - StorageLive(_6); StorageLive(_4); - _4 = (move _3,); - StorageLive(_5); - _5 = move (_4.0: i32); - _6 = Add(_5, const 1_i32); - StorageDead(_5); + _4 = Add(_3, const 1_i32); + _0 = Option::<i32>::Some(move _4); StorageDead(_4); - _0 = Option::<i32>::Some(move _6); - StorageDead(_6); goto -> bb3; } bb3: { - StorageDead(_3); return; } diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir index 499bee2ae..1488779f9 100644 --- a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir @@ -10,75 +10,75 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2 let _8: &usize; let mut _9: &(usize, usize, usize, usize); let _10: &usize; - let mut _11: &&usize; - let _12: &usize; - let mut _13: &&usize; - let mut _18: bool; - let mut _19: bool; - let mut _20: &&usize; - let _21: &usize; - let mut _22: &&usize; - let mut _27: bool; - let mut _28: &&usize; - let _29: &usize; - let mut _30: &&usize; - let mut _35: bool; + let _11: &usize; + let mut _16: bool; + let mut _17: bool; + let _18: &usize; + let mut _23: bool; + let _24: &usize; + let mut _29: bool; + let mut _30: bool; + let _31: &usize; let mut _36: bool; let mut _37: &&usize; - let _38: &usize; + let mut _38: &&usize; let mut _39: &&usize; - let mut _44: bool; + let mut _40: &&usize; + let mut _41: &&usize; + let mut _42: &&usize; + let mut _43: &&usize; + let mut _44: &&usize; scope 1 { debug a => _4; debug b => _6; debug c => _8; debug d => _10; scope 2 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { - debug self => _11; - debug other => _13; - let mut _14: &usize; - let mut _15: &usize; + debug self => _37; + debug other => _38; + let mut _12: &usize; + let mut _13: &usize; scope 3 (inlined cmp::impls::<impl PartialOrd for usize>::le) { - debug self => _14; - debug other => _15; - let mut _16: usize; - let mut _17: usize; + debug self => _12; + debug other => _13; + let mut _14: usize; + let mut _15: usize; } } scope 4 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { - debug self => _28; - debug other => _30; - let mut _31: &usize; - let mut _32: &usize; + debug self => _41; + debug other => _42; + let mut _25: &usize; + let mut _26: &usize; scope 5 (inlined cmp::impls::<impl PartialOrd for usize>::le) { - debug self => _31; - debug other => _32; - let mut _33: usize; - let mut _34: usize; + debug self => _25; + debug other => _26; + let mut _27: usize; + let mut _28: usize; } } scope 6 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { - debug self => _20; - debug other => _22; - let mut _23: &usize; - let mut _24: &usize; + debug self => _39; + debug other => _40; + let mut _19: &usize; + let mut _20: &usize; scope 7 (inlined cmp::impls::<impl PartialOrd for usize>::le) { - debug self => _23; - debug other => _24; - let mut _25: usize; - let mut _26: usize; + debug self => _19; + debug other => _20; + let mut _21: usize; + let mut _22: usize; } } scope 8 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { - debug self => _37; - debug other => _39; - let mut _40: &usize; - let mut _41: &usize; + debug self => _43; + debug other => _44; + let mut _32: &usize; + let mut _33: &usize; scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::le) { - debug self => _40; - debug other => _41; - let mut _42: usize; - let mut _43: usize; + debug self => _32; + debug other => _33; + let mut _34: usize; + let mut _35: usize; } } } @@ -96,121 +96,113 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2 StorageLive(_10); _9 = deref_copy (*_2); _10 = &((*_9).3: usize); - StorageLive(_19); - StorageLive(_18); - StorageLive(_11); - _11 = &_4; - StorageLive(_13); - StorageLive(_12); - _12 = _8; - _13 = &_12; - _14 = deref_copy (*_11); - _15 = deref_copy (*_13); - StorageLive(_16); - _16 = (*_14); StorageLive(_17); - _17 = (*_15); - _18 = Le(move _16, move _17); - StorageDead(_17); - StorageDead(_16); - StorageDead(_12); - StorageDead(_13); + StorageLive(_16); + StorageLive(_37); + StorageLive(_38); + StorageLive(_11); + _11 = _8; + _12 = deref_copy _4; + _13 = deref_copy _11; + StorageLive(_14); + _14 = (*_12); + StorageLive(_15); + _15 = (*_13); + _16 = Le(move _14, move _15); + StorageDead(_15); + StorageDead(_14); StorageDead(_11); - switchInt(move _18) -> [0: bb1, otherwise: bb2]; + StorageDead(_38); + StorageDead(_37); + switchInt(move _16) -> [0: bb1, otherwise: bb2]; } bb1: { - _19 = const false; + _17 = const false; goto -> bb3; } bb2: { - StorageLive(_27); - StorageLive(_20); - _20 = &_10; - StorageLive(_22); + StorageLive(_23); + StorageLive(_39); + StorageLive(_40); + StorageLive(_18); + _18 = _6; + _19 = deref_copy _10; + _20 = deref_copy _18; StorageLive(_21); - _21 = _6; - _22 = &_21; - _23 = deref_copy (*_20); - _24 = deref_copy (*_22); - StorageLive(_25); - _25 = (*_23); - StorageLive(_26); - _26 = (*_24); - _27 = Le(move _25, move _26); - StorageDead(_26); - StorageDead(_25); - StorageDead(_21); + _21 = (*_19); + StorageLive(_22); + _22 = (*_20); + _23 = Le(move _21, move _22); StorageDead(_22); - StorageDead(_20); - _19 = move _27; + StorageDead(_21); + StorageDead(_18); + StorageDead(_40); + StorageDead(_39); + _17 = move _23; goto -> bb3; } bb3: { - StorageDead(_27); - StorageDead(_18); - switchInt(move _19) -> [0: bb4, otherwise: bb8]; + StorageDead(_23); + StorageDead(_16); + switchInt(move _17) -> [0: bb4, otherwise: bb8]; } bb4: { - StorageLive(_36); - StorageLive(_35); - StorageLive(_28); - _28 = &_8; StorageLive(_30); StorageLive(_29); - _29 = _4; - _30 = &_29; - _31 = deref_copy (*_28); - _32 = deref_copy (*_30); - StorageLive(_33); - _33 = (*_31); - StorageLive(_34); - _34 = (*_32); - _35 = Le(move _33, move _34); - StorageDead(_34); - StorageDead(_33); - StorageDead(_29); - StorageDead(_30); + StorageLive(_41); + StorageLive(_42); + StorageLive(_24); + _24 = _4; + _25 = deref_copy _8; + _26 = deref_copy _24; + StorageLive(_27); + _27 = (*_25); + StorageLive(_28); + _28 = (*_26); + _29 = Le(move _27, move _28); StorageDead(_28); - switchInt(move _35) -> [0: bb5, otherwise: bb6]; + StorageDead(_27); + StorageDead(_24); + StorageDead(_42); + StorageDead(_41); + switchInt(move _29) -> [0: bb5, otherwise: bb6]; } bb5: { - _36 = const false; + _30 = const false; goto -> bb7; } bb6: { - StorageLive(_44); - StorageLive(_37); - _37 = &_6; - StorageLive(_39); - StorageLive(_38); - _38 = _10; - _39 = &_38; - _40 = deref_copy (*_37); - _41 = deref_copy (*_39); - StorageLive(_42); - _42 = (*_40); + StorageLive(_36); StorageLive(_43); - _43 = (*_41); - _44 = Le(move _42, move _43); + StorageLive(_44); + StorageLive(_31); + _31 = _10; + _32 = deref_copy _6; + _33 = deref_copy _31; + StorageLive(_34); + _34 = (*_32); + StorageLive(_35); + _35 = (*_33); + _36 = Le(move _34, move _35); + StorageDead(_35); + StorageDead(_34); + StorageDead(_31); + StorageDead(_44); StorageDead(_43); - StorageDead(_42); - StorageDead(_38); - StorageDead(_39); - StorageDead(_37); - _36 = move _44; + _30 = move _36; goto -> bb7; } bb7: { - StorageDead(_44); - StorageDead(_35); - _0 = move _36; + StorageDead(_36); + StorageDead(_29); + _0 = move _30; goto -> bb9; } @@ -220,8 +212,8 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2 } bb9: { - StorageDead(_36); - StorageDead(_19); + StorageDead(_30); + StorageDead(_17); StorageDead(_10); StorageDead(_8); StorageDead(_6); diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir index 43efe034d..07a58309e 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir @@ -10,40 +10,37 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { scope 2 (inlined <usize as SliceIndex<[u32]>>::get_mut) { debug self => _2; debug slice => _1; - let mut _3: &[u32]; - let mut _4: usize; - let mut _5: bool; - let mut _6: *mut [u32]; - let mut _8: *mut u32; - let mut _9: &mut u32; + let mut _3: usize; + let mut _4: bool; + let mut _5: *mut [u32]; + let mut _7: *mut u32; + let mut _8: &mut u32; scope 3 { scope 4 (inlined <usize as SliceIndex<[u32]>>::get_unchecked_mut) { debug self => _2; - debug slice => _6; - let mut _7: *mut u32; - let mut _10: usize; - let mut _11: *mut [u32]; + debug slice => _5; + let mut _6: *mut u32; scope 5 { debug this => _2; scope 6 { scope 7 (inlined <usize as SliceIndex<[T]>>::get_unchecked_mut::runtime::<u32>) { - debug this => _10; - debug slice => _11; + debug this => _2; + debug slice => _5; scope 8 (inlined ptr::mut_ptr::<impl *mut [u32]>::len) { - debug self => _11; - let mut _12: *const [u32]; + debug self => _5; + let mut _9: *const [u32]; scope 9 (inlined std::ptr::metadata::<[u32]>) { - debug ptr => _12; + debug ptr => _9; scope 10 { } } } } scope 11 (inlined ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) { - debug self => _6; + debug self => _5; } scope 12 (inlined ptr::mut_ptr::<impl *mut u32>::add) { - debug self => _7; + debug self => _6; debug count => _2; scope 13 { } @@ -56,16 +53,13 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { } bb0: { - StorageLive(_9); - StorageLive(_5); + StorageLive(_7); StorageLive(_4); StorageLive(_3); - _3 = &(*_1); - _4 = Len((*_3)); + _3 = Len((*_1)); + _4 = Lt(_2, move _3); StorageDead(_3); - _5 = Lt(_2, move _4); - StorageDead(_4); - switchInt(move _5) -> [0: bb1, otherwise: bb2]; + switchInt(move _4) -> [0: bb1, otherwise: bb2]; } bb1: { @@ -75,28 +69,24 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { bb2: { StorageLive(_8); + StorageLive(_5); + _5 = &raw mut (*_1); + StorageLive(_9); StorageLive(_6); - _6 = &raw mut (*_1); - StorageLive(_10); - StorageLive(_11); - StorageLive(_12); - StorageLive(_7); - _7 = _6 as *mut u32 (PtrToPtr); - _8 = Offset(_7, _2); - StorageDead(_7); - StorageDead(_12); - StorageDead(_11); - StorageDead(_10); + _6 = _5 as *mut u32 (PtrToPtr); + _7 = Offset(_6, _2); StorageDead(_6); - _9 = &mut (*_8); - _0 = Option::<&mut u32>::Some(_9); + StorageDead(_9); + StorageDead(_5); + _8 = &mut (*_7); + _0 = Option::<&mut u32>::Some(move _8); StorageDead(_8); goto -> bb3; } bb3: { - StorageDead(_5); - StorageDead(_9); + StorageDead(_4); + StorageDead(_7); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir index 43efe034d..07a58309e 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir @@ -10,40 +10,37 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { scope 2 (inlined <usize as SliceIndex<[u32]>>::get_mut) { debug self => _2; debug slice => _1; - let mut _3: &[u32]; - let mut _4: usize; - let mut _5: bool; - let mut _6: *mut [u32]; - let mut _8: *mut u32; - let mut _9: &mut u32; + let mut _3: usize; + let mut _4: bool; + let mut _5: *mut [u32]; + let mut _7: *mut u32; + let mut _8: &mut u32; scope 3 { scope 4 (inlined <usize as SliceIndex<[u32]>>::get_unchecked_mut) { debug self => _2; - debug slice => _6; - let mut _7: *mut u32; - let mut _10: usize; - let mut _11: *mut [u32]; + debug slice => _5; + let mut _6: *mut u32; scope 5 { debug this => _2; scope 6 { scope 7 (inlined <usize as SliceIndex<[T]>>::get_unchecked_mut::runtime::<u32>) { - debug this => _10; - debug slice => _11; + debug this => _2; + debug slice => _5; scope 8 (inlined ptr::mut_ptr::<impl *mut [u32]>::len) { - debug self => _11; - let mut _12: *const [u32]; + debug self => _5; + let mut _9: *const [u32]; scope 9 (inlined std::ptr::metadata::<[u32]>) { - debug ptr => _12; + debug ptr => _9; scope 10 { } } } } scope 11 (inlined ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) { - debug self => _6; + debug self => _5; } scope 12 (inlined ptr::mut_ptr::<impl *mut u32>::add) { - debug self => _7; + debug self => _6; debug count => _2; scope 13 { } @@ -56,16 +53,13 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { } bb0: { - StorageLive(_9); - StorageLive(_5); + StorageLive(_7); StorageLive(_4); StorageLive(_3); - _3 = &(*_1); - _4 = Len((*_3)); + _3 = Len((*_1)); + _4 = Lt(_2, move _3); StorageDead(_3); - _5 = Lt(_2, move _4); - StorageDead(_4); - switchInt(move _5) -> [0: bb1, otherwise: bb2]; + switchInt(move _4) -> [0: bb1, otherwise: bb2]; } bb1: { @@ -75,28 +69,24 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { bb2: { StorageLive(_8); + StorageLive(_5); + _5 = &raw mut (*_1); + StorageLive(_9); StorageLive(_6); - _6 = &raw mut (*_1); - StorageLive(_10); - StorageLive(_11); - StorageLive(_12); - StorageLive(_7); - _7 = _6 as *mut u32 (PtrToPtr); - _8 = Offset(_7, _2); - StorageDead(_7); - StorageDead(_12); - StorageDead(_11); - StorageDead(_10); + _6 = _5 as *mut u32 (PtrToPtr); + _7 = Offset(_6, _2); StorageDead(_6); - _9 = &mut (*_8); - _0 = Option::<&mut u32>::Some(_9); + StorageDead(_9); + StorageDead(_5); + _8 = &mut (*_7); + _0 = Option::<&mut u32>::Some(move _8); StorageDead(_8); goto -> bb3; } bb3: { - StorageDead(_5); - StorageDead(_9); + StorageDead(_4); + StorageDead(_7); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir index 0c44873b7..2f5d356a2 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir @@ -4,49 +4,49 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> debug slice => _1; debug index => _2; let mut _0: &mut [u32]; + let mut _3: usize; + let mut _4: usize; scope 1 (inlined core::slice::<impl [u32]>::get_unchecked_mut::<std::ops::Range<usize>>) { debug self => _1; - debug index => _2; - let mut _3: *mut [u32]; - let mut _14: *mut [u32]; + debug index => std::ops::Range<usize>{ .0 => _3, .1 => _4, }; + let mut _5: *mut [u32]; + let mut _13: *mut [u32]; scope 2 { scope 3 (inlined <std::ops::Range<usize> as SliceIndex<[u32]>>::get_unchecked_mut) { - debug self => _2; - debug slice => _3; - let mut _4: usize; - let mut _5: usize; + debug self => std::ops::Range<usize>{ .0 => _3, .1 => _4, }; + debug slice => _5; let mut _7: *mut u32; - let mut _8: usize; - let mut _9: *mut u32; - let _15: std::ops::Range<usize>; + let mut _8: *mut u32; + let _14: usize; + let _15: usize; scope 4 { - debug this => _15; + debug this => std::ops::Range<usize>{ .0 => _14, .1 => _15, }; scope 5 { let _6: usize; scope 6 { debug new_len => _6; scope 7 (inlined ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) { - debug self => _3; + debug self => _5; } scope 8 (inlined ptr::mut_ptr::<impl *mut u32>::add) { debug self => _7; - debug count => _8; + debug count => _3; scope 9 { } } scope 10 (inlined slice_from_raw_parts_mut::<u32>) { - debug data => _9; + debug data => _8; debug len => _6; - let mut _10: *mut (); + let mut _9: *mut (); scope 11 (inlined ptr::mut_ptr::<impl *mut u32>::cast::<()>) { - debug self => _9; + debug self => _8; } scope 12 (inlined std::ptr::from_raw_parts_mut::<[u32]>) { - debug data_address => _10; + debug data_address => _9; debug metadata => _6; - let mut _11: *const (); - let mut _12: std::ptr::metadata::PtrComponents<[u32]>; - let mut _13: std::ptr::metadata::PtrRepr<[u32]>; + let mut _10: *const (); + let mut _11: std::ptr::metadata::PtrComponents<[u32]>; + let mut _12: std::ptr::metadata::PtrRepr<[u32]>; scope 13 { } } @@ -59,45 +59,38 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> } bb0: { + _3 = move (_2.0: usize); + _4 = move (_2.1: usize); + StorageLive(_5); + _5 = &raw mut (*_1); StorageLive(_14); - StorageLive(_3); - _3 = &raw mut (*_1); StorageLive(_15); StorageLive(_6); - StorageLive(_4); - _4 = (_2.1: usize); - StorageLive(_5); - _5 = (_2.0: usize); - _6 = SubUnchecked(move _4, move _5); - StorageDead(_5); - StorageDead(_4); - StorageLive(_9); - StorageLive(_7); - _7 = _3 as *mut u32 (PtrToPtr); + _6 = SubUnchecked(_4, _3); StorageLive(_8); - _8 = (_2.0: usize); - _9 = Offset(_7, _8); - StorageDead(_8); + StorageLive(_7); + _7 = _5 as *mut u32 (PtrToPtr); + _8 = Offset(_7, _3); StorageDead(_7); - StorageLive(_10); - _10 = _9 as *mut () (PtrToPtr); - StorageLive(_13); + StorageLive(_9); + _9 = _8 as *mut () (PtrToPtr); StorageLive(_12); StorageLive(_11); - _11 = _10 as *const () (PointerCoercion(MutToConstPointer)); - _12 = ptr::metadata::PtrComponents::<[u32]> { data_address: move _11, metadata: _6 }; + StorageLive(_10); + _10 = _9 as *const () (PointerCoercion(MutToConstPointer)); + _11 = ptr::metadata::PtrComponents::<[u32]> { data_address: move _10, metadata: _6 }; + StorageDead(_10); + _12 = ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _11 }; StorageDead(_11); - _13 = ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _12 }; + _13 = (_12.1: *mut [u32]); StorageDead(_12); - _14 = (_13.1: *mut [u32]); - StorageDead(_13); - StorageDead(_10); StorageDead(_9); + StorageDead(_8); StorageDead(_6); - StorageDead(_15); - StorageDead(_3); - _0 = &mut (*_14); StorageDead(_14); + StorageDead(_15); + StorageDead(_5); + _0 = &mut (*_13); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir index 0c44873b7..2f5d356a2 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir @@ -4,49 +4,49 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> debug slice => _1; debug index => _2; let mut _0: &mut [u32]; + let mut _3: usize; + let mut _4: usize; scope 1 (inlined core::slice::<impl [u32]>::get_unchecked_mut::<std::ops::Range<usize>>) { debug self => _1; - debug index => _2; - let mut _3: *mut [u32]; - let mut _14: *mut [u32]; + debug index => std::ops::Range<usize>{ .0 => _3, .1 => _4, }; + let mut _5: *mut [u32]; + let mut _13: *mut [u32]; scope 2 { scope 3 (inlined <std::ops::Range<usize> as SliceIndex<[u32]>>::get_unchecked_mut) { - debug self => _2; - debug slice => _3; - let mut _4: usize; - let mut _5: usize; + debug self => std::ops::Range<usize>{ .0 => _3, .1 => _4, }; + debug slice => _5; let mut _7: *mut u32; - let mut _8: usize; - let mut _9: *mut u32; - let _15: std::ops::Range<usize>; + let mut _8: *mut u32; + let _14: usize; + let _15: usize; scope 4 { - debug this => _15; + debug this => std::ops::Range<usize>{ .0 => _14, .1 => _15, }; scope 5 { let _6: usize; scope 6 { debug new_len => _6; scope 7 (inlined ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) { - debug self => _3; + debug self => _5; } scope 8 (inlined ptr::mut_ptr::<impl *mut u32>::add) { debug self => _7; - debug count => _8; + debug count => _3; scope 9 { } } scope 10 (inlined slice_from_raw_parts_mut::<u32>) { - debug data => _9; + debug data => _8; debug len => _6; - let mut _10: *mut (); + let mut _9: *mut (); scope 11 (inlined ptr::mut_ptr::<impl *mut u32>::cast::<()>) { - debug self => _9; + debug self => _8; } scope 12 (inlined std::ptr::from_raw_parts_mut::<[u32]>) { - debug data_address => _10; + debug data_address => _9; debug metadata => _6; - let mut _11: *const (); - let mut _12: std::ptr::metadata::PtrComponents<[u32]>; - let mut _13: std::ptr::metadata::PtrRepr<[u32]>; + let mut _10: *const (); + let mut _11: std::ptr::metadata::PtrComponents<[u32]>; + let mut _12: std::ptr::metadata::PtrRepr<[u32]>; scope 13 { } } @@ -59,45 +59,38 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> } bb0: { + _3 = move (_2.0: usize); + _4 = move (_2.1: usize); + StorageLive(_5); + _5 = &raw mut (*_1); StorageLive(_14); - StorageLive(_3); - _3 = &raw mut (*_1); StorageLive(_15); StorageLive(_6); - StorageLive(_4); - _4 = (_2.1: usize); - StorageLive(_5); - _5 = (_2.0: usize); - _6 = SubUnchecked(move _4, move _5); - StorageDead(_5); - StorageDead(_4); - StorageLive(_9); - StorageLive(_7); - _7 = _3 as *mut u32 (PtrToPtr); + _6 = SubUnchecked(_4, _3); StorageLive(_8); - _8 = (_2.0: usize); - _9 = Offset(_7, _8); - StorageDead(_8); + StorageLive(_7); + _7 = _5 as *mut u32 (PtrToPtr); + _8 = Offset(_7, _3); StorageDead(_7); - StorageLive(_10); - _10 = _9 as *mut () (PtrToPtr); - StorageLive(_13); + StorageLive(_9); + _9 = _8 as *mut () (PtrToPtr); StorageLive(_12); StorageLive(_11); - _11 = _10 as *const () (PointerCoercion(MutToConstPointer)); - _12 = ptr::metadata::PtrComponents::<[u32]> { data_address: move _11, metadata: _6 }; + StorageLive(_10); + _10 = _9 as *const () (PointerCoercion(MutToConstPointer)); + _11 = ptr::metadata::PtrComponents::<[u32]> { data_address: move _10, metadata: _6 }; + StorageDead(_10); + _12 = ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _11 }; StorageDead(_11); - _13 = ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _12 }; + _13 = (_12.1: *mut [u32]); StorageDead(_12); - _14 = (_13.1: *mut [u32]); - StorageDead(_13); - StorageDead(_10); StorageDead(_9); + StorageDead(_8); StorageDead(_6); - StorageDead(_15); - StorageDead(_3); - _0 = &mut (*_14); StorageDead(_14); + StorageDead(_15); + StorageDead(_5); + _0 = &mut (*_13); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir index aff718566..df6d2263d 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir @@ -12,7 +12,7 @@ fn slice_index_range(_1: &[u32], _2: std::ops::Range<usize>) -> &[u32] { bb0: { StorageLive(_3); - _3 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, _1) -> [return: bb1, unwind unreachable]; + _3 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, move _1) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir index a6b931d2c..cc1795c3f 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir @@ -12,7 +12,7 @@ fn slice_index_range(_1: &[u32], _2: std::ops::Range<usize>) -> &[u32] { bb0: { StorageLive(_3); - _3 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, _1) -> [return: bb1, unwind continue]; + _3 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, move _1) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir index 3c4140257..89009864c 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir @@ -38,25 +38,24 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { scope 6 { let _7: *const T; scope 7 { - debug end => _7; + debug end_or_len => _7; scope 13 (inlined NonNull::<T>::new_unchecked) { debug ptr => _9; let mut _10: *const T; - let mut _24: *mut T; scope 14 { scope 15 (inlined NonNull::<T>::new_unchecked::runtime::<T>) { - debug ptr => _24; + debug ptr => _9; scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null) { - debug self => _24; - let mut _25: *mut u8; + debug self => _9; + let mut _24: *mut u8; scope 17 { scope 18 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) { - debug ptr => _25; + debug ptr => _24; scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::addr) { - debug self => _25; + debug self => _24; scope 20 { scope 21 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) { - debug self => _25; + debug self => _24; } } } @@ -132,16 +131,14 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { _9 = _4 as *mut T (PtrToPtr); StorageLive(_10); StorageLive(_24); - StorageLive(_25); _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); _11 = NonNull::<T> { pointer: _10 }; - StorageDead(_25); StorageDead(_24); StorageDead(_10); StorageDead(_9); StorageLive(_12); _12 = _7; - _13 = std::slice::Iter::<'_, T> { ptr: move _11, end: move _12, _marker: const ZeroSized: PhantomData<&T> }; + _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> }; StorageDead(_12); StorageDead(_11); StorageDead(_7); @@ -155,11 +152,13 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { bb4: { StorageLive(_17); + StorageLive(_16); _16 = &mut _15; - _17 = <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next(_16) -> [return: bb5, unwind unreachable]; + _17 = <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next(move _16) -> [return: bb5, unwind unreachable]; } bb5: { + StorageDead(_16); _18 = discriminant(_17); switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10]; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir index e3df8b961..836fa2677 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir @@ -38,25 +38,24 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { scope 6 { let _7: *const T; scope 7 { - debug end => _7; + debug end_or_len => _7; scope 13 (inlined NonNull::<T>::new_unchecked) { debug ptr => _9; let mut _10: *const T; - let mut _24: *mut T; scope 14 { scope 15 (inlined NonNull::<T>::new_unchecked::runtime::<T>) { - debug ptr => _24; + debug ptr => _9; scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null) { - debug self => _24; - let mut _25: *mut u8; + debug self => _9; + let mut _24: *mut u8; scope 17 { scope 18 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) { - debug ptr => _25; + debug ptr => _24; scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::addr) { - debug self => _25; + debug self => _24; scope 20 { scope 21 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) { - debug self => _25; + debug self => _24; } } } @@ -132,16 +131,14 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { _9 = _4 as *mut T (PtrToPtr); StorageLive(_10); StorageLive(_24); - StorageLive(_25); _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); _11 = NonNull::<T> { pointer: _10 }; - StorageDead(_25); StorageDead(_24); StorageDead(_10); StorageDead(_9); StorageLive(_12); _12 = _7; - _13 = std::slice::Iter::<'_, T> { ptr: move _11, end: move _12, _marker: const ZeroSized: PhantomData<&T> }; + _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> }; StorageDead(_12); StorageDead(_11); StorageDead(_7); @@ -155,11 +152,13 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { bb4: { StorageLive(_17); + StorageLive(_16); _16 = &mut _15; - _17 = <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next(_16) -> [return: bb5, unwind: bb11]; + _17 = <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next(move _16) -> [return: bb5, unwind: bb11]; } bb5: { + StorageDead(_16); _18 = discriminant(_17); switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10]; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir index 49de4b463..146fa57a0 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir @@ -35,25 +35,24 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { scope 6 { let _7: *const T; scope 7 { - debug end => _7; + debug end_or_len => _7; scope 13 (inlined NonNull::<T>::new_unchecked) { debug ptr => _9; let mut _10: *const T; - let mut _22: *mut T; scope 14 { scope 15 (inlined NonNull::<T>::new_unchecked::runtime::<T>) { - debug ptr => _22; + debug ptr => _9; scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null) { - debug self => _22; - let mut _23: *mut u8; + debug self => _9; + let mut _22: *mut u8; scope 17 { scope 18 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) { - debug ptr => _23; + debug ptr => _22; scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::addr) { - debug self => _23; + debug self => _22; scope 20 { scope 21 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) { - debug self => _23; + debug self => _22; } } } @@ -122,16 +121,14 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { _9 = _4 as *mut T (PtrToPtr); StorageLive(_10); StorageLive(_22); - StorageLive(_23); _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); _11 = NonNull::<T> { pointer: _10 }; - StorageDead(_23); StorageDead(_22); StorageDead(_10); StorageDead(_9); StorageLive(_12); _12 = _7; - _13 = std::slice::Iter::<'_, T> { ptr: move _11, end: move _12, _marker: const ZeroSized: PhantomData<&T> }; + _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> }; StorageDead(_12); StorageDead(_11); StorageDead(_7); @@ -143,11 +140,13 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb4: { StorageLive(_16); + StorageLive(_15); _15 = &mut _14; - _16 = <std::slice::Iter<'_, T> as Iterator>::next(_15) -> [return: bb5, unwind unreachable]; + _16 = <std::slice::Iter<'_, T> as Iterator>::next(move _15) -> [return: bb5, unwind unreachable]; } bb5: { + StorageDead(_15); _17 = discriminant(_16); switchInt(move _17) -> [0: bb6, 1: bb8, otherwise: bb10]; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir index cfc304987..65baaf64a 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir @@ -35,25 +35,24 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { scope 6 { let _7: *const T; scope 7 { - debug end => _7; + debug end_or_len => _7; scope 13 (inlined NonNull::<T>::new_unchecked) { debug ptr => _9; let mut _10: *const T; - let mut _22: *mut T; scope 14 { scope 15 (inlined NonNull::<T>::new_unchecked::runtime::<T>) { - debug ptr => _22; + debug ptr => _9; scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null) { - debug self => _22; - let mut _23: *mut u8; + debug self => _9; + let mut _22: *mut u8; scope 17 { scope 18 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) { - debug ptr => _23; + debug ptr => _22; scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::addr) { - debug self => _23; + debug self => _22; scope 20 { scope 21 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) { - debug self => _23; + debug self => _22; } } } @@ -122,16 +121,14 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { _9 = _4 as *mut T (PtrToPtr); StorageLive(_10); StorageLive(_22); - StorageLive(_23); _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); _11 = NonNull::<T> { pointer: _10 }; - StorageDead(_23); StorageDead(_22); StorageDead(_10); StorageDead(_9); StorageLive(_12); _12 = _7; - _13 = std::slice::Iter::<'_, T> { ptr: move _11, end: move _12, _marker: const ZeroSized: PhantomData<&T> }; + _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> }; StorageDead(_12); StorageDead(_11); StorageDead(_7); @@ -143,11 +140,13 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb4: { StorageLive(_16); + StorageLive(_15); _15 = &mut _14; - _16 = <std::slice::Iter<'_, T> as Iterator>::next(_15) -> [return: bb5, unwind: bb11]; + _16 = <std::slice::Iter<'_, T> as Iterator>::next(move _15) -> [return: bb5, unwind: bb11]; } bb5: { + StorageDead(_15); _17 = discriminant(_16); switchInt(move _17) -> [0: bb6, 1: bb8, otherwise: bb10]; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir index 00177033b..4edf4b4fb 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir @@ -7,43 +7,43 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { let mut _3: usize; let mut _4: std::ops::Range<usize>; let mut _5: std::ops::Range<usize>; - let mut _6: &mut std::ops::Range<usize>; - let mut _12: std::option::Option<usize>; - let mut _15: isize; - let mut _17: usize; - let mut _18: bool; - let mut _20: &impl Fn(usize, &T); - let mut _21: (usize, &T); - let _22: (); + let mut _9: std::option::Option<usize>; + let mut _12: isize; + let mut _14: usize; + let mut _15: bool; + let mut _17: &impl Fn(usize, &T); + let mut _18: (usize, &T); + let _19: (); + let mut _20: &mut std::ops::Range<usize>; scope 1 { debug iter => _5; - let _16: usize; + let _13: usize; scope 2 { - debug i => _16; - let _19: &T; + debug i => _13; + let _16: &T; scope 3 { - debug x => _19; + debug x => _16; } } scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) { - debug self => _6; + debug self => _20; scope 6 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) { - debug self => _6; - let mut _7: &usize; - let mut _8: &usize; - let mut _11: bool; - let _13: usize; - let mut _14: usize; + debug self => _20; + let mut _8: bool; + let _10: usize; + let mut _11: usize; + let mut _21: &usize; + let mut _22: &usize; scope 7 { - debug old => _13; + debug old => _10; scope 8 { } } scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::lt) { - debug self => _7; - debug other => _8; - let mut _9: usize; - let mut _10: usize; + debug self => _21; + debug other => _22; + let mut _6: usize; + let mut _7: usize; } } } @@ -63,53 +63,50 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } bb1: { - StorageLive(_12); - _6 = &mut _5; - StorageLive(_13); - StorageLive(_11); - StorageLive(_7); - _7 = &((*_6).0: usize); - StorageLive(_8); - _8 = &((*_6).1: usize); StorageLive(_9); - _9 = (*_7); StorageLive(_10); - _10 = (*_8); - _11 = Lt(move _9, move _10); - StorageDead(_10); - StorageDead(_9); - StorageDead(_8); + StorageLive(_8); + StorageLive(_21); + StorageLive(_22); + StorageLive(_6); + _6 = (_5.0: usize); + StorageLive(_7); + _7 = (_5.1: usize); + _8 = Lt(move _6, move _7); StorageDead(_7); - switchInt(move _11) -> [0: bb2, otherwise: bb3]; + StorageDead(_6); + StorageDead(_22); + StorageDead(_21); + switchInt(move _8) -> [0: bb2, otherwise: bb3]; } bb2: { - _12 = Option::<usize>::None; + _9 = Option::<usize>::None; goto -> bb5; } bb3: { - _13 = ((*_6).0: usize); - StorageLive(_14); - _14 = <usize as Step>::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind unreachable]; + _10 = (_5.0: usize); + StorageLive(_11); + _11 = <usize as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind unreachable]; } bb4: { - ((*_6).0: usize) = move _14; - StorageDead(_14); - _12 = Option::<usize>::Some(_13); + (_5.0: usize) = move _11; + StorageDead(_11); + _9 = Option::<usize>::Some(_10); goto -> bb5; } bb5: { - StorageDead(_11); - StorageDead(_13); - _15 = discriminant(_12); - switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb11]; + StorageDead(_8); + StorageDead(_10); + _12 = discriminant(_9); + switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb11]; } bb6: { - StorageDead(_12); + StorageDead(_9); StorageDead(_5); drop(_2) -> [return: bb7, unwind unreachable]; } @@ -119,25 +116,25 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } bb8: { - _16 = ((_12 as Some).0: usize); - _17 = Len((*_1)); - _18 = Lt(_16, _17); - assert(move _18, "index out of bounds: the length is {} but the index is {}", move _17, _16) -> [success: bb9, unwind unreachable]; + _13 = ((_9 as Some).0: usize); + _14 = Len((*_1)); + _15 = Lt(_13, _14); + assert(move _15, "index out of bounds: the length is {} but the index is {}", move _14, _13) -> [success: bb9, unwind unreachable]; } bb9: { - _19 = &(*_1)[_16]; - StorageLive(_20); - _20 = &_2; - StorageLive(_21); - _21 = (_16, _19); - _22 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _20, move _21) -> [return: bb10, unwind unreachable]; + _16 = &(*_1)[_13]; + StorageLive(_17); + _17 = &_2; + StorageLive(_18); + _18 = (_13, _16); + _19 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _17, move _18) -> [return: bb10, unwind unreachable]; } bb10: { - StorageDead(_21); - StorageDead(_20); - StorageDead(_12); + StorageDead(_18); + StorageDead(_17); + StorageDead(_9); goto -> bb1; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir index 3423c5d86..f7b19e80e 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir @@ -7,43 +7,43 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { let mut _3: usize; let mut _4: std::ops::Range<usize>; let mut _5: std::ops::Range<usize>; - let mut _6: &mut std::ops::Range<usize>; - let mut _12: std::option::Option<usize>; - let mut _15: isize; - let mut _17: usize; - let mut _18: bool; - let mut _20: &impl Fn(usize, &T); - let mut _21: (usize, &T); - let _22: (); + let mut _9: std::option::Option<usize>; + let mut _12: isize; + let mut _14: usize; + let mut _15: bool; + let mut _17: &impl Fn(usize, &T); + let mut _18: (usize, &T); + let _19: (); + let mut _20: &mut std::ops::Range<usize>; scope 1 { debug iter => _5; - let _16: usize; + let _13: usize; scope 2 { - debug i => _16; - let _19: &T; + debug i => _13; + let _16: &T; scope 3 { - debug x => _19; + debug x => _16; } } scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) { - debug self => _6; + debug self => _20; scope 6 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) { - debug self => _6; - let mut _7: &usize; - let mut _8: &usize; - let mut _11: bool; - let _13: usize; - let mut _14: usize; + debug self => _20; + let mut _8: bool; + let _10: usize; + let mut _11: usize; + let mut _21: &usize; + let mut _22: &usize; scope 7 { - debug old => _13; + debug old => _10; scope 8 { } } scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::lt) { - debug self => _7; - debug other => _8; - let mut _9: usize; - let mut _10: usize; + debug self => _21; + debug other => _22; + let mut _6: usize; + let mut _7: usize; } } } @@ -63,53 +63,50 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } bb1: { - StorageLive(_12); - _6 = &mut _5; - StorageLive(_13); - StorageLive(_11); - StorageLive(_7); - _7 = &((*_6).0: usize); - StorageLive(_8); - _8 = &((*_6).1: usize); StorageLive(_9); - _9 = (*_7); StorageLive(_10); - _10 = (*_8); - _11 = Lt(move _9, move _10); - StorageDead(_10); - StorageDead(_9); - StorageDead(_8); + StorageLive(_8); + StorageLive(_21); + StorageLive(_22); + StorageLive(_6); + _6 = (_5.0: usize); + StorageLive(_7); + _7 = (_5.1: usize); + _8 = Lt(move _6, move _7); StorageDead(_7); - switchInt(move _11) -> [0: bb2, otherwise: bb3]; + StorageDead(_6); + StorageDead(_22); + StorageDead(_21); + switchInt(move _8) -> [0: bb2, otherwise: bb3]; } bb2: { - _12 = Option::<usize>::None; + _9 = Option::<usize>::None; goto -> bb5; } bb3: { - _13 = ((*_6).0: usize); - StorageLive(_14); - _14 = <usize as Step>::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind: bb12]; + _10 = (_5.0: usize); + StorageLive(_11); + _11 = <usize as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind: bb12]; } bb4: { - ((*_6).0: usize) = move _14; - StorageDead(_14); - _12 = Option::<usize>::Some(_13); + (_5.0: usize) = move _11; + StorageDead(_11); + _9 = Option::<usize>::Some(_10); goto -> bb5; } bb5: { - StorageDead(_11); - StorageDead(_13); - _15 = discriminant(_12); - switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb11]; + StorageDead(_8); + StorageDead(_10); + _12 = discriminant(_9); + switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb11]; } bb6: { - StorageDead(_12); + StorageDead(_9); StorageDead(_5); drop(_2) -> [return: bb7, unwind continue]; } @@ -119,25 +116,25 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } bb8: { - _16 = ((_12 as Some).0: usize); - _17 = Len((*_1)); - _18 = Lt(_16, _17); - assert(move _18, "index out of bounds: the length is {} but the index is {}", move _17, _16) -> [success: bb9, unwind: bb12]; + _13 = ((_9 as Some).0: usize); + _14 = Len((*_1)); + _15 = Lt(_13, _14); + assert(move _15, "index out of bounds: the length is {} but the index is {}", move _14, _13) -> [success: bb9, unwind: bb12]; } bb9: { - _19 = &(*_1)[_16]; - StorageLive(_20); - _20 = &_2; - StorageLive(_21); - _21 = (_16, _19); - _22 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _20, move _21) -> [return: bb10, unwind: bb12]; + _16 = &(*_1)[_13]; + StorageLive(_17); + _17 = &_2; + StorageLive(_18); + _18 = (_13, _16); + _19 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _17, move _18) -> [return: bb10, unwind: bb12]; } bb10: { - StorageDead(_21); - StorageDead(_20); - StorageDead(_12); + StorageDead(_18); + StorageDead(_17); + StorageDead(_9); goto -> bb1; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir index 1b4ac793f..549cb4f46 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir @@ -7,21 +7,21 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { let mut _13: std::slice::Iter<'_, T>; let mut _14: std::iter::Rev<std::slice::Iter<'_, T>>; let mut _15: std::iter::Rev<std::slice::Iter<'_, T>>; - let mut _16: &mut std::iter::Rev<std::slice::Iter<'_, T>>; - let mut _18: std::option::Option<&T>; - let mut _19: isize; - let mut _21: &impl Fn(&T); - let mut _22: (&T,); - let _23: (); + let mut _17: std::option::Option<&T>; + let mut _18: isize; + let mut _20: &impl Fn(&T); + let mut _21: (&T,); + let _22: (); + let mut _23: &mut std::iter::Rev<std::slice::Iter<'_, T>>; scope 1 { debug iter => _15; - let _20: &T; + let _19: &T; scope 2 { - debug x => _20; + debug x => _19; } scope 25 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) { - debug self => _16; - let mut _17: &mut std::slice::Iter<'_, T>; + debug self => _23; + let mut _16: &mut std::slice::Iter<'_, T>; } } scope 3 (inlined core::slice::<impl [T]>::iter) { @@ -40,25 +40,24 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { scope 6 { let _7: *const T; scope 7 { - debug end => _7; + debug end_or_len => _7; scope 13 (inlined NonNull::<T>::new_unchecked) { debug ptr => _9; let mut _10: *const T; - let mut _24: *mut T; scope 14 { scope 15 (inlined NonNull::<T>::new_unchecked::runtime::<T>) { - debug ptr => _24; + debug ptr => _9; scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null) { - debug self => _24; - let mut _25: *mut u8; + debug self => _9; + let mut _24: *mut u8; scope 17 { scope 18 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) { - debug ptr => _25; + debug ptr => _24; scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::addr) { - debug self => _25; + debug self => _24; scope 20 { scope 21 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) { - debug self => _25; + debug self => _24; } } } @@ -134,16 +133,14 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { _9 = _4 as *mut T (PtrToPtr); StorageLive(_10); StorageLive(_24); - StorageLive(_25); _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); _11 = NonNull::<T> { pointer: _10 }; - StorageDead(_25); StorageDead(_24); StorageDead(_10); StorageDead(_9); StorageLive(_12); _12 = _7; - _13 = std::slice::Iter::<'_, T> { ptr: move _11, end: move _12, _marker: const ZeroSized: PhantomData<&T> }; + _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> }; StorageDead(_12); StorageDead(_11); StorageDead(_7); @@ -156,21 +153,20 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb4: { - StorageLive(_18); - _16 = &mut _15; StorageLive(_17); - _17 = &mut ((*_16).0: std::slice::Iter<'_, T>); - _18 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _17) -> [return: bb5, unwind unreachable]; + StorageLive(_16); + _16 = &mut (_15.0: std::slice::Iter<'_, T>); + _17 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _16) -> [return: bb5, unwind unreachable]; } bb5: { - StorageDead(_17); - _19 = discriminant(_18); - switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10]; + StorageDead(_16); + _18 = discriminant(_17); + switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10]; } bb6: { - StorageDead(_18); + StorageDead(_17); StorageDead(_15); drop(_2) -> [return: bb7, unwind unreachable]; } @@ -180,18 +176,18 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb8: { - _20 = ((_18 as Some).0: &T); + _19 = ((_17 as Some).0: &T); + StorageLive(_20); + _20 = &_2; StorageLive(_21); - _21 = &_2; - StorageLive(_22); - _22 = (_20,); - _23 = <impl Fn(&T) as Fn<(&T,)>>::call(move _21, move _22) -> [return: bb9, unwind unreachable]; + _21 = (_19,); + _22 = <impl Fn(&T) as Fn<(&T,)>>::call(move _20, move _21) -> [return: bb9, unwind unreachable]; } bb9: { - StorageDead(_22); StorageDead(_21); - StorageDead(_18); + StorageDead(_20); + StorageDead(_17); goto -> bb4; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir index f75a9a03d..43f8806e1 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir @@ -7,21 +7,21 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { let mut _13: std::slice::Iter<'_, T>; let mut _14: std::iter::Rev<std::slice::Iter<'_, T>>; let mut _15: std::iter::Rev<std::slice::Iter<'_, T>>; - let mut _16: &mut std::iter::Rev<std::slice::Iter<'_, T>>; - let mut _18: std::option::Option<&T>; - let mut _19: isize; - let mut _21: &impl Fn(&T); - let mut _22: (&T,); - let _23: (); + let mut _17: std::option::Option<&T>; + let mut _18: isize; + let mut _20: &impl Fn(&T); + let mut _21: (&T,); + let _22: (); + let mut _23: &mut std::iter::Rev<std::slice::Iter<'_, T>>; scope 1 { debug iter => _15; - let _20: &T; + let _19: &T; scope 2 { - debug x => _20; + debug x => _19; } scope 25 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) { - debug self => _16; - let mut _17: &mut std::slice::Iter<'_, T>; + debug self => _23; + let mut _16: &mut std::slice::Iter<'_, T>; } } scope 3 (inlined core::slice::<impl [T]>::iter) { @@ -40,25 +40,24 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { scope 6 { let _7: *const T; scope 7 { - debug end => _7; + debug end_or_len => _7; scope 13 (inlined NonNull::<T>::new_unchecked) { debug ptr => _9; let mut _10: *const T; - let mut _24: *mut T; scope 14 { scope 15 (inlined NonNull::<T>::new_unchecked::runtime::<T>) { - debug ptr => _24; + debug ptr => _9; scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null) { - debug self => _24; - let mut _25: *mut u8; + debug self => _9; + let mut _24: *mut u8; scope 17 { scope 18 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) { - debug ptr => _25; + debug ptr => _24; scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::addr) { - debug self => _25; + debug self => _24; scope 20 { scope 21 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) { - debug self => _25; + debug self => _24; } } } @@ -134,16 +133,14 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { _9 = _4 as *mut T (PtrToPtr); StorageLive(_10); StorageLive(_24); - StorageLive(_25); _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); _11 = NonNull::<T> { pointer: _10 }; - StorageDead(_25); StorageDead(_24); StorageDead(_10); StorageDead(_9); StorageLive(_12); _12 = _7; - _13 = std::slice::Iter::<'_, T> { ptr: move _11, end: move _12, _marker: const ZeroSized: PhantomData<&T> }; + _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> }; StorageDead(_12); StorageDead(_11); StorageDead(_7); @@ -156,21 +153,20 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb4: { - StorageLive(_18); - _16 = &mut _15; StorageLive(_17); - _17 = &mut ((*_16).0: std::slice::Iter<'_, T>); - _18 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _17) -> [return: bb5, unwind: bb11]; + StorageLive(_16); + _16 = &mut (_15.0: std::slice::Iter<'_, T>); + _17 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _16) -> [return: bb5, unwind: bb11]; } bb5: { - StorageDead(_17); - _19 = discriminant(_18); - switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10]; + StorageDead(_16); + _18 = discriminant(_17); + switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10]; } bb6: { - StorageDead(_18); + StorageDead(_17); StorageDead(_15); drop(_2) -> [return: bb7, unwind continue]; } @@ -180,18 +176,18 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb8: { - _20 = ((_18 as Some).0: &T); + _19 = ((_17 as Some).0: &T); + StorageLive(_20); + _20 = &_2; StorageLive(_21); - _21 = &_2; - StorageLive(_22); - _22 = (_20,); - _23 = <impl Fn(&T) as Fn<(&T,)>>::call(move _21, move _22) -> [return: bb9, unwind: bb11]; + _21 = (_19,); + _22 = <impl Fn(&T) as Fn<(&T,)>>::call(move _20, move _21) -> [return: bb9, unwind: bb11]; } bb9: { - StorageDead(_22); StorageDead(_21); - StorageDead(_18); + StorageDead(_20); + StorageDead(_17); goto -> bb4; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-abort.mir index 0471d0757..78f96bf41 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-abort.mir @@ -5,7 +5,7 @@ fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut let mut _0: std::option::Option<&mut T>; bb0: { - _0 = <std::slice::IterMut<'_, T> as DoubleEndedIterator>::next_back(_1) -> [return: bb1, unwind unreachable]; + _0 = <std::slice::IterMut<'_, T> as DoubleEndedIterator>::next_back(move _1) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir index 386f3a9ed..dfe5e206f 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir @@ -5,7 +5,7 @@ fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut let mut _0: std::option::Option<&mut T>; bb0: { - _0 = <std::slice::IterMut<'_, T> as DoubleEndedIterator>::next_back(_1) -> [return: bb1, unwind continue]; + _0 = <std::slice::IterMut<'_, T> as DoubleEndedIterator>::next_back(move _1) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir index 8c0209ae1..8edac638c 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir @@ -5,7 +5,7 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { let mut _0: std::option::Option<&T>; bb0: { - _0 = <std::slice::Iter<'_, T> as Iterator>::next(_1) -> [return: bb1, unwind unreachable]; + _0 = <std::slice::Iter<'_, T> as Iterator>::next(move _1) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir index e76ec0039..fdde07173 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir @@ -5,7 +5,7 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { let mut _0: std::option::Option<&T>; bb0: { - _0 = <std::slice::Iter<'_, T> as Iterator>::next(_1) -> [return: bb1, unwind continue]; + _0 = <std::slice::Iter<'_, T> as Iterator>::next(move _1) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir index b9329520b..ed7107e53 100644 --- a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir @@ -3,17 +3,19 @@ fn outer(_1: u8) -> u8 { debug v => _1; // in scope 0 at $DIR/spans.rs:10:14: 10:15 let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:10:24: 10:26 - let _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13 + let mut _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13 bb0: { + StorageLive(_2); // scope 0 at $DIR/spans.rs:11:11: 11:13 _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13 - _0 = inner(_2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/spans.rs:11:5: 11:14 + _0 = inner(move _2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/spans.rs:11:5: 11:14 // mir::Constant // + span: $DIR/spans.rs:11:5: 11:10 // + literal: Const { ty: for<'a> fn(&'a u8) -> u8 {inner}, val: Value(<ZST>) } } bb1: { + StorageDead(_2); // scope 0 at $DIR/spans.rs:11:13: 11:14 return; // scope 0 at $DIR/spans.rs:12:2: 12:2 } } diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir index 1e20b1be5..dc436dc26 100644 --- a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir @@ -3,17 +3,19 @@ fn outer(_1: u8) -> u8 { debug v => _1; // in scope 0 at $DIR/spans.rs:10:14: 10:15 let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:10:24: 10:26 - let _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13 + let mut _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13 bb0: { + StorageLive(_2); // scope 0 at $DIR/spans.rs:11:11: 11:13 _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13 - _0 = inner(_2) -> [return: bb1, unwind continue]; // scope 0 at $DIR/spans.rs:11:5: 11:14 + _0 = inner(move _2) -> [return: bb1, unwind continue]; // scope 0 at $DIR/spans.rs:11:5: 11:14 // mir::Constant // + span: $DIR/spans.rs:11:5: 11:10 // + literal: Const { ty: for<'a> fn(&'a u8) -> u8 {inner}, val: Value(<ZST>) } } bb1: { + StorageDead(_2); // scope 0 at $DIR/spans.rs:11:13: 11:14 return; // scope 0 at $DIR/spans.rs:12:2: 12:2 } } diff --git a/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff b/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff index 132f66a1a..8fe361f2b 100644 --- a/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff @@ -22,27 +22,23 @@ let _24: &mut u8; let mut _25: debuginfo::T; scope 1 { -- debug ref_mut_u8 => _1; -+ debug ref_mut_u8 => &_2; + debug ref_mut_u8 => _1; let _3: &u8; let mut _28: &debuginfo::T; scope 2 { -- debug field => _3; -+ debug field => &((*_28).0: u8); + debug field => _3; let _5: &u8; scope 3 { - debug reborrow => _5; -+ debug reborrow => &_2; ++ debug reborrow => _1; let _9: &i32; let _22: &&&mut u8; let mut _27: &std::option::Option<i32>; scope 4 { -- debug variant_field => _9; -+ debug variant_field => &(((*_27) as Some).0: i32); + debug variant_field => _9; } scope 5 { -- debug constant_index => _19; -+ debug constant_index => &(*_11)[1 of 3]; + debug constant_index => _19; debug subslice => _20; debug constant_index_from_end => _21; let _19: &i32; @@ -51,21 +47,20 @@ let mut _26: &[i32; 10]; } scope 6 { -- debug multiple_borrow => _22; -+ debug multiple_borrow => &&&(_25.0: u8); + debug multiple_borrow => _22; } } } } bb0: { -- StorageLive(_1); + StorageLive(_1); StorageLive(_2); _2 = const 5_u8; -- _1 = &mut _2; -- StorageLive(_3); + _1 = &mut _2; + StorageLive(_3); _28 = const _; -- _3 = &((*_28).0: u8); + _3 = &((*_28).0: u8); - StorageLive(_5); - _5 = &(*_1); - StorageLive(_6); @@ -76,11 +71,11 @@ } bb1: { -- StorageLive(_9); + StorageLive(_9); _27 = const _; -- _9 = &(((*_27) as Some).0: i32); + _9 = &(((*_27) as Some).0: i32); - _6 = const (); -- StorageDead(_9); + StorageDead(_9); goto -> bb4; } @@ -118,8 +113,8 @@ } bb6: { -- StorageLive(_19); -- _19 = &(*_11)[1 of 3]; + StorageLive(_19); + _19 = &(*_11)[1 of 3]; StorageLive(_20); _20 = &(*_11)[2:-1]; StorageLive(_21); @@ -127,7 +122,7 @@ - _10 = const (); StorageDead(_21); StorageDead(_20); -- StorageDead(_19); + StorageDead(_19); goto -> bb8; } @@ -140,23 +135,23 @@ StorageDead(_12); StorageDead(_11); - StorageDead(_10); -- StorageLive(_22); -- StorageLive(_23); -- StorageLive(_24); + StorageLive(_22); + StorageLive(_23); + StorageLive(_24); StorageLive(_25); _25 = T(const 6_u8); -- _24 = &mut (_25.0: u8); -- _23 = &_24; -- _22 = &_23; + _24 = &mut (_25.0: u8); + _23 = &_24; + _22 = &_23; _0 = const (); StorageDead(_25); -- StorageDead(_24); -- StorageDead(_23); -- StorageDead(_22); + StorageDead(_24); + StorageDead(_23); + StorageDead(_22); - StorageDead(_5); -- StorageDead(_3); + StorageDead(_3); StorageDead(_2); -- StorageDead(_1); + StorageDead(_1); return; } } diff --git a/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff index 9ec8f9d78..747028e12 100644 --- a/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff @@ -13,16 +13,15 @@ debug x => _1; let _2: &mut i32; scope 2 { -- debug xref => _2; -+ debug xref => &_1; + debug xref => _2; let _3: *mut i32; scope 3 { - debug xraw => _3; -+ debug xraw => &_1; ++ debug xraw => _2; let _6: &i32; scope 4 { - debug xshr => _6; -+ debug xshr => &_1; ++ debug xshr => _2; let _7: i32; scope 5 { debug a => _7; @@ -38,7 +37,7 @@ StorageLive(_1); _1 = const 2_i32; - StorageLive(_2); -- _2 = &mut _1; + _2 = &mut _1; - StorageLive(_3); - StorageLive(_4); - StorageLive(_5); diff --git a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff index f1f77cffd..1be2ce8d0 100644 --- a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff @@ -52,8 +52,7 @@ debug a => _4; let _5: &usize; scope 2 { -- debug b => _5; -+ debug b => &_4; + debug b => _5; let _6: usize; scope 3 { debug c => _6; @@ -158,12 +157,10 @@ debug a => _60; let _61: &usize; scope 30 { -- debug b => _61; -+ debug b => &_60; + debug b => _61; let _62: &&usize; scope 31 { -- debug d => _62; -+ debug d => &&_60; + debug d => _62; let _63: usize; scope 32 { debug c => _63; @@ -175,12 +172,10 @@ debug a => _66; let mut _67: &usize; scope 34 { -- debug b => _67; -+ debug b => &_66; + debug b => _67; let _68: &mut &usize; scope 35 { -- debug d => _68; -+ debug d => &&_66; + debug d => _68; let _69: usize; scope 36 { debug c => _69; @@ -193,8 +188,8 @@ - StorageLive(_3); StorageLive(_4); _4 = const 5_usize; -- StorageLive(_5); -- _5 = &_4; + StorageLive(_5); + _5 = &_4; StorageLive(_6); - _6 = (*_5); + _6 = _4; @@ -209,7 +204,7 @@ StorageDead(_7); - _3 = const (); StorageDead(_6); -- StorageDead(_5); + StorageDead(_5); StorageDead(_4); - StorageDead(_3); - StorageLive(_9); @@ -394,13 +389,12 @@ - StorageLive(_59); StorageLive(_60); _60 = const 5_usize; -- StorageLive(_61); -- _61 = &_60; -- StorageLive(_62); -- _62 = &_61; + StorageLive(_61); + _61 = &_60; + StorageLive(_62); + _62 = &_61; StorageLive(_63); -- _63 = (*_61); -+ _63 = _60; + _63 = (*_61); StorageLive(_64); StorageLive(_65); _65 = (); @@ -412,19 +406,18 @@ StorageDead(_64); - _59 = const (); StorageDead(_63); -- StorageDead(_62); -- StorageDead(_61); + StorageDead(_62); + StorageDead(_61); StorageDead(_60); - StorageDead(_59); StorageLive(_66); _66 = const 5_usize; -- StorageLive(_67); -- _67 = &_66; -- StorageLive(_68); -- _68 = &mut _67; + StorageLive(_67); + _67 = &_66; + StorageLive(_68); + _68 = &mut _67; StorageLive(_69); -- _69 = (*_67); -+ _69 = _66; + _69 = (*_67); StorageLive(_70); StorageLive(_71); _71 = (); @@ -436,8 +429,8 @@ StorageDead(_70); _0 = const (); StorageDead(_69); -- StorageDead(_68); -- StorageDead(_67); + StorageDead(_68); + StorageDead(_67); StorageDead(_66); return; } diff --git a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff index 05eab7989..ce5ddbfdd 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff @@ -45,8 +45,7 @@ debug a => _4; let _5: *const usize; scope 3 { -- debug b => _5; -+ debug b => &_4; + debug b => _5; let _6: usize; scope 4 { debug c => _6; @@ -175,12 +174,10 @@ debug a => _58; let _59: *const usize; scope 39 { -- debug b => _59; -+ debug b => &_58; + debug b => _59; let _60: *const usize; scope 40 { -- debug c => _60; -+ debug c => &_58; + debug c => _60; let _61: usize; scope 41 { debug e => _61; @@ -195,12 +192,10 @@ debug a => _65; let _66: *const usize; scope 44 { -- debug b => _66; -+ debug b => &_65; + debug b => _66; let _67: &*const usize; scope 45 { -- debug d => _67; -+ debug d => &&_65; + debug d => _67; let _68: usize; scope 46 { debug c => _68; @@ -215,12 +210,10 @@ debug a => _71; let mut _72: *const usize; scope 49 { -- debug b => _72; -+ debug b => &_71; + debug b => _72; let _73: &mut *const usize; scope 50 { -- debug d => _73; -+ debug d => &&_71; + debug d => _73; let _74: usize; scope 51 { debug c => _74; @@ -234,8 +227,8 @@ - StorageLive(_3); StorageLive(_4); _4 = const 5_usize; -- StorageLive(_5); -- _5 = &raw const _4; + StorageLive(_5); + _5 = &raw const _4; StorageLive(_6); - _6 = (*_5); + _6 = _4; @@ -250,7 +243,7 @@ StorageDead(_7); - _3 = const (); StorageDead(_6); -- StorageDead(_5); + StorageDead(_5); StorageDead(_4); - StorageDead(_3); - StorageLive(_9); @@ -427,10 +420,11 @@ - StorageLive(_57); StorageLive(_58); _58 = const 13_usize; -- StorageLive(_59); -- _59 = &raw const _58; -- StorageLive(_60); + StorageLive(_59); + _59 = &raw const _58; + StorageLive(_60); - _60 = &raw const (*_59); ++ _60 = &raw const _58; StorageLive(_61); - _61 = (*_60); + _61 = _58; @@ -445,20 +439,19 @@ StorageDead(_62); - _57 = const (); StorageDead(_61); -- StorageDead(_60); -- StorageDead(_59); + StorageDead(_60); + StorageDead(_59); StorageDead(_58); - StorageDead(_57); - StorageLive(_64); StorageLive(_65); _65 = const 5_usize; -- StorageLive(_66); -- _66 = &raw const _65; -- StorageLive(_67); -- _67 = &_66; + StorageLive(_66); + _66 = &raw const _65; + StorageLive(_67); + _67 = &_66; StorageLive(_68); -- _68 = (*_66); -+ _68 = _65; + _68 = (*_66); StorageLive(_69); StorageLive(_70); _70 = (); @@ -470,19 +463,18 @@ StorageDead(_69); - _64 = const (); StorageDead(_68); -- StorageDead(_67); -- StorageDead(_66); + StorageDead(_67); + StorageDead(_66); StorageDead(_65); - StorageDead(_64); StorageLive(_71); _71 = const 5_usize; -- StorageLive(_72); -- _72 = &raw const _71; -- StorageLive(_73); -- _73 = &mut _72; + StorageLive(_72); + _72 = &raw const _71; + StorageLive(_73); + _73 = &mut _72; StorageLive(_74); -- _74 = (*_72); -+ _74 = _71; + _74 = (*_72); StorageLive(_75); StorageLive(_76); _76 = (); @@ -494,8 +486,8 @@ StorageDead(_75); _0 = const (); StorageDead(_74); -- StorageDead(_73); -- StorageDead(_72); + StorageDead(_73); + StorageDead(_72); StorageDead(_71); return; } diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff index ee680fdb3..7c7f424bb 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff @@ -52,8 +52,7 @@ debug a => _4; let _5: &mut usize; scope 2 { -- debug b => _5; -+ debug b => &_4; + debug b => _5; let _6: usize; scope 3 { debug c => _6; @@ -158,12 +157,10 @@ debug a => _60; let _61: &mut usize; scope 30 { -- debug b => _61; -+ debug b => &_60; + debug b => _61; let _62: &&mut usize; scope 31 { -- debug d => _62; -+ debug d => &&_60; + debug d => _62; let _63: usize; scope 32 { debug c => _63; @@ -175,12 +172,10 @@ debug a => _66; let mut _67: &mut usize; scope 34 { -- debug b => _67; -+ debug b => &_66; + debug b => _67; let _68: &mut &mut usize; scope 35 { -- debug d => _68; -+ debug d => &&_66; + debug d => _68; let _69: usize; scope 36 { debug c => _69; @@ -193,8 +188,8 @@ - StorageLive(_3); StorageLive(_4); _4 = const 5_usize; -- StorageLive(_5); -- _5 = &mut _4; + StorageLive(_5); + _5 = &mut _4; StorageLive(_6); - _6 = (*_5); + _6 = _4; @@ -209,7 +204,7 @@ StorageDead(_7); - _3 = const (); StorageDead(_6); -- StorageDead(_5); + StorageDead(_5); StorageDead(_4); - StorageDead(_3); - StorageLive(_9); @@ -391,13 +386,12 @@ - StorageLive(_59); StorageLive(_60); _60 = const 5_usize; -- StorageLive(_61); -- _61 = &mut _60; -- StorageLive(_62); -- _62 = &_61; + StorageLive(_61); + _61 = &mut _60; + StorageLive(_62); + _62 = &_61; StorageLive(_63); -- _63 = (*_61); -+ _63 = _60; + _63 = (*_61); StorageLive(_64); StorageLive(_65); _65 = (); @@ -409,19 +403,18 @@ StorageDead(_64); - _59 = const (); StorageDead(_63); -- StorageDead(_62); -- StorageDead(_61); + StorageDead(_62); + StorageDead(_61); StorageDead(_60); - StorageDead(_59); StorageLive(_66); _66 = const 5_usize; -- StorageLive(_67); -- _67 = &mut _66; -- StorageLive(_68); -- _68 = &mut _67; + StorageLive(_67); + _67 = &mut _66; + StorageLive(_68); + _68 = &mut _67; StorageLive(_69); -- _69 = (*_67); -+ _69 = _66; + _69 = (*_67); StorageLive(_70); StorageLive(_71); _71 = (); @@ -433,8 +426,8 @@ StorageDead(_70); _0 = const (); StorageDead(_69); -- StorageDead(_68); -- StorageDead(_67); + StorageDead(_68); + StorageDead(_67); StorageDead(_66); return; } diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff index fb0ef3184..b6b2acc0b 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff @@ -42,8 +42,7 @@ debug a => _4; let _5: *mut usize; scope 3 { -- debug b => _5; -+ debug b => &_4; + debug b => _5; let _6: usize; scope 4 { debug c => _6; @@ -172,12 +171,10 @@ debug a => _58; let _59: *mut usize; scope 39 { -- debug b => _59; -+ debug b => &_58; + debug b => _59; let _60: &*mut usize; scope 40 { -- debug d => _60; -+ debug d => &&_58; + debug d => _60; let _61: usize; scope 41 { debug c => _61; @@ -192,12 +189,10 @@ debug a => _64; let mut _65: *mut usize; scope 44 { -- debug b => _65; -+ debug b => &_64; + debug b => _65; let _66: &mut *mut usize; scope 45 { -- debug d => _66; -+ debug d => &&_64; + debug d => _66; let _67: usize; scope 46 { debug c => _67; @@ -211,8 +206,8 @@ - StorageLive(_3); StorageLive(_4); _4 = const 5_usize; -- StorageLive(_5); -- _5 = &raw mut _4; + StorageLive(_5); + _5 = &raw mut _4; StorageLive(_6); - _6 = (*_5); + _6 = _4; @@ -227,7 +222,7 @@ StorageDead(_7); - _3 = const (); StorageDead(_6); -- StorageDead(_5); + StorageDead(_5); StorageDead(_4); - StorageDead(_3); - StorageLive(_9); @@ -401,13 +396,12 @@ - StorageLive(_57); StorageLive(_58); _58 = const 5_usize; -- StorageLive(_59); -- _59 = &raw mut _58; -- StorageLive(_60); -- _60 = &_59; + StorageLive(_59); + _59 = &raw mut _58; + StorageLive(_60); + _60 = &_59; StorageLive(_61); -- _61 = (*_59); -+ _61 = _58; + _61 = (*_59); StorageLive(_62); StorageLive(_63); _63 = (); @@ -419,19 +413,18 @@ StorageDead(_62); - _57 = const (); StorageDead(_61); -- StorageDead(_60); -- StorageDead(_59); + StorageDead(_60); + StorageDead(_59); StorageDead(_58); - StorageDead(_57); StorageLive(_64); _64 = const 5_usize; -- StorageLive(_65); -- _65 = &raw mut _64; -- StorageLive(_66); -- _66 = &mut _65; + StorageLive(_65); + _65 = &raw mut _64; + StorageLive(_66); + _66 = &mut _65; StorageLive(_67); -- _67 = (*_65); -+ _67 = _64; + _67 = (*_65); StorageLive(_68); StorageLive(_69); _69 = (); @@ -443,8 +436,8 @@ StorageDead(_68); _0 = const (); StorageDead(_67); -- StorageDead(_66); -- StorageDead(_65); + StorageDead(_66); + StorageDead(_65); StorageDead(_64); return; } diff --git a/tests/mir-opt/reference_prop.rs b/tests/mir-opt/reference_prop.rs index 4083b4547..610660131 100644 --- a/tests/mir-opt/reference_prop.rs +++ b/tests/mir-opt/reference_prop.rs @@ -426,7 +426,7 @@ fn multiple_storage() { // As there are multiple `StorageLive` statements for `x`, we cannot know if this `z`'s // pointer address is the address of `x`, so do nothing. let y = *z; - Call(RET, retblock, opaque(y)) + Call(RET = opaque(y), retblock) } retblock = { @@ -452,7 +452,7 @@ fn dominate_storage() { } bb1 = { let c = *r; - Call(RET, bb2, opaque(c)) + Call(RET = opaque(c), bb2) } bb2 = { StorageDead(x); @@ -486,18 +486,18 @@ fn maybe_dead(m: bool) { bb1 = { StorageDead(x); StorageDead(y); - Call(RET, bb2, opaque(u)) + Call(RET = opaque(u), bb2) } bb2 = { // As `x` may be `StorageDead`, `a` may be dangling, so we do nothing. let z = *a; - Call(RET, bb3, opaque(z)) + Call(RET = opaque(z), bb3) } bb3 = { // As `y` may be `StorageDead`, `b` may be dangling, so we do nothing. // This implies that we also do not substitute `b` in `bb0`. let t = *b; - Call(RET, retblock, opaque(t)) + Call(RET = opaque(t), retblock) } retblock = { Return() |