On Tue, 17 Jul 2012, William J. Schmidt wrote: > I overlooked adding a pass-control flag for strength reduction, added > here. I named it -ftree-slsr for consistency with other -ftree- flags, > but could change it to -fgimple-slsr if you prefer that for a pass named > gimple-ssa-... > > Bootstrapped and tested on powerpc-unknown-linux-gnu with no new > regressions. Ok for trunk?
The switch needs documentation in doc/invoke.texi. Other than that it's fine to stick with -ftree-..., even that exposes details to our users that are not necessary (RTL passes didn't have -frtl-... either). So in the end, why not re-use -fstrength-reduce that is already available (but stubbed out)? Comments from other folks? Thanks, Richard. > Thanks, > Bill > > > 2012-07-17 Bill Schmidt <wschm...@linux.ibm.com> > > * opts.c (default_option): Make -ftree-slsr default at -O1 and above. > * gimple-ssa-strength-reduction.c (gate_strength_reduction): Use > flag_tree_slsr. > * common.opt: Add -ftree-slsr with flag_tree_slsr. > > > Index: gcc/opts.c > =================================================================== > --- gcc/opts.c (revision 189574) > +++ gcc/opts.c (working copy) > @@ -452,6 +452,7 @@ static const struct default_options default_option > { OPT_LEVELS_1_PLUS, OPT_ftree_ch, NULL, 1 }, > { OPT_LEVELS_1_PLUS, OPT_fcombine_stack_adjustments, NULL, 1 }, > { OPT_LEVELS_1_PLUS, OPT_fcompare_elim, NULL, 1 }, > + { OPT_LEVELS_1_PLUS, OPT_ftree_slsr, NULL, 1 }, > > /* -O2 optimizations. */ > { OPT_LEVELS_2_PLUS, OPT_finline_small_functions, NULL, 1 }, > Index: gcc/gimple-ssa-strength-reduction.c > =================================================================== > --- gcc/gimple-ssa-strength-reduction.c (revision 189574) > +++ gcc/gimple-ssa-strength-reduction.c (working copy) > @@ -1501,7 +1501,7 @@ execute_strength_reduction (void) > static bool > gate_strength_reduction (void) > { > - return optimize > 0; > + return flag_tree_slsr; > } > > struct gimple_opt_pass pass_strength_reduction = > Index: gcc/common.opt > =================================================================== > --- gcc/common.opt (revision 189574) > +++ gcc/common.opt (working copy) > @@ -2080,6 +2080,10 @@ ftree-sink > Common Report Var(flag_tree_sink) Optimization > Enable SSA code sinking on trees > > +ftree-slsr > +Common Report Var(flag_tree_slsr) Optimization > +Perform straight-line strength reduction > + > ftree-sra > Common Report Var(flag_tree_sra) Optimization > Perform scalar replacement of aggregates > > > -- Richard Guenther <rguent...@suse.de> SUSE / SUSE Labs SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 GF: Jeff Hawn, Jennifer Guild, Felix Imend