> > Note that it would make a lot of sense to teach this heuristics predict.c > > and properly identify chars. > > Indeed this would be the proper place to implement this logic.
TO a degree - switch expansion needs more info than it can obtain from edge profile. Having switch case 1,3,5,7,8,9: aaa case 2,4,6,8,10,12: bbb to produce well ballanced decision tree, it is not enough to know how often the value is even and how often it is odd... Thus there is a need for value histograms. > > > 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. Yep. Honza > > >> > >> > >> The attached patch removes the heuristic. > >> > >> Bootstrapped and tested on powerpc-unknown-linux-gnu. OK for trunk? > > Ok. > > Thanks, > Richard. > > >> Ciao! > >> Steven > > > >