This repository was archived by the owner on May 28, 2025. It is now read-only.
forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit be9306c
Auto merge of rust-lang#138144 - scottmcm:multiple-mir-returns, r=<try>
Use multiple returns in MIR if it saves a block; still have only one in LLVM
This is still an open question whether it's desired, per rust-lang#72022 (comment), so opening as a draft.
Given that cranelift prefers multiple returns and we use optimized MIR for MIR inlining, it seems at least plausible that MIR shouldn't have the "one return" rule (the validator doesn't enforce it currently either) so we can have fewer total blocks, and then targets like LLVM can enforce it if they so choose (as this PR does).
r? ghostFile tree
37 files changed
+310
-201
lines changed- compiler
- rustc_codegen_ssa/src/mir
- rustc_mir_transform/src
- tests
- codegen
- asm
- issues
- mir-opt
- inline
- issues
- pre-codegen
- ui/stable-mir-print
37 files changed
+310
-201
lines changedLines changed: 10 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
462 | 462 |
| |
463 | 463 |
| |
464 | 464 |
| |
465 | - | ||
465 | + | ||
466 | 466 |
| |
467 | 467 |
| |
468 | 468 |
| |
| |||
1343 | 1343 |
| |
1344 | 1344 |
| |
1345 | 1345 |
| |
1346 | - | ||
1346 | + | ||
1347 | + | ||
1348 | + | ||
1349 | + | ||
1350 | + | ||
1351 | + | ||
1352 | + | ||
1353 | + | ||
1354 | + | ||
1347 | 1355 |
| |
1348 | 1356 |
| |
1349 | 1357 |
| |
|
Lines changed: 24 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
92 | 92 |
| |
93 | 93 |
| |
94 | 94 |
| |
95 | + | ||
96 | + | ||
97 | + | ||
98 | + | ||
99 | + | ||
100 | + | ||
95 | 101 |
| |
96 | 102 |
| |
97 | 103 |
| |
| |||
204 | 210 |
| |
205 | 211 |
| |
206 | 212 |
| |
213 | + | ||
214 | + | ||
215 | + | ||
216 | + | ||
217 | + | ||
218 | + | ||
219 | + | ||
220 | + | ||
221 | + | ||
222 | + | ||
223 | + | ||
224 | + | ||
207 | 225 |
| |
208 | 226 |
| |
209 | 227 |
| |
| |||
214 | 232 |
| |
215 | 233 |
| |
216 | 234 |
| |
235 | + | ||
217 | 236 |
| |
218 | 237 |
| |
219 | 238 |
| |
| |||
308 | 327 |
| |
309 | 328 |
| |
310 | 329 |
| |
330 | + | ||
331 | + | ||
332 | + | ||
333 | + | ||
334 | + | ||
311 | 335 |
| |
312 | 336 |
| |
313 | 337 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
694 | 694 |
| |
695 | 695 |
| |
696 | 696 |
| |
697 | - | ||
698 | 697 |
| |
699 | 698 |
| |
700 | 699 |
| |
| |||
711 | 710 |
| |
712 | 711 |
| |
713 | 712 |
| |
713 | + | ||
714 | + | ||
714 | 715 |
| |
715 | 716 |
| |
716 | 717 |
| |
717 | 718 |
| |
718 | 719 |
| |
719 | 720 |
| |
720 | 721 |
| |
721 | - | ||
722 | 722 |
| |
723 | 723 |
| |
724 | 724 |
| |
|
Lines changed: 29 additions & 18 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
3 | 3 |
| |
4 | - | ||
5 | 4 |
| |
6 | 5 |
| |
7 | - | ||
8 | - | ||
6 | + | ||
9 | 7 |
| |
10 | 8 |
| |
11 | 9 |
| |
12 | 10 |
| |
13 | 11 |
| |
14 | - | ||
12 | + | ||
15 | 13 |
| |
16 | 14 |
| |
17 | 15 |
| |
18 | - | ||
19 | - | ||
20 | - | ||
21 | - | ||
22 | - | ||
23 | - | ||
16 | + | ||
17 | + | ||
18 | + | ||
19 | + | ||
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | ||
24 | + | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + | ||
29 | + | ||
30 | + | ||
31 | + | ||
24 | 32 |
| |
25 | - | ||
33 | + | ||
26 | 34 |
| |
27 | 35 |
| |
28 | 36 |
| |
29 | - | ||
30 | - | ||
31 | - | ||
32 | - | ||
33 | - | ||
34 | - | ||
37 | + | ||
38 | + | ||
35 | 39 |
| |
36 | 40 |
| |
37 | - | ||
41 | + | ||
42 | + | ||
43 | + | ||
44 | + | ||
45 | + | ||
46 | + | ||
47 | + | ||
48 | + | ||
38 | 49 |
| |
39 | 50 |
| |
40 | 51 |
| |
|
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
22 | - | ||
22 | + | ||
23 | 23 |
| |
24 | 24 |
| |
25 | 25 |
| |
| |||
32 | 32 |
| |
33 | 33 |
| |
34 | 34 |
| |
35 | - | ||
35 | + | ||
36 | 36 |
| |
37 | 37 |
| |
38 | 38 |
| |
| |||
55 | 55 |
| |
56 | 56 |
| |
57 | 57 |
| |
58 | - | ||
58 | + | ||
59 | 59 |
| |
60 | 60 |
| |
61 | 61 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
6 | - | ||
7 | 6 |
| |
7 | + | ||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
|
Lines changed: 34 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | + | ||
2 | + | ||
3 | + | ||
4 | + | ||
5 | + | ||
6 | + | ||
7 | + | ||
8 | + | ||
9 | + | ||
10 | + | ||
11 | + | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + | ||
16 | + | ||
17 | + | ||
18 | + | ||
19 | + | ||
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | ||
24 | + | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | + | ||
33 | + | ||
34 | + |
Lines changed: 15 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
23 | - | ||
23 | + | ||
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
27 | + | ||
28 | + | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | + | ||
27 | 33 |
| |
28 | 34 |
| |
29 | - | ||
35 | + | ||
30 | 36 |
| |
31 | 37 |
| |
32 | - | ||
38 | + | ||
33 | 39 |
| |
34 | - | ||
40 | + | ||
35 | 41 |
| |
36 | 42 |
| |
37 | - | ||
43 | + | ||
38 | 44 |
| |
39 | - | ||
45 | + | ||
46 | + | ||
40 | 47 |
| |
41 | 48 |
| |
42 | - | ||
49 | + | ||
43 | 50 |
| |
44 | - | ||
45 | - | ||
46 | - | ||
51 | + | ||
47 | 52 |
| |
48 | 53 |
| |
49 | 54 |
|
Lines changed: 15 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
23 | - | ||
23 | + | ||
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
27 | + | ||
28 | + | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | + | ||
27 | 33 |
| |
28 | 34 |
| |
29 | - | ||
35 | + | ||
30 | 36 |
| |
31 | 37 |
| |
32 | - | ||
38 | + | ||
33 | 39 |
| |
34 | - | ||
40 | + | ||
35 | 41 |
| |
36 | 42 |
| |
37 | - | ||
43 | + | ||
38 | 44 |
| |
39 | - | ||
45 | + | ||
46 | + | ||
40 | 47 |
| |
41 | 48 |
| |
42 | - | ||
49 | + | ||
43 | 50 |
| |
44 | - | ||
45 | - | ||
46 | - | ||
51 | + | ||
47 | 52 |
| |
48 | 53 |
| |
49 | 54 |
|
Lines changed: 1 addition & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
49 | 49 |
| |
50 | 50 |
| |
51 | 51 |
| |
52 | - | ||
52 | + | ||
53 | 53 |
| |
54 | 54 |
| |
55 | 55 |
| |
| |||
59 | 59 |
| |
60 | 60 |
| |
61 | 61 |
| |
62 | - | ||
63 | - | ||
64 | - | ||
65 | - | ||
66 | 62 |
| |
67 | 63 |
| |
68 | 64 |
|
0 commit comments