public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Add flag to control straight-line strength reduction
@ 2012-07-17 15:46 William J. Schmidt
  2012-07-18  7:59 ` Richard Guenther
  0 siblings, 1 reply; 11+ messages in thread
From: William J. Schmidt @ 2012-07-17 15:46 UTC (permalink / raw)
  To: gcc-patches; +Cc: bergner, rguenther

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Add flag to control straight-line strength reduction
  2012-07-17 15:46 [PATCH] Add flag to control straight-line strength reduction William J. Schmidt
@ 2012-07-18  7:59 ` Richard Guenther
  2012-07-18  8:11   ` Steven Bosscher
  0 siblings, 1 reply; 11+ messages in thread
From: Richard Guenther @ 2012-07-18  7:59 UTC (permalink / raw)
  To: William J. Schmidt; +Cc: gcc-patches, bergner

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  <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
> 
> 
> 

-- 
Richard Guenther <rguenther@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Add flag to control straight-line strength reduction
  2012-07-18  7:59 ` Richard Guenther
@ 2012-07-18  8:11   ` Steven Bosscher
  2012-07-18  9:01     ` Richard Guenther
  2012-07-18  9:02     ` Eric Botcazou
  0 siblings, 2 replies; 11+ messages in thread
From: Steven Bosscher @ 2012-07-18  8:11 UTC (permalink / raw)
  To: Richard Guenther; +Cc: William J. Schmidt, gcc-patches, bergner

On Wed, Jul 18, 2012 at 9:59 AM, Richard Guenther <rguenther@suse.de> wrote:
> 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)?

In the past, -fstrength-reduce applied to loop strength reduction in
loop.c. I don't think it should be re-used for a completely different
code transformation.

Ciao!
Steven

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Add flag to control straight-line strength reduction
  2012-07-18  8:11   ` Steven Bosscher
@ 2012-07-18  9:01     ` Richard Guenther
  2012-07-18 13:25       ` William J. Schmidt
  2012-07-18 14:00       ` William J. Schmidt
  2012-07-18  9:02     ` Eric Botcazou
  1 sibling, 2 replies; 11+ messages in thread
From: Richard Guenther @ 2012-07-18  9:01 UTC (permalink / raw)
  To: Steven Bosscher; +Cc: William J. Schmidt, gcc-patches, bergner

On Wed, 18 Jul 2012, Steven Bosscher wrote:

> On Wed, Jul 18, 2012 at 9:59 AM, Richard Guenther <rguenther@suse.de> wrote:
> > 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)?
> 
> In the past, -fstrength-reduce applied to loop strength reduction in
> loop.c. I don't think it should be re-used for a completely different
> code transformation.

Ok.  I suppose -ftree-slsr is ok then.

Thanks,
Richard.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Add flag to control straight-line strength reduction
  2012-07-18  8:11   ` Steven Bosscher
  2012-07-18  9:01     ` Richard Guenther
@ 2012-07-18  9:02     ` Eric Botcazou
  1 sibling, 0 replies; 11+ messages in thread
From: Eric Botcazou @ 2012-07-18  9:02 UTC (permalink / raw)
  To: Steven Bosscher
  Cc: gcc-patches, Richard Guenther, William J. Schmidt, bergner

> In the past, -fstrength-reduce applied to loop strength reduction in
> loop.c. I don't think it should be re-used for a completely different
> code transformation.

Seconded.

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Add flag to control straight-line strength reduction
  2012-07-18  9:01     ` Richard Guenther
@ 2012-07-18 13:25       ` William J. Schmidt
  2012-07-18 13:29         ` William J. Schmidt
  2012-07-18 14:15         ` Steven Bosscher
  2012-07-18 14:00       ` William J. Schmidt
  1 sibling, 2 replies; 11+ messages in thread
From: William J. Schmidt @ 2012-07-18 13:25 UTC (permalink / raw)
  To: Richard Guenther; +Cc: Steven Bosscher, gcc-patches, bergner

