Bless mir-opt

This commit is contained in:
Camille GILLOT 2023-01-28 18:49:48 +00:00
parent 211d2ed07b
commit d989e14cf2
4 changed files with 97 additions and 68 deletions

View File

@ -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;
}
}

View File

@ -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<Output = ()>)) -> [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<Output = ()>)) -> [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;
}
}

View File

@ -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<bool>>::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<bool>>::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;
+ }
+
+ bb4: {
+ _8 = const 7_i32;
+ goto -> bb5;
+ goto -> bb6;
+ }
+
+ bb5: {
+ _8 = const 7_i32;
+ goto -> bb6;
+ }
+
+ bb6: {
+ _1 = GeneratorState::<i32, bool>::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::<i32, bool>::Complete(_5);
@ -100,7 +105,7 @@
+ goto -> bb1;
+ }
+
+ bb8: {
+ bb9: {
+ unreachable;
}
}

View File

@ -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<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb4];
- _1 = <{generator@$DIR/inline_generator.rs:16:5: 16:8} as Generator<bool>>::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: {
+ StorageLive(_8);
+ switchInt(_5) -> [0: bb4, otherwise: bb5];
+ }
+
+ bb4: {
+ _8 = const 13_i32;
+ goto -> bb6;
+ }
+
+ bb5: {
+ _8 = const 7_i32;
+ goto -> bb6;
+ StorageLive(_8);
+ switchInt(_5) -> [0: bb6, otherwise: bb7];
+ }
+
+ bb6: {
+ _8 = const 13_i32;
+ goto -> bb8;
+ }
+
+ bb7: {
+ _8 = const 7_i32;
+ goto -> bb8;
+ }
+
+ bb8: {
+ _1 = GeneratorState::<i32, bool>::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::<i32, bool>::Complete(_5);
@ -105,7 +117,7 @@
+ goto -> bb1;
+ }
+
+ bb9: {
+ bb11: {
+ unreachable;
}
}