https://gcc.gnu.org/g:7c328e9eeadf66f33758764d24151b9eb680c1f0
commit r17-995-g7c328e9eeadf66f33758764d24151b9eb680c1f0 Author: Andrew Pinski <[email protected]> Date: Sun May 17 01:42:12 2026 -0700 switch-conv: Remove label from case_bit_test 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 <[email protected]> Diff: --- gcc/tree-switch-conversion.cc | 5 ++--- gcc/tree-switch-conversion.h | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/gcc/tree-switch-conversion.cc b/gcc/tree-switch-conversion.cc index 5027ab559c0b..e2b7e5ce6254 100644 --- a/gcc/tree-switch-conversion.cc +++ b/gcc/tree-switch-conversion.cc @@ -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++; diff --git a/gcc/tree-switch-conversion.h b/gcc/tree-switch-conversion.h index 7fbcc573eb14..d99dadbcd0c4 100644 --- a/gcc/tree-switch-conversion.h +++ b/gcc/tree-switch-conversion.h @@ -556,7 +556,6 @@ class case_bit_test public: wide_int mask; basic_block target_bb; - tree label; int bits; profile_probability prob;
