]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
switch-conv: Remove label from case_bit_test
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Sun, 17 May 2026 08:42:12 +0000 (01:42 -0700)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Sat, 30 May 2026 00:20:50 +0000 (17:20 -0700)
The label for case_bit_test is only used to stability
the qsort but the target bb here could be used for that.
So let's remove the label from case_bit_test and stability
the qsort by using the target bb's index.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* tree-switch-conversion.cc (case_bit_test::cmp): Stability
based on the index of the target bb instead.
(bit_test_cluster::emit): Remove setting of the label field
of case_bit_test.
* tree-switch-conversion.h (case_bit_test): Remove the label
field.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
gcc/tree-switch-conversion.cc
gcc/tree-switch-conversion.h

index 5027ab559c0b8ddff6a825e82da0b804a4f0ad74..e2b7e5ce6254adce207e94ca93934b07a007dadd 100644 (file)
@@ -1950,8 +1950,8 @@ case_bit_test::cmp (const void *p1, const void *p2)
     return d2->bits - d1->bits;
 
   /* Stabilize the sort.  */
-  return (LABEL_DECL_UID (CASE_LABEL (d2->label))
-         - LABEL_DECL_UID (CASE_LABEL (d1->label)));
+  return (d2->target_bb->index
+         - d1->target_bb->index);
 }
 
 /*  Expand a switch statement by a short sequence of bit-wise
@@ -2010,7 +2010,6 @@ bit_test_cluster::emit (tree index_expr, tree index_type,
          gcc_checking_assert (count < m_max_case_bit_tests);
          test[k].mask = wi::zero (prec);
          test[k].target_bb = n->m_case_bb;
-         test[k].label = n->m_case_label_expr;
          test[k].bits = 0;
          test[k].prob = profile_probability::never ();
          count++;
index 7fbcc573eb14adde05e3a0772de2aee2c8fecd96..d99dadbcd0c41b694c37c8d40095bdfcfa98b71d 100644 (file)
@@ -556,7 +556,6 @@ class case_bit_test
 public:
   wide_int mask;
   basic_block target_bb;
-  tree label;
   int bits;
   profile_probability prob;