> On Tue, Apr 17, 2012 at 10:45 AM, Richard Guenther > <richard.guent...@gmail.com> wrote: > >> 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... > > > > Indeed. At least the parts that expand switch stmts to (balanced) trees > > should be moved to the GIMPLE level, retaining only the table-jump-like > > expansions as switch stmts. > > My goal for GCC 4.8 is to do just that: Move switch expansion to > GIMPLE and add value profiling for switch expressions. I may put back > that heuristic as a branch predictor, but I doubt it makes much of a > difference. Besides, it is actually hard to figure out whether a
I have my doubts, too, this is why it is not implemented. Lets see if the removal changes anything. Currently the branch prediction code is extraordinarily stupid on switches. We still could do better - i.e. be able to combine other types of predictions on them (i.e. switch edge leading to abort() is unlikely) and eventually we could teach VRP about value range histograms. > switch expression is for characters in an ascii string because char is > promoted to int. Good plan! Can you two symchonize your efforts, please? Honza > > Ciao! > Steven