Commit 531fd45
[PPC] Set minimum of largest number of comparisons to use bit test for switch lowering (llvm#155910)
Currently it is considered suitable to lower to a bit test for a set of
switch case clusters when the the number of unique destinations
(`NumDests`) and the number of total comparisons (`NumCmps`) satisfy:
`(NumDests == 1 && NumCmps >= 3) || (NumDests == 2 && NumCmps >= 5) ||
(NumDests == 3 && NumCmps >= 6)`
However it is found for some cases on powerpc, for example, when
NumDests is 3, and the number of comparisons for each destination is all
2, it's not profitable to lower the switch to bit test. This is to add
an option to set the minimum of largest number of comparisons to use bit
test for switch lowering.
---------
Co-authored-by: Shimin Cui <[email protected]>1 parent 0621fd0 commit 531fd45
File tree
6 files changed
+260
-19
lines changed- llvm
- include/llvm/CodeGen
- lib
- CodeGen
- Target/PowerPC
- test/CodeGen/PowerPC
6 files changed
+260
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
594 | 594 | | |
595 | 595 | | |
596 | 596 | | |
597 | | - | |
598 | | - | |
599 | | - | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
600 | 602 | | |
601 | | - | |
602 | | - | |
| 603 | + | |
603 | 604 | | |
604 | 605 | | |
605 | 606 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1433 | 1433 | | |
1434 | 1434 | | |
1435 | 1435 | | |
1436 | | - | |
1437 | | - | |
1438 | | - | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
1439 | 1439 | | |
1440 | 1440 | | |
1441 | 1441 | | |
| |||
1446 | 1446 | | |
1447 | 1447 | | |
1448 | 1448 | | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
1449 | 1463 | | |
1450 | 1464 | | |
1451 | 1465 | | |
| |||
2055 | 2069 | | |
2056 | 2070 | | |
2057 | 2071 | | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
2058 | 2075 | | |
2059 | 2076 | | |
2060 | 2077 | | |
| |||
2577 | 2594 | | |
2578 | 2595 | | |
2579 | 2596 | | |
| 2597 | + | |
| 2598 | + | |
| 2599 | + | |
2580 | 2600 | | |
2581 | 2601 | | |
2582 | 2602 | | |
| |||
3719 | 3739 | | |
3720 | 3740 | | |
3721 | 3741 | | |
| 3742 | + | |
| 3743 | + | |
| 3744 | + | |
3722 | 3745 | | |
3723 | 3746 | | |
3724 | 3747 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
202 | 201 | | |
203 | 202 | | |
204 | 203 | | |
205 | 204 | | |
206 | 205 | | |
207 | 206 | | |
208 | 207 | | |
| 208 | + | |
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
214 | | - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
215 | 218 | | |
216 | 219 | | |
217 | 220 | | |
| |||
226 | 229 | | |
227 | 230 | | |
228 | 231 | | |
229 | | - | |
230 | | - | |
231 | | - | |
| 232 | + | |
232 | 233 | | |
233 | 234 | | |
234 | 235 | | |
| |||
372 | 373 | | |
373 | 374 | | |
374 | 375 | | |
375 | | - | |
376 | | - | |
| 376 | + | |
377 | 377 | | |
378 | 378 | | |
379 | | - | |
380 | | - | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
381 | 382 | | |
382 | | - | |
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
388 | | - | |
| 388 | + | |
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
93 | 99 | | |
94 | 100 | | |
95 | 101 | | |
| |||
719 | 725 | | |
720 | 726 | | |
721 | 727 | | |
| 728 | + | |
| 729 | + | |
722 | 730 | | |
723 | 731 | | |
724 | 732 | | |
| |||
2129 | 2137 | | |
2130 | 2138 | | |
2131 | 2139 | | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
| 2144 | + | |
| 2145 | + | |
| 2146 | + | |
| 2147 | + | |
2132 | 2148 | | |
2133 | 2149 | | |
2134 | 2150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
141 | 146 | | |
142 | 147 | | |
143 | 148 | | |
| |||
1436 | 1441 | | |
1437 | 1442 | | |
1438 | 1443 | | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
1439 | 1447 | | |
1440 | 1448 | | |
1441 | 1449 | | |
| |||
0 commit comments