From 668cad04b16fc044142474232ac072fcc5f94433 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Sun, 5 Jan 2025 18:00:36 +0100
Subject: [PATCH] tree-switch-conversion: don't apply switch size limit on jump
 tables

commit 56946c801a7c ("gimple: Add limit after which slower switchlower
algs are used [PR117091] [PR117352]") introduced a limit on the number
of cases of a switch. It also bails out on finding jump tables if the
switch is too large. This introduces a compile time regression during
bootstrap. A riscv bootstrap takes hours longer. Particularly
insn-attrtab.cc will take hours instead of minutes. Fix this by not
applying the switch size limit on jump tables.

An alternative would be to implement greedy switch clustering for jump
tables as is done for switch bitmap clustering.

gcc/ChangeLog:

	PR tree-optimization/118032
	* tree-switch-conversion.cc (jump_table_cluster::find_jump_tables):
	Remove param_switch_lower_slow_alg_max_cases check.
---
 gcc/tree-switch-conversion.cc | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/gcc/tree-switch-conversion.cc b/gcc/tree-switch-conversion.cc
index 432970597c97..39a8a893edde 100644
--- a/gcc/tree-switch-conversion.cc
+++ b/gcc/tree-switch-conversion.cc
@@ -1643,10 +1643,6 @@ jump_table_cluster::find_jump_tables (vec<cluster *> &clusters)
 
   unsigned l = clusters.length ();
 
-  /* Note: l + 1 is the number of cases of the switch.  */
-  if (l + 1 > (unsigned) param_switch_lower_slow_alg_max_cases)
-    return clusters.copy ();
-
   auto_vec<min_cluster_item> min;
   min.reserve (l + 1);
 
-- 
GitLab