[2/2] rs6000: allow cunroll to grow size according to -funroll-loop or -fpeel-loops

Message ID 20200528085207.4021-2-guojiufu@linux.ibm.com
State New
Headers show
Series
  • [1/2] Introduce flag_cunroll_grow_size for cunroll
Related show

Commit Message

Kees Cook via Gcc-patches May 28, 2020, 8:52 a.m.
From: Jiufu Guo <guojiufu@linux.ibm.com>


Previously, flag_unroll_loops was turned on at -O2 implicitly.  It
also turned on cunroll with allowance size increasing, and then cunroll
will unroll/peel the loop even the loop is complex like code in PR95018.
With this patch, size growth for cunroll is allowed if -funroll-loops
or -fpeel-loops is specified explicitly.

Bootstrap/regtest pass on powerpc64le. OK for trunk? And backport to
GCC10?

BR,
Jiufu

gcc/ChangeLog
2020-02-28  Jiufu Guo  <guojiufu@linux.ibm.com>

	PR target/95018
	* config/rs6000/rs6000.c (rs6000_option_override_internal):
	Override flag_cunroll_grow_size.

---
 gcc/config/rs6000/rs6000.c | 5 +++++
 1 file changed, 5 insertions(+)

-- 
2.17.1

Comments

Segher Boessenkool May 28, 2020, 1:45 p.m. | #1
Hi Jiufu,

On Thu, May 28, 2020 at 04:52:07PM +0800, guojiufu wrote:
> gcc/ChangeLog

> 2020-02-28  Jiufu Guo  <guojiufu@linux.ibm.com>

> 

> 	PR target/95018

> 	* config/rs6000/rs6000.c (rs6000_option_override_internal):

> 	Override flag_cunroll_grow_size.


This part is fine of course.  Thanks!


Segher
Kees Cook via Gcc-patches June 4, 2020, 3:40 a.m. | #2
guojiufu <guojiufu@linux.ibm.com> writes:

> From: Jiufu Guo <guojiufu@linux.ibm.com>

>

> --- a/gcc/config/rs6000/rs6000.c

> +++ b/gcc/config/rs6000/rs6000.c

> @@ -4567,7 +4567,12 @@ rs6000_option_override_internal (bool global_init_p)

>  	    unroll_only_small_loops = 0;

>  	  if (!global_options_set.x_flag_rename_registers)

>  	    flag_rename_registers = 1;

> +	  if (!global_options_set.x_flag_cunroll_grow_size)

> +	    flag_cunroll_grow_size = 1;

>  	}

> +      else

> +	if (!global_options_set.x_flag_cunroll_grow_size)

> +	  flag_cunroll_grow_size = flag_peel_loops;


As this patch V2 1/2, also update here accordingy:
         flag_cunroll_grow_size = flag_peel_loops || optimize >= 3;
>  

>        /* If using typedef char *va_list, signal that

>  	 __builtin_va_start (&ap, 0) can be optimized to


BR,
Jiufu

Patch

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 8435bc15d72..df6e03146cb 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -4567,7 +4567,12 @@  rs6000_option_override_internal (bool global_init_p)
 	    unroll_only_small_loops = 0;
 	  if (!global_options_set.x_flag_rename_registers)
 	    flag_rename_registers = 1;
+	  if (!global_options_set.x_flag_cunroll_grow_size)
+	    flag_cunroll_grow_size = 1;
 	}
+      else
+	if (!global_options_set.x_flag_cunroll_grow_size)
+	  flag_cunroll_grow_size = flag_peel_loops;
 
       /* If using typedef char *va_list, signal that
 	 __builtin_va_start (&ap, 0) can be optimized to