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]>
---
 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 5027ab559c0..e2b7e5ce625 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 7fbcc573eb1..d99dadbcd0c 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;
 
-- 
2.43.0

Reply via email to