]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/inline/inline_generator.main.Inline.diff
Rollup merge of #89876 - AlexApps99:const_ops, r=oli-obk
[rust.git] / src / test / mir-opt / inline / inline_generator.main.Inline.diff
1 - // MIR for `main` before Inline
2 + // MIR for `main` after Inline
3   
4   fn main() -> () {
5       let mut _0: ();                      // return place in scope 0 at $DIR/inline-generator.rs:8:11: 8:11
6       let _1: std::ops::GeneratorState<i32, bool>; // in scope 0 at $DIR/inline-generator.rs:9:9: 9:11
7       let mut _2: std::pin::Pin<&mut [generator@$DIR/inline-generator.rs:15:5: 15:41]>; // in scope 0 at $DIR/inline-generator.rs:9:14: 9:32
8       let mut _3: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41]; // in scope 0 at $DIR/inline-generator.rs:9:23: 9:31
9       let mut _4: [generator@$DIR/inline-generator.rs:15:5: 15:41]; // in scope 0 at $DIR/inline-generator.rs:9:28: 9:31
10 +     let mut _7: bool;                    // in scope 0 at $DIR/inline-generator.rs:9:14: 9:46
11       scope 1 {
12           debug _r => _1;                  // in scope 1 at $DIR/inline-generator.rs:9:9: 9:11
13       }
14 +     scope 2 (inlined g) {                // at $DIR/inline-generator.rs:9:28: 9:31
15 +     }
16 +     scope 3 (inlined Pin::<&mut [generator@$DIR/inline-generator.rs:15:5: 15:41]>::new) { // at $DIR/inline-generator.rs:9:14: 9:32
17 +         debug pointer => _3;             // in scope 3 at $DIR/inline-generator.rs:9:14: 9:32
18 +         let mut _5: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41]; // in scope 3 at $DIR/inline-generator.rs:9:14: 9:32
19 +         scope 4 {
20 +             scope 5 (inlined Pin::<&mut [generator@$DIR/inline-generator.rs:15:5: 15:41]>::new_unchecked) { // at $DIR/inline-generator.rs:9:14: 9:32
21 +                 debug pointer => _5;     // in scope 5 at $DIR/inline-generator.rs:9:14: 9:32
22 +                 let mut _6: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41]; // in scope 5 at $DIR/inline-generator.rs:9:14: 9:32
23 +             }
24 +         }
25 +     }
26 +     scope 6 (inlined g::{closure#0}) {   // at $DIR/inline-generator.rs:9:14: 9:46
27 +         debug a => _11;                  // in scope 6 at $DIR/inline-generator.rs:9:14: 9:46
28 +         let mut _8: i32;                 // in scope 6 at $DIR/inline-generator.rs:9:14: 9:46
29 +         let mut _9: bool;                // in scope 6 at $DIR/inline-generator.rs:9:14: 9:46
30 +         let mut _10: bool;               // in scope 6 at $DIR/inline-generator.rs:9:14: 9:46
31 +         let _11: bool;                   // in scope 6 at $DIR/inline-generator.rs:9:14: 9:46
32 +         let mut _12: u32;                // in scope 6 at $DIR/inline-generator.rs:9:14: 9:46
33 +     }
34   
35       bb0: {
36           StorageLive(_1);                 // scope 0 at $DIR/inline-generator.rs:9:9: 9:11
37           StorageLive(_2);                 // scope 0 at $DIR/inline-generator.rs:9:14: 9:32
38           StorageLive(_3);                 // scope 0 at $DIR/inline-generator.rs:9:23: 9:31
39           StorageLive(_4);                 // scope 0 at $DIR/inline-generator.rs:9:28: 9:31
40 -         _4 = g() -> bb1;                 // scope 0 at $DIR/inline-generator.rs:9:28: 9:31
41 -                                          // mir::Constant
42 -                                          // + span: $DIR/inline-generator.rs:9:28: 9:29
43 -                                          // + literal: Const { ty: fn() -> impl std::ops::Generator<bool> {g}, val: Value(Scalar(<ZST>)) }
44 -     }
45
46 -     bb1: {
47 +         discriminant(_4) = 0;            // scope 2 at $DIR/inline-generator.rs:9:28: 9:31
48           _3 = &mut _4;                    // scope 0 at $DIR/inline-generator.rs:9:23: 9:31
49 -         _2 = Pin::<&mut impl Generator<bool>>::new(move _3) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/inline-generator.rs:9:14: 9:32
50 -                                          // mir::Constant
51 -                                          // + span: $DIR/inline-generator.rs:9:14: 9:22
52 -                                          // + user_ty: UserType(0)
53 -                                          // + literal: Const { ty: fn(&mut impl std::ops::Generator<bool>) -> std::pin::Pin<&mut impl std::ops::Generator<bool>> {std::pin::Pin::<&mut impl std::ops::Generator<bool>>::new}, val: Value(Scalar(<ZST>)) }
54 -     }
55
56 -     bb2: {
57 +         StorageLive(_5);                 // scope 4 at $DIR/inline-generator.rs:9:14: 9:32
58 +         _5 = move _3;                    // scope 4 at $DIR/inline-generator.rs:9:14: 9:32
59 +         StorageLive(_6);                 // scope 5 at $DIR/inline-generator.rs:9:14: 9:32
60 +         _6 = move _5;                    // scope 5 at $DIR/inline-generator.rs:9:14: 9:32
61 +         (_2.0: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41]) = move _6; // scope 5 at $DIR/inline-generator.rs:9:14: 9:32
62 +         StorageDead(_6);                 // scope 5 at $DIR/inline-generator.rs:9:14: 9:32
63 +         StorageDead(_5);                 // scope 4 at $DIR/inline-generator.rs:9:14: 9:32
64           StorageDead(_3);                 // scope 0 at $DIR/inline-generator.rs:9:31: 9:32
65 -         _1 = <impl Generator<bool> as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/inline-generator.rs:9:14: 9:46
66 -                                          // mir::Constant
67 -                                          // + span: $DIR/inline-generator.rs:9:33: 9:39
68 -                                          // + literal: Const { ty: for<'r> fn(std::pin::Pin<&'r mut impl std::ops::Generator<bool>>, bool) -> std::ops::GeneratorState<<impl std::ops::Generator<bool> as std::ops::Generator<bool>>::Yield, <impl std::ops::Generator<bool> as std::ops::Generator<bool>>::Return> {<impl std::ops::Generator<bool> as std::ops::Generator<bool>>::resume}, val: Value(Scalar(<ZST>)) }
69 +         StorageLive(_7);                 // scope 0 at $DIR/inline-generator.rs:9:14: 9:46
70 +         _7 = const false;                // scope 0 at $DIR/inline-generator.rs:9:14: 9:46
71 +         StorageLive(_10);                // scope 0 at $DIR/inline-generator.rs:9:14: 9:46
72 +         StorageLive(_11);                // scope 0 at $DIR/inline-generator.rs:9:14: 9:46
73 +         StorageLive(_12);                // scope 0 at $DIR/inline-generator.rs:9:14: 9:46
74 +         _12 = discriminant((*(_2.0: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41]))); // scope 6 at $DIR/inline-generator.rs:9:14: 9:46
75 +         switchInt(move _12) -> [0_u32: bb3, 1_u32: bb8, 3_u32: bb7, otherwise: bb9]; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46
76       }
77   
78 -     bb3: {
79 +     bb1: {
80 +         StorageDead(_12);                // scope 0 at $DIR/inline-generator.rs:9:14: 9:46
81 +         StorageDead(_11);                // scope 0 at $DIR/inline-generator.rs:9:14: 9:46
82 +         StorageDead(_10);                // scope 0 at $DIR/inline-generator.rs:9:14: 9:46
83 +         StorageDead(_7);                 // scope 0 at $DIR/inline-generator.rs:9:14: 9:46
84           StorageDead(_2);                 // scope 0 at $DIR/inline-generator.rs:9:45: 9:46
85           StorageDead(_4);                 // scope 0 at $DIR/inline-generator.rs:9:46: 9:47
86           _0 = const ();                   // scope 0 at $DIR/inline-generator.rs:8:11: 10:2
87           StorageDead(_1);                 // scope 0 at $DIR/inline-generator.rs:10:1: 10:2
88           return;                          // scope 0 at $DIR/inline-generator.rs:10:2: 10:2
89       }
90   
91 -     bb4 (cleanup): {
92 +     bb2 (cleanup): {
93           resume;                          // scope 0 at $DIR/inline-generator.rs:8:1: 10:2
94 +     }
95
96 +     bb3: {
97 +         _11 = move _7;                   // scope 6 at $DIR/inline-generator.rs:9:14: 9:46
98 +         StorageLive(_8);                 // scope 6 at $DIR/inline-generator.rs:9:14: 9:46
99 +         StorageLive(_9);                 // scope 6 at $DIR/inline-generator.rs:9:14: 9:46
100 +         _9 = _11;                        // scope 6 at $DIR/inline-generator.rs:9:14: 9:46
101 +         switchInt(move _9) -> [false: bb5, otherwise: bb4]; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46
102 +     }
103
104 +     bb4: {
105 +         _8 = const 7_i32;                // scope 6 at $DIR/inline-generator.rs:9:14: 9:46
106 +         goto -> bb6;                     // scope 6 at $DIR/inline-generator.rs:9:14: 9:46
107 +     }
108
109 +     bb5: {
110 +         _8 = const 13_i32;               // scope 6 at $DIR/inline-generator.rs:9:14: 9:46
111 +         goto -> bb6;                     // scope 6 at $DIR/inline-generator.rs:9:14: 9:46
112 +     }
113
114 +     bb6: {
115 +         StorageDead(_9);                 // scope 6 at $DIR/inline-generator.rs:9:14: 9:46
116 +         ((_1 as Yielded).0: i32) = move _8; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46
117 +         discriminant(_1) = 0;            // scope 6 at $DIR/inline-generator.rs:9:14: 9:46
118 +         discriminant((*(_2.0: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41]))) = 3; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46
119 +         goto -> bb1;                     // scope 0 at $DIR/inline-generator.rs:15:11: 15:39
120 +     }
121
122 +     bb7: {
123 +         StorageLive(_8);                 // scope 6 at $DIR/inline-generator.rs:9:14: 9:46
124 +         _10 = move _7;                   // scope 6 at $DIR/inline-generator.rs:9:14: 9:46
125 +         StorageDead(_8);                 // scope 6 at $DIR/inline-generator.rs:9:14: 9:46
126 +         ((_1 as Complete).0: bool) = move _10; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46
127 +         discriminant(_1) = 1;            // scope 6 at $DIR/inline-generator.rs:9:14: 9:46
128 +         discriminant((*(_2.0: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41]))) = 1; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46
129 +         goto -> bb1;                     // scope 0 at $DIR/inline-generator.rs:15:41: 15:41
130 +     }
131
132 +     bb8: {
133 +         assert(const false, "generator resumed after completion") -> [success: bb8, unwind: bb2]; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46
134 +     }
135
136 +     bb9: {
137 +         unreachable;                     // scope 6 at $DIR/inline-generator.rs:9:14: 9:46
138       }
139   }
140