Patchwork Enable vectorizer cost model by default at -O3

login
register
mail settings
Submitter William J. Schmidt
Date July 15, 2012, 9:57 p.m.
Message ID <1342389426.3470.11.camel@gnopaine>
Download mbox | patch
Permalink /patch/171108/
State New
Headers show

Comments

William J. Schmidt - July 15, 2012, 9:57 p.m.
The auto-vectorizer is overly aggressive when not constrained by the
vectorizer cost model.  Although the cost model is by no means perfect,
it does a reasonable job of avoiding many poor vectorization decisions.
Since the auto-vectorizer is enabled by default at -O3 and above, we
should also enable the vectorizer cost model by default at -O3 and
above.

Bootstrapped and tested on powerpc64-unknown-linux-gnu with no new
regressions.  Ok for trunk?

Thanks,
Bill


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

	* opts.c (default_option): Add -fvect-cost-model to default options
	at -O3 and above.
Richard Guenther - July 16, 2012, 8:12 a.m.
On Sun, 15 Jul 2012, William J. Schmidt wrote:

> The auto-vectorizer is overly aggressive when not constrained by the
> vectorizer cost model.  Although the cost model is by no means perfect,
> it does a reasonable job of avoiding many poor vectorization decisions.
> Since the auto-vectorizer is enabled by default at -O3 and above, we
> should also enable the vectorizer cost model by default at -O3 and
> above.
> 
> Bootstrapped and tested on powerpc64-unknown-linux-gnu with no new
> regressions.  Ok for trunk?

I agree this makes sense.  It probably will cause some missed-optimization
bugreports which means we need to make more target cost implementation
adjustments.

Thus, ok.

Thanks,
Richard.

> Thanks,
> Bill
> 
> 
> 2012-07-15  Bill Schmidt  <wschmidt@linux.ibm.com>
> 
> 	* opts.c (default_option): Add -fvect-cost-model to default options
> 	at -O3 and above.
> 
> 
> Index: gcc/opts.c
> ===================================================================
> --- gcc/opts.c	(revision 189481)
> +++ gcc/opts.c	(working copy)
> @@ -501,6 +501,7 @@ static const struct default_options default_option
>      { OPT_LEVELS_3_PLUS, OPT_funswitch_loops, NULL, 1 },
>      { OPT_LEVELS_3_PLUS, OPT_fgcse_after_reload, NULL, 1 },
>      { OPT_LEVELS_3_PLUS, OPT_ftree_vectorize, NULL, 1 },
> +    { OPT_LEVELS_3_PLUS, OPT_fvect_cost_model, NULL, 1 },
>      { OPT_LEVELS_3_PLUS, OPT_fipa_cp_clone, NULL, 1 },
>      { OPT_LEVELS_3_PLUS, OPT_ftree_partial_pre, NULL, 1 },
>  
> 
> 
>

Patch

Index: gcc/opts.c
===================================================================
--- gcc/opts.c	(revision 189481)
+++ gcc/opts.c	(working copy)
@@ -501,6 +501,7 @@  static const struct default_options default_option
     { OPT_LEVELS_3_PLUS, OPT_funswitch_loops, NULL, 1 },
     { OPT_LEVELS_3_PLUS, OPT_fgcse_after_reload, NULL, 1 },
     { OPT_LEVELS_3_PLUS, OPT_ftree_vectorize, NULL, 1 },
+    { OPT_LEVELS_3_PLUS, OPT_fvect_cost_model, NULL, 1 },
     { OPT_LEVELS_3_PLUS, OPT_fipa_cp_clone, NULL, 1 },
     { OPT_LEVELS_3_PLUS, OPT_ftree_partial_pre, NULL, 1 },