This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Move switch-conversion after profiling


> On Thu, Apr 19, 2012 at 5:16 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> > Hello,
> >
> > If we want to use profiling to expand switches in GIMPLE, we'll have
> > to run switch-conversion after profiling.
> >
> > Bootstrapped and tested on x86_64-unknown-linux-gnu. OK?
> 
> That's too early still.  Profile data is not read until pass_ipa_tree_profile.

Good point ;)

> Which means moving it to after all IPA transforms (and thus run at LTRANS
> stage with LTO) would be better.  May I suggest to move it after the
> DCE pass that runs after the first VRP pass?

The original motivation to do switch conversion early was to get function
bodies smaller (i.e. when inlining the static var don't need duplication, the
switch code does)

This was motivated by real world examples, i.e. mesa that inlines function converting
error codes into strings. At one point we estimated it to be of 0 size (because it
has only switch that was ignored and string constants that are zero cost) and we
ended up completely exploding by inlining it everywhere.

I think we should retain this and perhaps have always win conversions done early
and real coversion (of switches to decision trees) done much later.
Switch expansion hides what the code really does and some of the late optimizers
will probably benefit from knowing that switch is really a switch.

I would expect that somewhere before second VRP makes most sense.

Honza


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]