rust/tests/mir-opt/inline/inline_generator.main.Inline.diff

133 lines
8.8 KiB
Diff
Raw Normal View History

2020-11-10 18:00:00 -06:00
- // MIR for `main` before Inline
+ // MIR for `main` after Inline
fn main() -> () {
2022-11-02 16:54:49 -05:00
let mut _0: (); // return place in scope 0 at $DIR/inline_generator.rs:+0:11: +0:11
let _1: std::ops::GeneratorState<i32, bool>; // in scope 0 at $DIR/inline_generator.rs:+1:9: +1:11
let mut _2: std::pin::Pin<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>; // in scope 0 at $DIR/inline_generator.rs:+1:14: +1:32
let mut _3: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 0 at $DIR/inline_generator.rs:+1:23: +1:31
let mut _4: [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 0 at $DIR/inline_generator.rs:+1:28: +1:31
+ let mut _5: bool; // in scope 0 at $DIR/inline_generator.rs:+1:33: +1:46
2020-11-10 18:00:00 -06:00
scope 1 {
2022-11-02 16:54:49 -05:00
debug _r => _1; // in scope 1 at $DIR/inline_generator.rs:+1:9: +1:11
2020-11-10 18:00:00 -06:00
}
2022-11-02 16:54:49 -05:00
+ scope 2 (inlined g) { // at $DIR/inline_generator.rs:9:28: 9:31
2020-11-10 18:00:00 -06:00
+ }
2022-11-02 16:54:49 -05:00
+ scope 3 (inlined Pin::<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>::new) { // at $DIR/inline_generator.rs:9:14: 9:32
+ debug pointer => _3; // in scope 3 at $SRC_DIR/core/src/pin.rs:LL:COL
2020-11-10 18:00:00 -06:00
+ scope 4 {
2022-11-02 16:54:49 -05:00
+ scope 5 (inlined Pin::<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>::new_unchecked) { // at $SRC_DIR/core/src/pin.rs:LL:COL
+ debug pointer => _3; // in scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
2020-11-10 18:00:00 -06:00
+ }
+ }
+ }
+ scope 6 (inlined g::{closure#0}) { // at $DIR/inline_generator.rs:9:33: 9:46
+ debug a => _5; // in scope 6 at $DIR/inline_generator.rs:15:6: 15:7
+ let mut _6: i32; // in scope 6 at $DIR/inline_generator.rs:15:17: 15:39
+ let mut _7: u32; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
+ let mut _8: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
+ let mut _9: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
+ let mut _10: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
2020-11-10 18:00:00 -06:00
+ }
bb0: {
2022-11-02 16:54:49 -05:00
StorageLive(_1); // scope 0 at $DIR/inline_generator.rs:+1:9: +1:11
StorageLive(_2); // scope 0 at $DIR/inline_generator.rs:+1:14: +1:32
StorageLive(_3); // scope 0 at $DIR/inline_generator.rs:+1:23: +1:31
StorageLive(_4); // scope 0 at $DIR/inline_generator.rs:+1:28: +1:31
- _4 = g() -> bb1; // scope 0 at $DIR/inline_generator.rs:+1:28: +1:31
2020-11-10 18:00:00 -06:00
- // mir::Constant
2022-11-02 16:54:49 -05:00
- // + span: $DIR/inline_generator.rs:9:28: 9:29
2022-07-06 09:14:46 -05:00
- // + literal: Const { ty: fn() -> impl Generator<bool> {g}, val: Value(<ZST>) }
2020-11-10 18:00:00 -06:00
- }
-
- bb1: {
2023-01-25 12:34:35 -06:00
+ _4 = [generator@$DIR/inline_generator.rs:15:5: 15:8 (#0)]; // scope 2 at $DIR/inline_generator.rs:15:5: 15:41
+ // generator
2023-02-11 10:51:04 -06:00
+ // + def_id: DefId(0:7 ~ inline_generator[e37e]::g::{closure#0})
2023-01-25 12:34:35 -06:00
+ // + substs: [
+ // bool,
+ // i32,
+ // bool,
+ // {bool, i32},
+ // (),
+ // ]
+ // + movability: Movable
2022-11-02 16:54:49 -05:00
_3 = &mut _4; // scope 0 at $DIR/inline_generator.rs:+1:23: +1:31
- _2 = Pin::<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>::new(move _3) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/inline_generator.rs:+1:14: +1:32
2020-11-10 18:00:00 -06:00
- // mir::Constant
2022-11-02 16:54:49 -05:00
- // + span: $DIR/inline_generator.rs:9:14: 9:22
2020-11-10 18:00:00 -06:00
- // + user_ty: UserType(0)
2022-11-02 16:54:49 -05:00
- // + literal: Const { ty: fn(&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]) -> Pin<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]> {Pin::<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>::new}, val: Value(<ZST>) }
2020-11-10 18:00:00 -06:00
- }
-
- bb2: {
+ _2 = Pin::<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]> { pointer: move _3 }; // scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
2022-11-02 16:54:49 -05:00
StorageDead(_3); // scope 0 at $DIR/inline_generator.rs:+1:31: +1:32
- _1 = <[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
2020-11-10 18:00:00 -06:00
- // mir::Constant
2022-11-02 16:54:49 -05:00
- // + span: $DIR/inline_generator.rs:9:33: 9:39
- // + literal: Const { ty: for<'a> fn(Pin<&'a mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>, bool) -> GeneratorState<<[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator<bool>>::Yield, <[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator<bool>>::Return> {<[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator<bool>>::resume}, val: Value(<ZST>) }
+ StorageLive(_5); // scope 0 at $DIR/inline_generator.rs:+1:33: +1:46
+ _5 = const false; // scope 0 at $DIR/inline_generator.rs:+1:33: +1:46
+ _8 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
+ _7 = discriminant((*_8)); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
+ switchInt(move _7) -> [0: bb3, 1: bb8, 3: bb7, otherwise: bb9]; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
2020-11-10 18:00:00 -06:00
}
- bb3: {
+ bb1: {
+ StorageDead(_5); // scope 0 at $DIR/inline_generator.rs:+1:33: +1:46
2022-11-02 16:54:49 -05:00
StorageDead(_2); // scope 0 at $DIR/inline_generator.rs:+1:45: +1:46
StorageDead(_4); // scope 0 at $DIR/inline_generator.rs:+1:46: +1:47
_0 = const (); // scope 0 at $DIR/inline_generator.rs:+0:11: +2:2
StorageDead(_1); // scope 0 at $DIR/inline_generator.rs:+2:1: +2:2
return; // scope 0 at $DIR/inline_generator.rs:+2:2: +2:2
2020-11-10 18:00:00 -06:00
}
- bb4 (cleanup): {
+ bb2 (cleanup): {
2022-11-02 16:54:49 -05:00
resume; // scope 0 at $DIR/inline_generator.rs:+0:1: +2:2
2020-11-10 18:00:00 -06:00
+ }
+
+ bb3: {
+ StorageLive(_6); // scope 6 at $DIR/inline_generator.rs:15:17: 15:39
+ switchInt(_5) -> [0: bb5, otherwise: bb4]; // scope 6 at $DIR/inline_generator.rs:15:20: 15:21
2020-11-10 18:00:00 -06:00
+ }
+
+ bb4: {
+ _6 = const 7_i32; // scope 6 at $DIR/inline_generator.rs:15:24: 15:25
2022-11-02 16:54:49 -05:00
+ goto -> bb6; // scope 6 at $DIR/inline_generator.rs:15:17: 15:39
2020-11-10 18:00:00 -06:00
+ }
+
+ bb5: {
+ _6 = const 13_i32; // scope 6 at $DIR/inline_generator.rs:15:35: 15:37
2022-11-02 16:54:49 -05:00
+ goto -> bb6; // scope 6 at $DIR/inline_generator.rs:15:17: 15:39
2020-11-10 18:00:00 -06:00
+ }
+
+ bb6: {
+ _1 = GeneratorState::<i32, bool>::Yielded(move _6); // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
+ _9 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
+ discriminant((*_9)) = 3; // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
2022-11-02 16:54:49 -05:00
+ goto -> bb1; // scope 0 at $DIR/inline_generator.rs:15:11: 15:39
2020-11-10 18:00:00 -06:00
+ }
+
+ bb7: {
+ StorageLive(_6); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
+ StorageDead(_6); // scope 6 at $DIR/inline_generator.rs:15:38: 15:39
+ _1 = GeneratorState::<i32, bool>::Complete(_5); // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
+ _10 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
+ discriminant((*_10)) = 1; // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
2022-11-02 16:54:49 -05:00
+ goto -> bb1; // scope 0 at $DIR/inline_generator.rs:15:41: 15:41
2020-11-10 18:00:00 -06:00
+ }
+
+ bb8: {
2022-11-02 16:54:49 -05:00
+ assert(const false, "generator resumed after completion") -> [success: bb8, unwind: bb2]; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
2020-11-10 18:00:00 -06:00
+ }
+
+ bb9: {
2022-11-02 16:54:49 -05:00
+ unreachable; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
2020-11-10 18:00:00 -06:00
}
}