Commit a8aa660
authored
ReFinalize in MergeBlocks so we can optimize unreachable instructions too (#6994)
In #6984 we optimized dropped blocks even if they had unreachable code. In #6988
that part was reverted, and blocks with unreachable code were ignored once more.
However, I realized that the check was not actually for unreachable code, but for
having an unreachable child, so it would miss things like this:
(block
(block
..
(br $somewhere) ;; unreachable type, but no unreachable code
)
)
But it is useful to merge such blocks: we don't need the inner block here.
To fix this, just run ReFinalize if we change anything, which will propagate
unreachability as needed. I think MergeBlocks was written before we had
that utility, so it didn't use it...
This is not only useful for itself but will unblock an EH optimization in a
later PR, that has code in this form. It also simplifies the code by removing
the hasUnreachableChild checks.1 parent debd246 commit a8aa660
File tree
6 files changed
+123
-178
lines changed- src/passes
- test
- lit/passes
- passes
6 files changed
+123
-178
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | 179 | | |
189 | 180 | | |
190 | 181 | | |
| |||
206 | 197 | | |
207 | 198 | | |
208 | 199 | | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | 200 | | |
215 | 201 | | |
216 | 202 | | |
| |||
241 | 227 | | |
242 | 228 | | |
243 | 229 | | |
244 | | - | |
245 | | - | |
| 230 | + | |
| 231 | + | |
246 | 232 | | |
247 | 233 | | |
248 | 234 | | |
| |||
412 | 398 | | |
413 | 399 | | |
414 | 400 | | |
| 401 | + | |
415 | 402 | | |
416 | 403 | | |
417 | 404 | | |
| |||
427 | 414 | | |
428 | 415 | | |
429 | 416 | | |
| 417 | + | |
| 418 | + | |
430 | 419 | | |
431 | 420 | | |
432 | 421 | | |
| |||
438 | 427 | | |
439 | 428 | | |
440 | 429 | | |
| 430 | + | |
441 | 431 | | |
442 | 432 | | |
443 | 433 | | |
| |||
485 | 475 | | |
486 | 476 | | |
487 | 477 | | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | 478 | | |
496 | 479 | | |
497 | 480 | | |
| |||
510 | 493 | | |
511 | 494 | | |
512 | 495 | | |
| 496 | + | |
513 | 497 | | |
514 | 498 | | |
515 | 499 | | |
| |||
600 | 584 | | |
601 | 585 | | |
602 | 586 | | |
603 | | - | |
604 | | - | |
| 587 | + | |
605 | 588 | | |
606 | 589 | | |
607 | 590 | | |
| |||
682 | 665 | | |
683 | 666 | | |
684 | 667 | | |
| 668 | + | |
685 | 669 | | |
686 | 670 | | |
687 | 671 | | |
| |||
700 | 684 | | |
701 | 685 | | |
702 | 686 | | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
703 | 693 | | |
704 | 694 | | |
705 | 695 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
413 | 411 | | |
| 412 | + | |
414 | 413 | | |
415 | 414 | | |
416 | 415 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
672 | 672 | | |
673 | 673 | | |
674 | 674 | | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
| 675 | + | |
681 | 676 | | |
682 | 677 | | |
683 | 678 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
| 186 | + | |
| 187 | + | |
193 | 188 | | |
| 189 | + | |
194 | 190 | | |
195 | 191 | | |
196 | 192 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
89 | 84 | | |
90 | 85 | | |
91 | 86 | | |
| |||
109 | 104 | | |
110 | 105 | | |
111 | 106 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
| 107 | + | |
117 | 108 | | |
118 | 109 | | |
119 | 110 | | |
| |||
0 commit comments