Bug 37710 - When peeling an ordinary label off a case-table and making it a default label, strip from the end with identical labels.
Summary: When peeling an ordinary label off a case-table and making it a default label...
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.4.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
Depends on:
Blocks:
 
Reported: 2008-10-02 00:30 UTC by Hans-Peter Nilsson
Modified: 2008-10-02 11:08 UTC (History)
2 users (show)

See Also:
Host:
Target: cris-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-10-02 11:08:25


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hans-Peter Nilsson 2008-10-02 00:30:17 UTC
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.
Comment 1 Richard Biener 2008-10-02 11:08:25 UTC
This basically boils down to moving optimizing case labels earlier (we do
so after going out-of-ssa).