On Wed, 2012-07-18 at 11:01 +0200, Richard Guenther wrote:
> On Wed, 18 Jul 2012, Steven Bosscher wrote:
> 
> > On Wed, Jul 18, 2012 at 9:59 AM, Richard Guenther <rguenther@suse.de> wrote:
> > > 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)?
> > 
> > In the past, -fstrength-reduce applied to loop strength reduction in
> > loop.c. I don't think it should be re-used for a completely different
> > code transformation.
> 
> Ok.  I suppose -ftree-slsr is ok then.

It turns out I was looking at a very old copy of the manual, and the
-ftree... stuff is not as prevalent now as it once was.  I'll just go
with -fslsr to be consistent with -fgcse, -fipa-sra, etc.

Thanks for the pointer to doc/invoke.texi -- it appears I also failed to
document -fhoist-adjacent-loads, so I will go ahead and do that as well.

Thanks!
Bill

> 
> Thanks,
> Richard.
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Add flag to control straight-line strength reduction
  2012-07-18 13:25       ` William J. Schmidt
@ 2012-07-18 13:29         ` William J. Schmidt
  2012-07-18 14:15         ` Steven Bosscher
  1 sibling, 0 replies; 11+ messages in thread
From: William J. Schmidt @ 2012-07-18 13:29 UTC (permalink / raw)
  To: Richard Guenther; +Cc: Steven Bosscher, gcc-patches, bergner

On Wed, 2012-07-18 at 08:24 -0500, William J. Schmidt wrote:
> On Wed, 2012-07-18 at 11:01 +0200, Richard Guenther wrote:
> > On Wed, 18 Jul 2012, Steven Bosscher wrote:
> > 
> > > On Wed, Jul 18, 2012 at 9:59 AM, Richard Guenther <rguenther@suse.de> wrote:
> > > > 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)?
> > > 
> > > In the past, -fstrength-reduce applied to loop strength reduction in
> > > loop.c. I don't think it should be re-used for a completely different
> > > code transformation.
> > 
> > Ok.  I suppose -ftree-slsr is ok then.
> 
> It turns out I was looking at a very old copy of the manual, and the
> -ftree... stuff is not as prevalent now as it once was.  I'll just go
> with -fslsr to be consistent with -fgcse, -fipa-sra, etc.

Well, posted too fast.  Paging down I see that isn't true, sorry.  I'll
use the tree- for consistency even though it is useless information.

Thanks,
Bill

> 
> Thanks for the pointer to doc/invoke.texi -- it appears I also failed to
> document -fhoist-adjacent-loads, so I will go ahead and do that as well.
> 
> Thanks!
> Bill
> 
> > 
> > Thanks,
> > Richard.
> > 
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Add flag to control straight-line strength reduction
  2012-07-18  9:01     ` Richard Guenther
  2012-07-18 13:25       ` William J. Schmidt
@ 2012-07-18 14:00       ` William J. Schmidt
  2012-07-18 14:35         ` Richard Guenther
  1 sibling, 1 reply; 11+ messages in thread
From: William J. Schmidt @ 2012-07-18 14:00 UTC (permalink / raw)
  To: Richard Guenther; +Cc: Steven Bosscher, gcc-patches, bergner

Here's the patch with documentation changes included.  I also cleaned up
missing work from a couple of my previous patches, so
-fhoist-adjacent-loads is documented now, and -fvect-cost-model is added
to the list of options on by default at -O3.

Ok for trunk?

Thanks,
Bill


2012-07-18  Bill Schmidt  <wschmidt@linux.ibm.com>

	* doc/invoke.texi: Add -fhoist-adjacent-loads and -ftree-slsr to list
	of flags controlling optimization; add -ftree-slsr to list of flags
	enabled by default at -O; add -fhoist-adjacent-loads to list of flags
	enabled by default at -O2; add -fvect-cost-model to list of flags
	enabled by default at -O3; document -fhoist-adjacent-loads and
	-ftree-slsr.
	* 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/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi	(revision 189574)
+++ gcc/doc/invoke.texi	(working copy)
@@ -364,7 +364,8 @@ Objective-C and Objective-C++ Dialects}.
 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
--fgcse-sm -fif-conversion -fif-conversion2 -findirect-inlining @gol
+-fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
+-fif-conversion2 -findirect-inlining @gol
 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
 -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-matrix-reorg @gol
 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference @gol
@@ -413,8 +414,8 @@ Objective-C and Objective-C++ Dialects}.
 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
--ftree-reassoc @gol
--ftree-sink -ftree-sra -ftree-switch-conversion -ftree-tail-merge @gol
+-ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
+-ftree-switch-conversion -ftree-tail-merge @gol
 -ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp @gol
 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
 -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
@@ -6259,6 +6260,7 @@ compilation time.
 -ftree-forwprop @gol
 -ftree-fre @gol
 -ftree-phiprop @gol
+-ftree-slsr @gol
 -ftree-sra @gol
 -ftree-pta @gol
 -ftree-ter @gol
@@ -6286,6 +6288,7 @@ also turns on the following optimization flags:
 -fdevirtualize @gol
 -fexpensive-optimizations @gol
 -fgcse  -fgcse-lm  @gol
+-fhoist-adjacent-loads @gol
 -finline-small-functions @gol
 -findirect-inlining @gol
 -fipa-sra @gol
@@ -6311,6 +6314,7 @@ Optimize yet more.  @option{-O3} turns on all opti
 by @option{-O2} and also turns on the @option{-finline-functions},
 @option{-funswitch-loops}, @option{-fpredictive-commoning},
 @option{-fgcse-after-reload}, @option{-ftree-vectorize},
+@option{-fvect-cost-model},
 @option{-ftree-partial-pre} and @option{-fipa-cp-clone} options.
 
 @item -O0
@@ -7129,6 +7133,13 @@ This flag is enabled by default at @option{-O} and
 Perform hoisting of loads from conditional pointers on trees.  This
 pass is enabled by default at @option{-O} and higher.
 
+@item -fhoist-adjacent-loads
+@opindex hoist-adjacent-loads
+Speculatively hoist loads from both branches of an if-then-else if the
+loads are from adjacent locations in the same structure and the target
+architecture has a conditional move instruction.  This flag is enabled
+by default at @option{-O2} and higher.
+
 @item -ftree-copy-prop
 @opindex ftree-copy-prop
 Perform copy propagation on trees.  This pass eliminates unnecessary
@@ -7529,6 +7540,13 @@ defining expression.  This results in non-GIMPLE c
 much more complex trees to work on resulting in better RTL generation.  This is
 enabled by default at @option{-O} and higher.
 
+@item -ftree-slsr
+@opindex ftree-slsr
+Perform straight-line strength reduction on trees.  This recognizes related
+expressions involving multiplications and replaces them by less expensive
+calculations when possible.  This is enabled by default at @option{-O} and
+higher.
+
 @item -ftree-vectorize
 @opindex ftree-vectorize
 Perform loop vectorization on trees. This flag is enabled by default at
@@ -7550,7 +7568,8 @@ except at level @option{-Os} where it is disabled.
 
 @item -fvect-cost-model
 @opindex fvect-cost-model
-Enable cost model for vectorization.
+Enable cost model for vectorization.  This option is enabled by default at
+@option{-O3}.
 
 @item -ftree-vrp
 @opindex ftree-vrp
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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Add flag to control straight-line strength reduction
  2012-07-18 13:25       ` William J. Schmidt
  2012-07-18 13:29         ` William J. Schmidt
@ 2012-07-18 14:15         ` Steven Bosscher
  2012-07-18 14:36           ` Richard Guenther
  1 sibling, 1 reply; 11+ messages in thread
From: Steven Bosscher @ 2012-07-18 14:15 UTC (permalink / raw)
  To: William J. Schmidt; +Cc: Richard Guenther, gcc-patches, bergner

On Wed, Jul 18, 2012 at 3:24 PM, William J. Schmidt
<wschmidt@linux.vnet.ibm.com> wrote:
> It turns out I was looking at a very old copy of the manual, and the
> -ftree... stuff is not as prevalent now as it once was.  I'll just go
> with -fslsr to be consistent with -fgcse, -fipa-sra, etc.

Sadly, it is more prevalent than it ever was!
It's IMHO very unfortunate that such an internal detail is exposed to
the user...

Ciao!
Steven

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Add flag to control straight-line strength reduction
  2012-07-18 14:00       ` William J. Schmidt
