[PATCH] Add flag to control straight-line strength reduction
William J. Schmidt
wschmidt@linux.vnet.ibm.com
Tue Jul 17 15:46:00 GMT 2012
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?
Thanks,
Bill
2012-07-17 Bill Schmidt <wschmidt@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
More information about the Gcc-patches
mailing list