Skip to content

Commit d989e14

Browse files
committed
Bless mir-opt
1 parent 211d2ed commit d989e14

4 files changed

+90
-61
lines changed

tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,30 @@ fn a::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>
1818

1919
bb0: {
2020
_5 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16})));
21-
switchInt(move _5) -> [0: bb1, 1: bb2, otherwise: bb3];
21+
switchInt(move _5) -> [0: bb1, 1: bb4, otherwise: bb5];
2222
}
2323

2424
bb1: {
2525
_4 = move _2;
2626
_3 = const ();
27+
goto -> bb3;
28+
}
29+
30+
bb2: {
2731
_0 = Poll::<()>::Ready(move _3);
2832
discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16}))) = 1;
2933
return;
3034
}
3135

32-
bb2: {
33-
assert(const false, "`async fn` resumed after completion") -> [success: bb2, unwind unreachable];
36+
bb3: {
37+
goto -> bb2;
3438
}
3539

36-
bb3: {
40+
bb4: {
41+
assert(const false, "`async fn` resumed after completion") -> [success: bb4, unwind unreachable];
42+
}
43+
44+
bb5: {
3745
unreachable;
3846
}
3947
}

tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>,
104104

105105
bb0: {
106106
_39 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})));
107-
switchInt(move _39) -> [0: bb1, 1: bb28, 3: bb26, 4: bb27, otherwise: bb29];
107+
switchInt(move _39) -> [0: bb1, 1: bb29, 3: bb27, 4: bb28, otherwise: bb30];
108108
}
109109

110110
bb1: {
@@ -187,7 +187,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>,
187187
StorageDead(_12);
188188
StorageDead(_9);
189189
StorageDead(_8);
190-
goto -> bb12;
190+
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];
191191
}
192192

193193
bb11: {
@@ -279,7 +279,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>,
279279
StorageDead(_28);
280280
StorageDead(_25);
281281
StorageDead(_24);
282-
goto -> bb23;
282+
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];
283283
}
284284

