This is the mail archive of the
mailing list for the GCC project.
Re: [patch] Remove strange case cost code
> There is code in stmt.c since the initial checkin, that tries to
> balance a switch tree according to some ascii heuristics. I see a
> couple of problems with this code:
> 1. It doesn't seem to help much. With the attached patch to remove the
> code, I see no compile time changes to e.g. compile GCC itself.
> 2. It isn't clear what the heuristic is based on (no reference to any
> testing done, or a reference to a book or paper).
> 3. The heuristic is applied for case values in the range <-1,127>
> (inclusive) even if the type of the switch expression isn't char or
> int but e.g. an enum. This results in funny application of this
> heuristic in GCC itself to e.g. some cases of enum rtx_code and enum
Note that it would make a lot of sense to teach this heuristics predict.c
and properly identify chars.
Also it is possble to get an historgrams from profile feedback into
switch expansion. I always wanted to do that once switch expansion code
is cleaned up and moved to gimple level...
> The attached patch removes the heuristic.
> Bootstrapped and tested on powerpc-unknown-linux-gnu. OK for trunk?