diff options
| author | Nadrieril <nadrieril+git@gmail.com> | 2024-06-30 13:21:12 +0200 |
|---|---|---|
| committer | Nadrieril <nadrieril+git@gmail.com> | 2024-07-09 22:47:35 +0200 |
| commit | 3e030b38ef1593592d6f4eb4144630d9abeb43b4 (patch) | |
| tree | a55ff76f66f665856df8ed6310de59b24a323daf /tests/mir-opt/building | |
| parent | fc40247c6b8d67da1a48d0ee73f42d9a239d2ae0 (diff) | |
| download | rust-3e030b38ef1593592d6f4eb4144630d9abeb43b4.tar.gz rust-3e030b38ef1593592d6f4eb4144630d9abeb43b4.zip | |
Return the `otherwise_block` instead of passing it as argument
This saves a few blocks and matches the common `unpack!` paradigm.
Diffstat (limited to 'tests/mir-opt/building')
10 files changed, 210 insertions, 270 deletions
diff --git a/tests/mir-opt/building/issue_101867.main.built.after.mir b/tests/mir-opt/building/issue_101867.main.built.after.mir index 728b5b23c6a..5c50b3db5ca 100644 --- a/tests/mir-opt/building/issue_101867.main.built.after.mir +++ b/tests/mir-opt/building/issue_101867.main.built.after.mir @@ -27,13 +27,13 @@ fn main() -> () { StorageLive(_5); PlaceMention(_1); _6 = discriminant(_1); - switchInt(move _6) -> [1: bb5, otherwise: bb4]; + switchInt(move _6) -> [1: bb4, otherwise: bb3]; } bb1: { StorageLive(_3); StorageLive(_4); - _4 = begin_panic::<&str>(const "explicit panic") -> bb9; + _4 = begin_panic::<&str>(const "explicit panic") -> bb8; } bb2: { @@ -43,22 +43,18 @@ fn main() -> () { } bb3: { - goto -> bb8; + goto -> bb7; } bb4: { - goto -> bb3; + falseEdge -> [real: bb6, imaginary: bb3]; } bb5: { - falseEdge -> [real: bb7, imaginary: bb3]; + goto -> bb3; } bb6: { - goto -> bb4; - } - - bb7: { _5 = ((_1 as Some).0: u8); _0 = const (); StorageDead(_5); @@ -66,12 +62,12 @@ fn main() -> () { return; } - bb8: { + bb7: { StorageDead(_5); goto -> bb1; } - bb9 (cleanup): { + bb8 (cleanup): { resume; } } diff --git a/tests/mir-opt/building/issue_49232.main.built.after.mir b/tests/mir-opt/building/issue_49232.main.built.after.mir index ac7e530520a..d09a1748a8b 100644 --- a/tests/mir-opt/building/issue_49232.main.built.after.mir +++ b/tests/mir-opt/building/issue_49232.main.built.after.mir @@ -17,7 +17,7 @@ fn main() -> () { } bb1: { - falseUnwind -> [real: bb2, unwind: bb15]; + falseUnwind -> [real: bb2, unwind: bb14]; } bb2: { @@ -25,7 +25,7 @@ fn main() -> () { StorageLive(_3); _3 = const true; PlaceMention(_3); - switchInt(_3) -> [0: bb5, otherwise: bb7]; + switchInt(_3) -> [0: bb4, otherwise: bb6]; } bb3: { @@ -34,49 +34,45 @@ fn main() -> () { } bb4: { - goto -> bb3; + falseEdge -> [real: bb8, imaginary: bb6]; } bb5: { - falseEdge -> [real: bb9, imaginary: bb7]; + goto -> bb3; } bb6: { - goto -> bb4; + _0 = const (); + goto -> bb13; } bb7: { - _0 = const (); - goto -> bb14; + goto -> bb3; } bb8: { - goto -> bb4; + _2 = const 4_i32; + goto -> bb11; } bb9: { - _2 = const 4_i32; - goto -> bb12; + unreachable; } bb10: { - unreachable; + goto -> bb11; } bb11: { - goto -> bb12; - } - - bb12: { FakeRead(ForLet(None), _2); StorageDead(_3); StorageLive(_5); StorageLive(_6); _6 = &_2; - _5 = std::mem::drop::<&i32>(move _6) -> [return: bb13, unwind: bb15]; + _5 = std::mem::drop::<&i32>(move _6) -> [return: bb12, unwind: bb14]; } - bb13: { + bb12: { StorageDead(_6); StorageDead(_5); _1 = const (); @@ -84,13 +80,13 @@ fn main() -> () { goto -> bb1; } - bb14: { + bb13: { StorageDead(_3); StorageDead(_2); return; } - bb15 (cleanup): { + bb14 (cleanup): { resume; } } diff --git a/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir b/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir index 395b8b82bff..3e16efe6980 100644 --- a/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir +++ b/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir @@ -19,188 +19,180 @@ fn test_complex() -> () { bb0: { StorageLive(_1); StorageLive(_2); - _2 = E::f() -> [return: bb1, unwind: bb36]; + _2 = E::f() -> [return: bb1, unwind: bb34]; } bb1: { PlaceMention(_2); _3 = discriminant(_2); - switchInt(move _3) -> [0: bb4, otherwise: bb3]; + switchInt(move _3) -> [0: bb3, otherwise: bb2]; } bb2: { - goto -> bb22; + goto -> bb21; } bb3: { - goto -> bb2; + falseEdge -> [real: bb5, imaginary: bb2]; } bb4: { - falseEdge -> [real: bb6, imaginary: bb2]; + goto -> bb2; } bb5: { - goto -> bb3; + StorageLive(_4); + _4 = always_true() -> [return: bb6, unwind: bb34]; } bb6: { - StorageLive(_4); - _4 = always_true() -> [return: bb7, unwind: bb36]; + switchInt(move _4) -> [0: bb8, otherwise: bb7]; } bb7: { - switchInt(move _4) -> [0: bb9, otherwise: bb8]; - } - - bb8: { StorageLive(_5); StorageLive(_6); StorageLive(_7); _7 = Droppy(const 0_u8); _6 = (_7.0: u8); _5 = Gt(move _6, const 0_u8); - switchInt(move _5) -> [0: bb11, otherwise: bb10]; + switchInt(move _5) -> [0: bb10, otherwise: bb9]; + } + + bb8: { + goto -> bb14; } bb9: { - goto -> bb15; + drop(_7) -> [return: bb11, unwind: bb34]; } bb10: { - drop(_7) -> [return: bb12, unwind: bb36]; + goto -> bb12; } bb11: { - goto -> bb13; - } - - bb12: { StorageDead(_7); StorageDead(_6); - goto -> bb19; + goto -> bb18; } - bb13: { - drop(_7) -> [return: bb14, unwind: bb36]; + bb12: { + drop(_7) -> [return: bb13, unwind: bb34]; } - bb14: { + bb13: { StorageDead(_7); StorageDead(_6); - goto -> bb15; + goto -> bb14; } - bb15: { + bb14: { StorageLive(_8); StorageLive(_9); StorageLive(_10); _10 = Droppy(const 1_u8); _9 = (_10.0: u8); _8 = Gt(move _9, const 1_u8); - switchInt(move _8) -> [0: bb17, otherwise: bb16]; + switchInt(move _8) -> [0: bb16, otherwise: bb15]; } - bb16: { - drop(_10) -> [return: bb18, unwind: bb36]; + bb15: { + drop(_10) -> [return: bb17, unwind: bb34]; } - bb17: { - goto -> bb20; + bb16: { + goto -> bb19; } - bb18: { + bb17: { StorageDead(_10); StorageDead(_9); - goto -> bb19; + goto -> bb18; } - bb19: { + bb18: { _1 = const (); - goto -> bb23; + goto -> bb22; } - bb20: { - drop(_10) -> [return: bb21, unwind: bb36]; + bb19: { + drop(_10) -> [return: bb20, unwind: bb34]; } - bb21: { + bb20: { StorageDead(_10); StorageDead(_9); - goto -> bb22; + goto -> bb21; } - bb22: { + bb21: { _1 = const (); - goto -> bb23; + goto -> bb22; } - bb23: { + bb22: { StorageDead(_8); StorageDead(_5); StorageDead(_4); StorageDead(_2); StorageDead(_1); StorageLive(_11); - _11 = always_true() -> [return: bb24, unwind: bb36]; + _11 = always_true() -> [return: bb23, unwind: bb34]; + } + + bb23: { + switchInt(move _11) -> [0: bb25, otherwise: bb24]; } bb24: { - switchInt(move _11) -> [0: bb26, otherwise: bb25]; + goto -> bb32; } bb25: { - goto -> bb34; + goto -> bb26; } bb26: { - goto -> bb27; + StorageLive(_12); + _12 = E::f() -> [return: bb27, unwind: bb34]; } bb27: { - StorageLive(_12); - _12 = E::f() -> [return: bb28, unwind: bb36]; + PlaceMention(_12); + _13 = discriminant(_12); + switchInt(move _13) -> [1: bb29, otherwise: bb28]; } bb28: { - PlaceMention(_12); - _13 = discriminant(_12); - switchInt(move _13) -> [1: bb31, otherwise: bb30]; + goto -> bb32; } bb29: { - goto -> bb34; + falseEdge -> [real: bb31, imaginary: bb28]; } bb30: { - goto -> bb29; + goto -> bb28; } bb31: { - falseEdge -> [real: bb33, imaginary: bb29]; - } - - bb32: { - goto -> bb30; - } - - bb33: { _0 = const (); - goto -> bb35; + goto -> bb33; } - bb34: { + bb32: { _0 = const (); - goto -> bb35; + goto -> bb33; } - bb35: { + bb33: { StorageDead(_11); StorageDead(_12); return; } - bb36 (cleanup): { + bb34 (cleanup): { resume; } } diff --git a/tests/mir-opt/building/match/match_false_edges.full_tested_match.built.after.mir b/tests/mir-opt/building/match/match_false_edges.full_tested_match.built.after.mir index 623dd51c358..9ebfff18f48 100644 --- a/tests/mir-opt/building/match/match_false_edges.full_tested_match.built.after.mir +++ b/tests/mir-opt/building/match/match_false_edges.full_tested_match.built.after.mir @@ -28,7 +28,7 @@ fn full_tested_match() -> () { _2 = Option::<i32>::Some(const 42_i32); PlaceMention(_2); _4 = discriminant(_2); - switchInt(move _4) -> [0: bb6, 1: bb3, otherwise: bb2]; + switchInt(move _4) -> [0: bb5, 1: bb2, otherwise: bb1]; } bb1: { @@ -37,43 +37,39 @@ fn full_tested_match() -> () { } bb2: { - goto -> bb1; + falseEdge -> [real: bb7, imaginary: bb3]; } bb3: { - falseEdge -> [real: bb8, imaginary: bb4]; + falseEdge -> [real: bb12, imaginary: bb5]; } bb4: { - falseEdge -> [real: bb13, imaginary: bb6]; + goto -> bb1; } bb5: { - goto -> bb2; + _1 = (const 3_i32, const 3_i32); + goto -> bb13; } bb6: { - _1 = (const 3_i32, const 3_i32); - goto -> bb14; + goto -> bb1; } bb7: { - goto -> bb2; - } - - bb8: { StorageLive(_6); _6 = &((_2 as Some).0: i32); _3 = &fake shallow _2; StorageLive(_7); - _7 = guard() -> [return: bb9, unwind: bb17]; + _7 = guard() -> [return: bb8, unwind: bb15]; } - bb9: { - switchInt(move _7) -> [0: bb11, otherwise: bb10]; + bb8: { + switchInt(move _7) -> [0: bb10, otherwise: bb9]; } - bb10: { + bb9: { StorageDead(_7); FakeRead(ForMatchGuard, _3); FakeRead(ForGuardBinding, _6); @@ -85,20 +81,20 @@ fn full_tested_match() -> () { StorageDead(_8); StorageDead(_5); StorageDead(_6); - goto -> bb14; + goto -> bb13; } - bb11: { - goto -> bb12; + bb10: { + goto -> bb11; } - bb12: { + bb11: { StorageDead(_7); StorageDead(_6); - goto -> bb4; + goto -> bb3; } - bb13: { + bb12: { StorageLive(_9); _9 = ((_2 as Some).0: i32); StorageLive(_10); @@ -106,10 +102,10 @@ fn full_tested_match() -> () { _1 = (const 2_i32, move _10); StorageDead(_10); StorageDead(_9); - goto -> bb14; + goto -> bb13; } - bb14: { + bb13: { PlaceMention(_1); StorageDead(_2); StorageDead(_1); @@ -117,16 +113,12 @@ fn full_tested_match() -> () { return; } - bb15: { + bb14: { FakeRead(ForMatchedPlace(None), _1); unreachable; } - bb16: { - goto -> bb15; - } - - bb17 (cleanup): { + bb15 (cleanup): { resume; } } diff --git a/tests/mir-opt/building/match/match_false_edges.full_tested_match2.built.after.mir b/tests/mir-opt/building/match/match_false_edges.full_tested_match2.built.after.mir index 3cb037bf956..4d2989ea93e 100644 --- a/tests/mir-opt/building/match/match_false_edges.full_tested_match2.built.after.mir +++ b/tests/mir-opt/building/match/match_false_edges.full_tested_match2.built.after.mir @@ -28,7 +28,7 @@ fn full_tested_match2() -> () { _2 = Option::<i32>::Some(const 42_i32); PlaceMention(_2); _4 = discriminant(_2); - switchInt(move _4) -> [0: bb6, 1: bb3, otherwise: bb2]; + switchInt(move _4) -> [0: bb5, 1: bb2, otherwise: bb1]; } bb1: { @@ -37,14 +37,10 @@ fn full_tested_match2() -> () { } bb2: { - goto -> bb1; + falseEdge -> [real: bb7, imaginary: bb5]; } bb3: { - falseEdge -> [real: bb8, imaginary: bb6]; - } - - bb4: { StorageLive(_9); _9 = ((_2 as Some).0: i32); StorageLive(_10); @@ -52,34 +48,34 @@ fn full_tested_match2() -> () { _1 = (const 2_i32, move _10); StorageDead(_10); StorageDead(_9); - goto -> bb14; + goto -> bb13; + } + + bb4: { + goto -> bb1; } bb5: { - goto -> bb2; + falseEdge -> [real: bb12, imaginary: bb3]; } bb6: { - falseEdge -> [real: bb13, imaginary: bb4]; + goto -> bb1; } bb7: { - goto -> bb2; - } - - bb8: { StorageLive(_6); _6 = &((_2 as Some).0: i32); _3 = &fake shallow _2; StorageLive(_7); - _7 = guard() -> [return: bb9, unwind: bb17]; + _7 = guard() -> [return: bb8, unwind: bb15]; } - bb9: { - switchInt(move _7) -> [0: bb11, otherwise: bb10]; + bb8: { + switchInt(move _7) -> [0: bb10, otherwise: bb9]; } - bb10: { + bb9: { StorageDead(_7); FakeRead(ForMatchGuard, _3); FakeRead(ForGuardBinding, _6); @@ -91,25 +87,25 @@ fn full_tested_match2() -> () { StorageDead(_8); StorageDead(_5); StorageDead(_6); - goto -> bb14; + goto -> bb13; } - bb11: { - goto -> bb12; + bb10: { + goto -> bb11; } - bb12: { + bb11: { StorageDead(_7); StorageDead(_6); - falseEdge -> [real: bb4, imaginary: bb6]; + falseEdge -> [real: bb3, imaginary: bb5]; } - bb13: { + bb12: { _1 = (const 3_i32, const 3_i32); - goto -> bb14; + goto -> bb13; } - bb14: { + bb13: { PlaceMention(_1); StorageDead(_2); StorageDead(_1); @@ -117,16 +113,12 @@ fn full_tested_match2() -> () { return; } - bb15: { + bb14: { FakeRead(ForMatchedPlace(None), _1); unreachable; } - bb16: { - goto -> bb15; - } - - bb17 (cleanup): { + bb15 (cleanup): { resume; } } diff --git a/tests/mir-opt/building/match/match_false_edges.main.built.after.mir b/tests/mir-opt/building/match/match_false_edges.main.built.after.mir index 134517ad2ae..4ed93610706 100644 --- a/tests/mir-opt/building/match/match_false_edges.main.built.after.mir +++ b/tests/mir-opt/building/match/match_false_edges.main.built.after.mir @@ -39,64 +39,60 @@ fn main() -> () { _2 = Option::<i32>::Some(const 1_i32); PlaceMention(_2); _4 = discriminant(_2); - switchInt(move _4) -> [1: bb3, otherwise: bb2]; + switchInt(move _4) -> [1: bb2, otherwise: bb1]; } bb1: { - FakeRead(ForMatchedPlace(None), _2); - unreachable; + falseEdge -> [real: bb14, imaginary: bb4]; } bb2: { - falseEdge -> [real: bb15, imaginary: bb5]; + falseEdge -> [real: bb9, imaginary: bb1]; } bb3: { - falseEdge -> [real: bb10, imaginary: bb2]; + goto -> bb1; } bb4: { - goto -> bb2; - } - - bb5: { _5 = discriminant(_2); - switchInt(move _5) -> [1: bb7, otherwise: bb6]; + switchInt(move _5) -> [1: bb6, otherwise: bb5]; } - bb6: { + bb5: { StorageLive(_14); _14 = _2; _1 = const 4_i32; StorageDead(_14); - goto -> bb21; + goto -> bb20; + } + + bb6: { + falseEdge -> [real: bb15, imaginary: bb5]; } bb7: { - falseEdge -> [real: bb16, imaginary: bb6]; + goto -> bb5; } bb8: { - goto -> bb6; + FakeRead(ForMatchedPlace(None), _2); + unreachable; } bb9: { - goto -> bb1; - } - - bb10: { StorageLive(_7); _7 = &((_2 as Some).0: i32); _3 = &fake shallow _2; StorageLive(_8); - _8 = guard() -> [return: bb11, unwind: bb24]; + _8 = guard() -> [return: bb10, unwind: bb22]; } - bb11: { - switchInt(move _8) -> [0: bb13, otherwise: bb12]; + bb10: { + switchInt(move _8) -> [0: bb12, otherwise: bb11]; } - bb12: { + bb11: { StorageDead(_8); FakeRead(ForMatchGuard, _3); FakeRead(ForGuardBinding, _7); @@ -105,42 +101,42 @@ fn main() -> () { _1 = const 1_i32; StorageDead(_6); StorageDead(_7); - goto -> bb21; + goto -> bb20; } - bb13: { - goto -> bb14; + bb12: { + goto -> bb13; } - bb14: { + bb13: { StorageDead(_8); StorageDead(_7); - falseEdge -> [real: bb4, imaginary: bb2]; + falseEdge -> [real: bb3, imaginary: bb1]; } - bb15: { + bb14: { StorageLive(_9); _9 = _2; _1 = const 2_i32; StorageDead(_9); - goto -> bb21; + goto -> bb20; } - bb16: { + bb15: { StorageLive(_11); _11 = &((_2 as Some).0: i32); _3 = &fake shallow _2; StorageLive(_12); StorageLive(_13); _13 = (*_11); - _12 = guard2(move _13) -> [return: bb17, unwind: bb24]; + _12 = guard2(move _13) -> [return: bb16, unwind: bb22]; } - bb17: { - switchInt(move _12) -> [0: bb19, otherwise: bb18]; + bb16: { + switchInt(move _12) -> [0: bb18, otherwise: bb17]; } - bb18: { + bb17: { StorageDead(_13); StorageDead(_12); FakeRead(ForMatchGuard, _3); @@ -150,21 +146,21 @@ fn main() -> () { _1 = const 3_i32; StorageDead(_10); StorageDead(_11); - goto -> bb21; + goto -> bb20; } - bb19: { - goto -> bb20; + bb18: { + goto -> bb19; } - bb20: { + bb19: { StorageDead(_13); StorageDead(_12); StorageDead(_11); - falseEdge -> [real: bb8, imaginary: bb6]; + falseEdge -> [real: bb7, imaginary: bb5]; } - bb21: { + bb20: { PlaceMention(_1); StorageDead(_2); StorageDead(_1); @@ -172,16 +168,12 @@ fn main() -> () { return; } - bb22: { + bb21: { FakeRead(ForMatchedPlace(None), _1); unreachable; } - bb23: { - goto -> bb22; - } - - bb24 (cleanup): { + bb22 (cleanup): { resume; } } diff --git a/tests/mir-opt/building/match/simple_match.match_bool.built.after.mir b/tests/mir-opt/building/match/simple_match.match_bool.built.after.mir index 81b5ce304d0..b0ebdc37b06 100644 --- a/tests/mir-opt/building/match/simple_match.match_bool.built.after.mir +++ b/tests/mir-opt/building/match/simple_match.match_bool.built.after.mir @@ -6,37 +6,33 @@ fn match_bool(_1: bool) -> usize { bb0: { PlaceMention(_1); - switchInt(_1) -> [0: bb2, otherwise: bb3]; + switchInt(_1) -> [0: bb1, otherwise: bb2]; } bb1: { - FakeRead(ForMatchedPlace(None), _1); - unreachable; + _0 = const 20_usize; + goto -> bb6; } bb2: { - _0 = const 20_usize; - goto -> bb7; + falseEdge -> [real: bb5, imaginary: bb1]; } bb3: { - falseEdge -> [real: bb6, imaginary: bb2]; + goto -> bb1; } bb4: { - goto -> bb2; + FakeRead(ForMatchedPlace(None), _1); + unreachable; } bb5: { - goto -> bb1; - } - - bb6: { _0 = const 10_usize; - goto -> bb7; + goto -> bb6; } - bb7: { + bb6: { return; } } diff --git a/tests/mir-opt/building/match/simple_match.match_enum.built.after.mir b/tests/mir-opt/building/match/simple_match.match_enum.built.after.mir index c2ea5bd441c..5e685f43cd6 100644 --- a/tests/mir-opt/building/match/simple_match.match_enum.built.after.mir +++ b/tests/mir-opt/building/match/simple_match.match_enum.built.after.mir @@ -8,7 +8,7 @@ fn match_enum(_1: E1) -> bool { bb0: { PlaceMention(_1); _2 = discriminant(_1); - switchInt(move _2) -> [0: bb4, 1: bb6, 2: bb8, otherwise: bb3]; + switchInt(move _2) -> [0: bb2, 1: bb4, 2: bb6, otherwise: bb1]; } bb1: { @@ -17,48 +17,40 @@ fn match_enum(_1: E1) -> bool { } bb2: { - goto -> bb1; + goto -> bb8; } bb3: { - goto -> bb2; + goto -> bb1; } bb4: { - goto -> bb10; + goto -> bb8; } bb5: { - goto -> bb3; + goto -> bb1; } bb6: { + _0 = const false; goto -> bb10; } bb7: { - goto -> bb3; + goto -> bb1; } bb8: { - _0 = const false; - goto -> bb12; + falseEdge -> [real: bb9, imaginary: bb6]; } bb9: { - goto -> bb3; - } - - bb10: { - falseEdge -> [real: bb11, imaginary: bb8]; - } - - bb11: { _0 = const true; - goto -> bb12; + goto -> bb10; } - bb12: { + bb10: { return; } } diff --git a/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir b/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir index db758368a13..6d3b2cf2910 100644 --- a/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir +++ b/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir @@ -26,7 +26,7 @@ fn move_out_by_subslice() -> () { StorageLive(_2); _3 = SizeOf(i32); _4 = AlignOf(i32); - _5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb14]; + _5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb13]; } bb1: { @@ -34,7 +34,7 @@ fn move_out_by_subslice() -> () { _6 = ShallowInitBox(move _5, i32); (*_6) = const 1_i32; _2 = move _6; - drop(_6) -> [return: bb2, unwind: bb13]; + drop(_6) -> [return: bb2, unwind: bb12]; } bb2: { @@ -42,7 +42,7 @@ fn move_out_by_subslice() -> () { StorageLive(_7); _8 = SizeOf(i32); _9 = AlignOf(i32); - _10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb13]; + _10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb12]; } bb3: { @@ -50,18 +50,18 @@ fn move_out_by_subslice() -> () { _11 = ShallowInitBox(move _10, i32); (*_11) = const 2_i32; _7 = move _11; - drop(_11) -> [return: bb4, unwind: bb12]; + drop(_11) -> [return: bb4, unwind: bb11]; } bb4: { StorageDead(_11); _1 = [move _2, move _7]; - drop(_7) -> [return: bb5, unwind: bb13]; + drop(_7) -> [return: bb5, unwind: bb12]; } bb5: { StorageDead(_7); - drop(_2) -> [return: bb6, unwind: bb14]; + drop(_2) -> [return: bb6, unwind: bb13]; } bb6: { @@ -71,7 +71,7 @@ fn move_out_by_subslice() -> () { StorageLive(_12); _12 = move _1[0..2]; _0 = const (); - drop(_12) -> [return: bb9, unwind: bb11]; + drop(_12) -> [return: bb8, unwind: bb10]; } bb7: { @@ -80,32 +80,28 @@ fn move_out_by_subslice() -> () { } bb8: { - goto -> bb7; - } - - bb9: { StorageDead(_12); - drop(_1) -> [return: bb10, unwind: bb14]; + drop(_1) -> [return: bb9, unwind: bb13]; } - bb10: { + bb9: { StorageDead(_1); return; } + bb10 (cleanup): { + drop(_1) -> [return: bb13, unwind terminate(cleanup)]; + } + bb11 (cleanup): { - drop(_1) -> [return: bb14, unwind terminate(cleanup)]; + drop(_7) -> [return: bb12, unwind terminate(cleanup)]; } bb12 (cleanup): { - drop(_7) -> [return: bb13, unwind terminate(cleanup)]; + drop(_2) -> [return: bb13, unwind terminate(cleanup)]; } bb13 (cleanup): { - drop(_2) -> [return: bb14, unwind terminate(cleanup)]; - } - - bb14 (cleanup): { resume; } } diff --git a/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir b/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir index 84cd557715c..003b90a912d 100644 --- a/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir +++ b/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir @@ -26,7 +26,7 @@ fn move_out_from_end() -> () { StorageLive(_2); _3 = SizeOf(i32); _4 = AlignOf(i32); - _5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb14]; + _5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb13]; } bb1: { @@ -34,7 +34,7 @@ fn move_out_from_end() -> () { _6 = ShallowInitBox(move _5, i32); (*_6) = const 1_i32; _2 = move _6; - drop(_6) -> [return: bb2, unwind: bb13]; + drop(_6) -> [return: bb2, unwind: bb12]; } bb2: { @@ -42,7 +42,7 @@ fn move_out_from_end() -> () { StorageLive(_7); _8 = SizeOf(i32); _9 = AlignOf(i32); - _10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb13]; + _10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb12]; } bb3: { @@ -50,18 +50,18 @@ fn move_out_from_end() -> () { _11 = ShallowInitBox(move _10, i32); (*_11) = const 2_i32; _7 = move _11; - drop(_11) -> [return: bb4, unwind: bb12]; + drop(_11) -> [return: bb4, unwind: bb11]; } bb4: { StorageDead(_11); _1 = [move _2, move _7]; - drop(_7) -> [return: bb5, unwind: bb13]; + drop(_7) -> [return: bb5, unwind: bb12]; } bb5: { StorageDead(_7); - drop(_2) -> [return: bb6, unwind: bb14]; + drop(_2) -> [return: bb6, unwind: bb13]; } bb6: { @@ -71,7 +71,7 @@ fn move_out_from_end() -> () { StorageLive(_12); _12 = move _1[1 of 2]; _0 = const (); - drop(_12) -> [return: bb9, unwind: bb11]; + drop(_12) -> [return: bb8, unwind: bb10]; } bb7: { @@ -80,32 +80,28 @@ fn move_out_from_end() -> () { } bb8: { - goto -> bb7; - } - - bb9: { StorageDead(_12); - drop(_1) -> [return: bb10, unwind: bb14]; + drop(_1) -> [return: bb9, unwind: bb13]; } - bb10: { + bb9: { StorageDead(_1); return; } + bb10 (cleanup): { + drop(_1) -> [return: bb13, unwind terminate(cleanup)]; + } + bb11 (cleanup): { - drop(_1) -> [return: bb14, unwind terminate(cleanup)]; + drop(_7) -> [return: bb12, unwind terminate(cleanup)]; } bb12 (cleanup): { - drop(_7) -> [return: bb13, unwind terminate(cleanup)]; + drop(_2) -> [return: bb13, unwind terminate(cleanup)]; } bb13 (cleanup): { - drop(_2) -> [return: bb14, unwind terminate(cleanup)]; - } - - bb14 (cleanup): { resume; } } |
