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.


-- 
           Summary: When peeling an ordinary label off a case-table and
                    making it a default label, strip from the end with
                    identical labels.
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hp at gcc dot gnu dot org
GCC target triplet: cris-*-*


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37710

Reply via email to