[PATCH] Don't add a new label for implicit default label if case labels cover the whole range (PR middle-end/39666)

Paolo Bonzini bonzini@gnu.org
Thu Apr 30 08:15:00 GMT 2009


Jakub Jelinek wrote:
> Hi!
> 
> If a SWITCH_EXPR doesn't have a default case, but all its case labels
> together cover all values from type's minimum through maximum, when
> gimplify_switch_expr adds the default case it can introduce undesirable
> warnings and pessimize generated code.
> As the case labels are sorted, it is enough to check that first case label
> starts at TYPE_MIN_VALUE and last ends at TYPE_MAX_VALUE (to bail out quickly
> in a typical case) and if so check that adjacent case labels have adjacent
> ranges.

Nice, this will also allow to remove range checks at expand time!

Paolo



More information about the Gcc-patches mailing list