From d989e14cf2885b483a443875a0974ca25e902f24 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sat, 28 Jan 2023 18:49:48 +0000 Subject: [PATCH] Bless mir-opt --- ...await.a-{closure#0}.generator_resume.0.mir | 16 +++-- ...await.b-{closure#0}.generator_resume.0.mir | 20 +++--- ...ine_generator.main.Inline.panic-abort.diff | 71 ++++++++++--------- ...ne_generator.main.Inline.panic-unwind.diff | 44 +++++++----- 4 files changed, 90 insertions(+), 61 deletions(-) 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 51e0faf17334a..98b1befc3bfa2 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 @@ -18,22 +18,30 @@ fn a::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}> bb0: { _5 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16}))); - switchInt(move _5) -> [0: bb1, 1: bb2, otherwise: bb3]; + switchInt(move _5) -> [0: bb1, 1: bb4, otherwise: bb5]; } bb1: { _4 = move _2; _3 = const (); + goto -> bb3; + } + + bb2: { _0 = Poll::<()>::Ready(move _3); discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16}))) = 1; return; } - bb2: { - assert(const false, "`async fn` resumed after completion") -> [success: bb2, unwind unreachable]; + bb3: { + goto -> bb2; } - bb3: { + bb4: { + assert(const false, "`async fn` resumed after completion") -> [success: bb4, unwind unreachable]; + } + + bb5: { unreachable; } } 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 0c46c60a2dabf..4d3baee7f117f 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 @@ -104,7 +104,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, bb0: { _39 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2}))); - switchInt(move _39) -> [0: bb1, 1: bb28, 3: bb26, 4: bb27, otherwise: bb29]; + switchInt(move _39) -> [0: bb1, 1: bb29, 3: bb27, 4: bb28, otherwise: bb30]; } bb1: { @@ -187,7 +187,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, StorageDead(_12); StorageDead(_9); StorageDead(_8); - goto -> bb12; + drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: impl std::future::Future)) -> [return: bb12, unwind unreachable]; } bb11: { @@ -279,7 +279,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, StorageDead(_28); StorageDead(_25); StorageDead(_24); - goto -> bb23; + drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: impl std::future::Future)) -> [return: bb23, unwind unreachable]; } bb22: { @@ -297,7 +297,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, bb24: { StorageDead(_21); - goto -> bb25; + goto -> bb26; } bb25: { @@ -307,6 +307,10 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, } bb26: { + goto -> bb25; + } + + bb27: { StorageLive(_3); StorageLive(_4); StorageLive(_19); @@ -315,7 +319,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, goto -> bb11; } - bb27: { + bb28: { StorageLive(_21); StorageLive(_35); StorageLive(_36); @@ -323,11 +327,11 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, goto -> bb22; } - bb28: { - assert(const false, "`async fn` resumed after completion") -> [success: bb28, unwind unreachable]; + bb29: { + assert(const false, "`async fn` resumed after completion") -> [success: bb29, unwind unreachable]; } - bb29: { + bb30: { unreachable; } } diff --git a/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff index d2c0591cc0ac8..3f093a02dd2a3 100644 --- a/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff @@ -36,62 +36,67 @@ StorageLive(_3); StorageLive(_4); - _4 = g() -> [return: bb1, unwind unreachable]; -- } -- -- bb1: { + _4 = {generator@$DIR/inline_generator.rs:16:5: 16:8 (#0)}; - _3 = &mut _4; -- _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new(move _3) -> [return: bb2, unwind unreachable]; -- } -- -- bb2: { ++ _3 = &mut _4; + _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}> { pointer: move _3 }; - StorageDead(_3); -- _1 = <{generator@$DIR/inline_generator.rs:16:5: 16:8} as Generator>::resume(move _2, const false) -> [return: bb3, unwind unreachable]; ++ StorageDead(_3); + StorageLive(_5); + _5 = const false; + _6 = deref_copy (_2.0: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8}); + _7 = discriminant((*_6)); -+ switchInt(move _7) -> [0: bb2, 1: bb6, 3: bb7, otherwise: bb8]; ++ switchInt(move _7) -> [0: bb3, 1: bb7, 3: bb8, otherwise: bb9]; } -- bb3: { -+ bb1: { + bb1: { +- _3 = &mut _4; +- _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new(move _3) -> [return: bb2, unwind unreachable]; + StorageDead(_5); - StorageDead(_2); - StorageDead(_4); - _0 = const (); - StorageDead(_1); - return; -+ } -+ -+ bb2: { ++ StorageDead(_2); ++ drop(_4) -> [return: bb2, unwind unreachable]; + } + + bb2: { +- StorageDead(_3); +- _1 = <{generator@$DIR/inline_generator.rs:16:5: 16:8} as Generator>::resume(move _2, const false) -> [return: bb3, unwind unreachable]; ++ StorageDead(_4); ++ _0 = const (); ++ StorageDead(_1); ++ return; + } + + bb3: { +- StorageDead(_2); +- drop(_4) -> [return: bb4, unwind unreachable]; + StorageLive(_8); -+ switchInt(_5) -> [0: bb3, otherwise: bb4]; -+ } -+ -+ bb3: { ++ switchInt(_5) -> [0: bb4, otherwise: bb5]; + } + + bb4: { +- StorageDead(_4); +- _0 = const (); +- StorageDead(_1); +- return; + _8 = const 13_i32; -+ goto -> bb5; ++ goto -> bb6; + } + -+ bb4: { ++ bb5: { + _8 = const 7_i32; -+ goto -> bb5; ++ goto -> bb6; + } + -+ bb5: { ++ bb6: { + _1 = GeneratorState::::Yielded(move _8); + _9 = deref_copy (_2.0: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8}); + discriminant((*_9)) = 3; + goto -> bb1; + } + -+ bb6: { -+ assert(const false, "generator resumed after completion") -> [success: bb6, unwind unreachable]; ++ bb7: { ++ assert(const false, "generator resumed after completion") -> [success: bb7, unwind unreachable]; + } + -+ bb7: { ++ bb8: { + StorageLive(_8); + StorageDead(_8); + _1 = GeneratorState::::Complete(_5); @@ -100,7 +105,7 @@ + goto -> bb1; + } + -+ bb8: { ++ bb9: { + unreachable; } } diff --git a/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff index c024e3d7f7737..3d76262c266f2 100644 --- a/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff @@ -41,62 +41,74 @@ - bb1: { + _4 = {generator@$DIR/inline_generator.rs:16:5: 16:8 (#0)}; _3 = &mut _4; -- _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new(move _3) -> [return: bb2, unwind: bb4]; +- _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new(move _3) -> [return: bb2, unwind: bb5]; - } - - bb2: { + _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}> { pointer: move _3 }; StorageDead(_3); -- _1 = <{generator@$DIR/inline_generator.rs:16:5: 16:8} as Generator>::resume(move _2, const false) -> [return: bb3, unwind: bb4]; +- _1 = <{generator@$DIR/inline_generator.rs:16:5: 16:8} as Generator>::resume(move _2, const false) -> [return: bb3, unwind: bb5]; + StorageLive(_5); + _5 = const false; + _6 = deref_copy (_2.0: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8}); + _7 = discriminant((*_6)); -+ switchInt(move _7) -> [0: bb3, 1: bb7, 3: bb8, otherwise: bb9]; ++ switchInt(move _7) -> [0: bb5, 1: bb9, 3: bb10, otherwise: bb11]; } - bb3: { + bb1: { + StorageDead(_5); StorageDead(_2); +- drop(_4) -> [return: bb4, unwind: bb6]; ++ drop(_4) -> [return: bb2, unwind: bb4]; + } + +- bb4: { ++ bb2: { StorageDead(_4); _0 = const (); StorageDead(_1); return; } -- bb4 (cleanup): { -+ bb2 (cleanup): { +- bb5 (cleanup): { +- drop(_4) -> [return: bb6, unwind terminate(cleanup)]; ++ bb3 (cleanup): { ++ drop(_4) -> [return: bb4, unwind terminate(cleanup)]; + } + +- bb6 (cleanup): { ++ bb4 (cleanup): { resume; + } + -+ bb3: { ++ bb5: { + StorageLive(_8); -+ switchInt(_5) -> [0: bb4, otherwise: bb5]; ++ switchInt(_5) -> [0: bb6, otherwise: bb7]; + } + -+ bb4: { ++ bb6: { + _8 = const 13_i32; -+ goto -> bb6; ++ goto -> bb8; + } + -+ bb5: { ++ bb7: { + _8 = const 7_i32; -+ goto -> bb6; ++ goto -> bb8; + } + -+ bb6: { ++ bb8: { + _1 = GeneratorState::::Yielded(move _8); + _9 = deref_copy (_2.0: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8}); + discriminant((*_9)) = 3; + goto -> bb1; + } + -+ bb7: { -+ assert(const false, "generator resumed after completion") -> [success: bb7, unwind: bb2]; ++ bb9: { ++ assert(const false, "generator resumed after completion") -> [success: bb9, unwind: bb3]; + } + -+ bb8: { ++ bb10: { + StorageLive(_8); + StorageDead(_8); + _1 = GeneratorState::::Complete(_5); @@ -105,7 +117,7 @@ + goto -> bb1; + } + -+ bb9: { ++ bb11: { + unreachable; } }