See PR 35809, comment #3 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35809#c3>:
Looking at assembly-code for
gcc.c-torture/execute/pr35800.c at r140821 reveals that the first case is still
arbitrarily taken as the default, where the last one would have been better as
it's repeated 32 times.
So, when a new default-label is to be picked, use the end with identical labels, and peel all of them off. If there are no identical labels, use the end which results in the smallest lower end of the case range. (Usually the beginning needs to be added or subtracted in the back-end, so a smaller constant (hopefully zero) usually means a lower cost.
This basically boils down to moving optimizing case labels earlier (we do
so after going out-of-ssa).