@ 2012-07-18 14:35         ` Richard Guenther
  0 siblings, 0 replies; 11+ messages in thread
From: Richard Guenther @ 2012-07-18 14:35 UTC (permalink / raw)
  To: William J. Schmidt; +Cc: Steven Bosscher, gcc-patches, bergner

On Wed, 18 Jul 2012, William J. Schmidt wrote:

> Here's the patch with documentation changes included.  I also cleaned up
> missing work from a couple of my previous patches, so
> -fhoist-adjacent-loads is documented now, and -fvect-cost-model is added
> to the list of options on by default at -O3.
> 
> Ok for trunk?

Ok if it bootstraps / tests ok.

Thanks,
Richard.

> Thanks,
> Bill
> 
> 
> 2012-07-18  Bill Schmidt  <wschmidt@linux.ibm.com>
> 
> 	* doc/invoke.texi: Add -fhoist-adjacent-loads and -ftree-slsr to list
> 	of flags controlling optimization; add -ftree-slsr to list of flags
> 	enabled by default at -O; add -fhoist-adjacent-loads to list of flags
> 	enabled by default at -O2; add -fvect-cost-model to list of flags
> 	enabled by default at -O3; document -fhoist-adjacent-loads and
> 	-ftree-slsr.
> 	* 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/doc/invoke.texi
> ===================================================================
> --- gcc/doc/invoke.texi	(revision 189574)
> +++ gcc/doc/invoke.texi	(working copy)
> @@ -364,7 +364,8 @@ Objective-C and Objective-C++ Dialects}.
>  -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
>  -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
>  -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
> --fgcse-sm -fif-conversion -fif-conversion2 -findirect-inlining @gol
> +-fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
> +-fif-conversion2 -findirect-inlining @gol
>  -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
>  -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-matrix-reorg @gol
>  -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference @gol
> @@ -413,8 +414,8 @@ Objective-C and Objective-C++ Dialects}.
>  -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
>  -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
>  -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
> --ftree-reassoc @gol
> --ftree-sink -ftree-sra -ftree-switch-conversion -ftree-tail-merge @gol
> +-ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
> +-ftree-switch-conversion -ftree-tail-merge @gol
>  -ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp @gol
>  -funit-at-a-time -funroll-all-loops -funroll-loops @gol
>  -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
> @@ -6259,6 +6260,7 @@ compilation time.
>  -ftree-forwprop @gol
>  -ftree-fre @gol
>  -ftree-phiprop @gol
> +-ftree-slsr @gol
>  -ftree-sra @gol
>  -ftree-pta @gol
>  -ftree-ter @gol
> @@ -6286,6 +6288,7 @@ also turns on the following optimization flags:
>  -fdevirtualize @gol
>  -fexpensive-optimizations @gol
>  -fgcse  -fgcse-lm  @gol
> +-fhoist-adjacent-loads @gol
>  -finline-small-functions @gol
>  -findirect-inlining @gol
>  -fipa-sra @gol
> @@ -6311,6 +6314,7 @@ Optimize yet more.  @option{-O3} turns on all opti
>  by @option{-O2} and also turns on the @option{-finline-functions},
>  @option{-funswitch-loops}, @option{-fpredictive-commoning},
>  @option{-fgcse-after-reload}, @option{-ftree-vectorize},
> +@option{-fvect-cost-model},
>  @option{-ftree-partial-pre} and @option{-fipa-cp-clone} options.
>  
>  @item -O0
> @@ -7129,6 +7133,13 @@ This flag is enabled by default at @option{-O} and
>  Perform hoisting of loads from conditional pointers on trees.  This
>  pass is enabled by default at @option{-O} and higher.
>  
> +@item -fhoist-adjacent-loads
> +@opindex hoist-adjacent-loads
> +Speculatively hoist loads from both branches of an if-then-else if the
> +loads are from adjacent locations in the same structure and the target
> +architecture has a conditional move instruction.  This flag is enabled
> +by default at @option{-O2} and higher.
> +
>  @item -ftree-copy-prop
>  @opindex ftree-copy-prop
>  Perform copy propagation on trees.  This pass eliminates unnecessary
> @@ -7529,6 +7540,13 @@ defining expression.  This results in non-GIMPLE c
>  much more complex trees to work on resulting in better RTL generation.  This is
>  enabled by default at @option{-O} and higher.
>  
> +@item -ftree-slsr
> +@opindex ftree-slsr
> +Perform straight-line strength reduction on trees.  This recognizes related
> +expressions involving multiplications and replaces them by less expensive
> +calculations when possible.  This is enabled by default at @option{-O} and
> +higher.
> +
>  @item -ftree-vectorize
>  @opindex ftree-vectorize
>  Perform loop vectorization on trees. This flag is enabled by default at
> @@ -7550,7 +7568,8 @@ except at level @option{-Os} where it is disabled.
>  
>  @item -fvect-cost-model
>  @opindex fvect-cost-model
> -Enable cost model for vectorization.
> +Enable cost model for vectorization.  This option is enabled by default at
> +@option{-O3}.
>  
>  @item -ftree-vrp
>  @opindex ftree-vrp
> 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 <rguenther@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Add flag to control straight-line strength reduction
  2012-07-18 14:15         ` Steven Bosscher
