diff mbox series

Fix PR84777

Message ID alpine.LSU.2.20.1803091417520.18265@zhemvz.fhfr.qr
State New
Headers show
Series Fix PR84777 | expand

Commit Message

Richard Biener March 9, 2018, 1:23 p.m. UTC
With -Os we inhibit most loop header copying which in turn will disable
any vectorization attempt either via -fopenmp or via -ftree-vectorize.

The following makes sure the aggressive gate in 
should_duplicate_loop_header_p is not applied for force-vectorize loops.
There's still PARAM_MAX_LOOP_HEADER_INSNS limiting growth.

This reportedly makes -fopenmp -Os vectorize loops properly.

Bootstrap / regtest running on x86_64-unknown-linux-gnu.

Is this OK for trunk (and branches?) or do we want sth different
in the end?

Thanks,
Richard.

2018-03-09  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/84777
	* tree-ssa-loop-ch.c (should_duplicate_loop_header_p): For
	force-vectorize loops ignore whether we are optimizing for size.

Comments

Jakub Jelinek March 9, 2018, 1:25 p.m. UTC | #1
On Fri, Mar 09, 2018 at 02:23:13PM +0100, Richard Biener wrote:
> 
> With -Os we inhibit most loop header copying which in turn will disable
> any vectorization attempt either via -fopenmp or via -ftree-vectorize.
> 
> The following makes sure the aggressive gate in 
> should_duplicate_loop_header_p is not applied for force-vectorize loops.
> There's still PARAM_MAX_LOOP_HEADER_INSNS limiting growth.
> 
> This reportedly makes -fopenmp -Os vectorize loops properly.
> 
> Bootstrap / regtest running on x86_64-unknown-linux-gnu.
> 
> Is this OK for trunk (and branches?) or do we want sth different
> in the end?

LGTM.

> 2018-03-09  Richard Biener  <rguenther@suse.de>
> 
> 	PR tree-optimization/84777
> 	* tree-ssa-loop-ch.c (should_duplicate_loop_header_p): For
> 	force-vectorize loops ignore whether we are optimizing for size.
> 
> Index: gcc/tree-ssa-loop-ch.c
> ===================================================================
> --- gcc/tree-ssa-loop-ch.c	(revision 258380)
> +++ gcc/tree-ssa-loop-ch.c	(working copy)
> @@ -57,7 +57,8 @@ should_duplicate_loop_header_p (basic_bl
>       be true, since quite often it is possible to verify that the condition is
>       satisfied in the first iteration and therefore to eliminate it.  Jump
>       threading handles these cases now.  */
> -  if (optimize_loop_for_size_p (loop))
> +  if (optimize_loop_for_size_p (loop)
> +      && !loop->force_vectorize)
>      {
>        if (dump_file && (dump_flags & TDF_DETAILS))
>  	fprintf (dump_file,

	Jakub
diff mbox series

Patch

Index: gcc/tree-ssa-loop-ch.c
===================================================================
--- gcc/tree-ssa-loop-ch.c	(revision 258380)
+++ gcc/tree-ssa-loop-ch.c	(working copy)
@@ -57,7 +57,8 @@  should_duplicate_loop_header_p (basic_bl
      be true, since quite often it is possible to verify that the condition is
      satisfied in the first iteration and therefore to eliminate it.  Jump
      threading handles these cases now.  */
-  if (optimize_loop_for_size_p (loop))
+  if (optimize_loop_for_size_p (loop)
+      && !loop->force_vectorize)
     {
       if (dump_file && (dump_flags & TDF_DETAILS))
 	fprintf (dump_file,