Commit 7ccf491
authored
JIT: enable removal of try/catch if the try can't throw. (#110273)
If no tree in the try region of a try/catch can throw, then
we can remove the try and delete the catch.
If no tree in the try region of a try/finally can throw, we can
remove the try and inline the finally. This slightly generalizes
the empty-try/finally opt we have been doing for a long time.
(We should do something similar for try/fault, but don't, yet).
Since these optimization passes are cheap, and opportunities
for them arise after other optimizations and unblock subsequent
optimizations, run them early, middle, and late.
Resolves #107191.
I expect we'll see more of these cases in the future, say if
we unblock cloning of loops with EH.1 parent 5b9b8d3 commit 7ccf491
File tree
7 files changed
+501
-94
lines changed- src/coreclr/jit
7 files changed
+501
-94
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4637 | 4637 | | |
4638 | 4638 | | |
4639 | 4639 | | |
4640 | | - | |
| 4640 | + | |
4641 | 4641 | | |
4642 | 4642 | | |
4643 | 4643 | | |
| 4644 | + | |
| 4645 | + | |
| 4646 | + | |
| 4647 | + | |
4644 | 4648 | | |
4645 | 4649 | | |
4646 | 4650 | | |
| |||
4810 | 4814 | | |
4811 | 4815 | | |
4812 | 4816 | | |
| 4817 | + | |
| 4818 | + | |
| 4819 | + | |
| 4820 | + | |
| 4821 | + | |
| 4822 | + | |
| 4823 | + | |
| 4824 | + | |
| 4825 | + | |
| 4826 | + | |
| 4827 | + | |
| 4828 | + | |
4813 | 4829 | | |
4814 | 4830 | | |
4815 | 4831 | | |
| |||
5039 | 5055 | | |
5040 | 5056 | | |
5041 | 5057 | | |
5042 | | - | |
| 5058 | + | |
| 5059 | + | |
| 5060 | + | |
| 5061 | + | |
| 5062 | + | |
| 5063 | + | |
| 5064 | + | |
| 5065 | + | |
| 5066 | + | |
| 5067 | + | |
5043 | 5068 | | |
5044 | 5069 | | |
5045 | 5070 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5270 | 5270 | | |
5271 | 5271 | | |
5272 | 5272 | | |
5273 | | - | |
5274 | 5273 | | |
5275 | 5274 | | |
5276 | 5275 | | |
| |||
5352 | 5351 | | |
5353 | 5352 | | |
5354 | 5353 | | |
| 5354 | + | |
| 5355 | + | |
5355 | 5356 | | |
5356 | 5357 | | |
5357 | 5358 | | |
5358 | 5359 | | |
5359 | 5360 | | |
5360 | 5361 | | |
| 5362 | + | |
| 5363 | + | |
5361 | 5364 | | |
5362 | 5365 | | |
5363 | 5366 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
77 | 81 | | |
78 | 82 | | |
79 | 83 | | |
| |||
96 | 100 | | |
97 | 101 | | |
98 | 102 | | |
99 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
100 | 106 | | |
101 | 107 | | |
102 | 108 | | |
| |||
0 commit comments