@ 2012-07-18 14:36           ` Richard Guenther
  0 siblings, 0 replies; 11+ messages in thread
From: Richard Guenther @ 2012-07-18 14:36 UTC (permalink / raw)
  To: Steven Bosscher; +Cc: William J. Schmidt, gcc-patches, bergner

On Wed, 18 Jul 2012, Steven Bosscher wrote:

> On Wed, Jul 18, 2012 at 3:24 PM, William J. Schmidt
> <wschmidt@linux.vnet.ibm.com> wrote:
> > It turns out I was looking at a very old copy of the manual, and the
> > -ftree... stuff is not as prevalent now as it once was.  I'll just go
> > with -fslsr to be consistent with -fgcse, -fipa-sra, etc.
> 
> Sadly, it is more prevalent than it ever was!
> It's IMHO very unfortunate that such an internal detail is exposed to
> the user...

Indeed...  not sure if we want a set of aliases without the tree-
or rtl- part.

Richard.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-07-18 14:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-17 15:46 [PATCH] Add flag to control straight-line strength reduction William J. Schmidt
2012-07-18  7:59 ` Richard Guenther
2012-07-18  8:11   ` Steven Bosscher
2012-07-18  9:01     ` Richard Guenther
2012-07-18 13:25       ` William J. Schmidt
2012-07-18 13:29         ` William J. Schmidt
2012-07-18 14:15         ` Steven Bosscher
2012-07-18 14:36           ` Richard Guenther
2012-07-18 14:00       ` William J. Schmidt
2012-07-18 14:35         ` Richard Guenther
2012-07-18  9:02     ` Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).