https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118353
Bug ID: 118353
Summary: Implement greedy algorithm for switch jump table
cluster finding
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: pheeck at gcc dot gnu.org
CC: ak at gcc dot gnu.org
Target Milestone: ---
In the switchlower pass the algorithm for finding jump table clusters is at
least quadratic. There haven't been any concrete problems reported yet, but
theoretically, this could cause long compilation times in some specific cases.
It would be nice to avoid these problems. To do that we could implement a
greedy algorithm for finding jump table clusters which wouldn't necessarily
find the optimal clustering but would run quickly. We could switch to this
algorithm when --param switch-lower-slow-alg-max-cases is exceeded (when the
switch has more than this number of cases). This would be similar to how
switch bit test clustering is currently done.
This was previously discussed in pr118032.