On Sun, May 17, 2026 at 12:05 PM Jakub Jelinek <[email protected]> wrote: > > On Sun, May 17, 2026 at 12:03:22PM -0700, Andrew Pinski wrote: > > 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. > > Can't multiple labels appear in the same bb?
Yes but that does not get taken into account here. This code only stores the first CASE_LABEL_EXPR from a switch for a target bb; the target bb is used as the "key" to see if we are adding to the array or reusing an existing location. So there will be only one CASE_LABEL_EXPR for each target bb here and only used for the stabilization. The target bb was already the "key" so using that for stabilization seems the most appropriate to use in the first place. Thanks, Andrew > > Jakub >