285285
bb22: {
@@ -297,7 +297,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>,
297297

298298
bb24: {
299299
StorageDead(_21);
300-
goto -> bb25;
300+
goto -> bb26;
301301
}
302302

303303
bb25: {
@@ -307,6 +307,10 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>,
307307
}
308308

309309
bb26: {
310+
goto -> bb25;
311+
}
312+
313+
bb27: {
310314
StorageLive(_3);
311315
StorageLive(_4);
312316
StorageLive(_19);
@@ -315,19 +319,19 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>,
315319
goto -> bb11;
316320
}
317321

318-
bb27: {
322+
bb28: {
319323
StorageLive(_21);
320324
StorageLive(_35);
321325
StorageLive(_36);
322326
_35 = move _2;
323327
goto -> bb22;
324328
}
325329

326-
bb28: {
327-
assert(const false, "`async fn` resumed after completion") -> [success: bb28, unwind unreachable];
330+
bb29: {
331+
assert(const false, "`async fn` resumed after completion") -> [success: bb29, unwind unreachable];
328332
}
329333

330-
bb29: {
334+
bb30: {
331335
unreachable;
332336
}
333337
}

tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -36,62 +36,67 @@
3636
StorageLive(_3);
3737
StorageLive(_4);
3838
- _4 = g() -> [return: bb1, unwind unreachable];
39-
- }
40-
-
41-
- bb1: {
4239
+ _4 = {generator@$DIR/inline_generator.rs:16:5: 16:8 (#0)};
43-
_3 = &mut _4;
44-
- _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new(move _3) -> [return: bb2, unwind unreachable];
45-
- }
46-
-
47-
- bb2: {
40+
+ _3 = &mut _4;
4841
+ _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}> { pointer: move _3 };
49-
StorageDead(_3);
50-
- _1 = <{generator@$DIR/inline_generator.rs:16:5: 16:8} as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind unreachable];
42+
+ StorageDead(_3);
5143
+ StorageLive(_5);
5244
+ _5 = const false;
5345
+ _6 = deref_copy (_2.0: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8});
5446
+ _7 = discriminant((*_6));
55-
+ switchInt(move _7) -> [0: bb2, 1: bb6, 3: bb7, otherwise: bb8];
47+
+ switchInt(move _7) -> [0: bb3, 1: bb7, 3: bb8, otherwise: bb9];
5648
}
5749

58-
- bb3: {
59-
+ bb1: {
50+
bb1: {
51+
- _3 = &mut _4;
52+
- _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new(move _3) -> [return: bb2, unwind unreachable];
6053
+ StorageDead(_5);
61-
StorageDead(_2);
62-
StorageDead(_4);
63-
_0 = const ();
64-
StorageDead(_1);
65-
return;
66-
+ }
67-
+
68-
+ bb2: {
54+
+ StorageDead(_2);
55+
+ drop(_4) -> [return: bb2, unwind unreachable];
56+
}
57+
58+
bb2: {
59+
- StorageDead(_3);
60+
- _1 = <{generator@$DIR/inline_generator.rs:16:5: 16:8} as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind unreachable];
61+
+ StorageDead(_4);
62+
+ _0 = const ();
63+
+ StorageDead(_1);
64+
+ return;
65+
}
66+
67+
bb3: {
68+
- StorageDead(_2);
69+
- drop(_4) -> [return: bb4, unwind unreachable];
6970
+ StorageLive(_8);
70-
+ switchInt(_5) -> [0: bb3, otherwise: bb4];
71-
+ }
72-
+
73-
+ bb3: {
71+
+ switchInt(_5) -> [0: bb4, otherwise: bb5];
72+
}
73+
74+
bb4: {
75+
- StorageDead(_4);
76+
- _0 = const ();
77+
- StorageDead(_1);
78+
- return;
7479
+ _8 = const 13_i32;
75-
+ goto -> bb5;
80+
+ goto -> bb6;
7681
+ }
7782
+
78-
+ bb4: {
83+
+ bb5: {
7984
+ _8 = const 7_i32;
80-
+ goto -> bb5;
85+
+ goto -> bb6;
8186
+ }
8287
+
83-
+ bb5: {
88+
+ bb6: {
8489
+ _1 = GeneratorState::<i32, bool>::Yielded(move _8);
8590
+ _9 = deref_copy (_2.0: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8});
8691
+ discriminant((*_9)) = 3;
8792
+ goto -> bb1;
8893
+ }
8994
+
90-
+ bb6: {
91-
+ assert(const false, "generator resumed after completion") -> [success: bb6, unwind unreachable];
95+
+ bb7: {
96+
+ assert(const false, "generator resumed after completion") -> [success: bb7, unwind unreachable];
9297
+ }
9398
+
94-
+ bb7: {
99+
+ bb8: {
95100
+ StorageLive(_8);
96101
+ StorageDead(_8);
97102
+ _1 = GeneratorState::<i32, bool>::Complete(_5);
@@ -100,7 +105,7 @@
100105
+ goto -> bb1;
101106
+ }
102107
+
103-
+ bb8: {
108+
+ bb9: {
104109
+ unreachable;
105110
}
106111
}

tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,62 +41,74 @@
4141
- bb1: {
4242
+ _4 = {generator@$DIR/inline_generator.rs:16:5: 16:8 (#0)};
4343
_3 = &mut _4;
44-
- _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new(move _3) -> [return: bb2, unwind: bb4];
44+
- _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new(move _3) -> [return: bb2, unwind: bb5];
4545
- }
4646
-
4747
- bb2: {
4848
+ _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}> { pointer: move _3 };
4949
StorageDead(_3);
50-
- _1 = <{generator@$DIR/inline_generator.rs:16:5: 16:8} as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb4];
50+
- _1 = <{generator@$DIR/inline_generator.rs:16:5: 16:8} as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb5];
5151
+ StorageLive(_5);
5252
+ _5 = const false;
5353
+ _6 = deref_copy (_2.0: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8});
5454
+ _7 = discriminant((*_6));
55-
+ switchInt(move _7) -> [0: bb3, 1: bb7, 3: bb8, otherwise: bb9];
55+
+ switchInt(move _7) -> [0: bb5, 1: bb9, 3: bb10, otherwise: bb11];
5656
}
5757

5858
- bb3: {
5959
+ bb1: {
6060
+ StorageDead(_5);
6161
StorageDead(_2);
62+
- drop(_4) -> [return: bb4, unwind: bb6];
63+
+ drop(_4) -> [return: bb2, unwind: bb4];
64+
}
65+
66+
- bb4: {
67+
+ bb2: {
6268
StorageDead(_4);
6369
_0 = const ();
6470
StorageDead(_1);
6571
return;
6672
}
6773

68-
- bb4 (cleanup): {
69-
+ bb2 (cleanup): {
74+
- bb5 (cleanup): {
75+
- drop(_4) -> [return: bb6, unwind terminate(cleanup)];
76+
+ bb3 (cleanup): {
77+
+ drop(_4) -> [return: bb4, unwind terminate(cleanup)];
78+
}
79+
80+
- bb6 (cleanup): {
81+
+ bb4 (cleanup): {
7082
resume;
7183
+ }
7284
+
73-
+ bb3: {
85+
+ bb5: {
7486
+ StorageLive(_8);
75-
+ switchInt(_5) -> [0: bb4, otherwise: bb5];
87+
+ switchInt(_5) -> [0: bb6, otherwise: bb7];
7688
+ }
7789
+
78-
+ bb4: {
90+
+ bb6: {
7991
+ _8 = const 13_i32;
80-
+ goto -> bb6;
92+
+ goto -> bb8;
8193
+ }
8294
+
83-
+ bb5: {
95+
+ bb7: {
8496
+ _8 = const 7_i32;
85-
+ goto -> bb6;
97+
+ goto -> bb8;
8698
+ }
8799
+
88-
+ bb6: {
100+
+ bb8: {
89101
+ _1 = GeneratorState::<i32, bool>::Yielded(move _8);
90102
+ _9 = deref_copy (_2.0: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8});
91103
+ discriminant((*_9)) = 3;
92104
+ goto -> bb1;
93105
+ }
94106
+
95-
+ bb7: {
96-
+ assert(const false, "generator resumed after completion") -> [success: bb7, unwind: bb2];
107+
+ bb9: {
108+
+ assert(const false, "generator resumed after completion") -> [success: bb9, unwind: bb3];
97109
+ }
98110
+
99-
+ bb8: {
111+
+ bb10: {
100112
+ StorageLive(_8);
101113
+ StorageDead(_8);
102114
+ _1 = GeneratorState::<i32, bool>::Complete(_5);
@@ -105,7 +117,7 @@
105117
+ goto -> bb1;
106118
+ }
107119
+
108-
+ bb9: {
120+
+ bb11: {
109121
+ unreachable;
110122
}
111123
}

0 commit comments

Comments
 (0)