Patchwork [ARM/Embedded-4_8-branch] disable rtl loop invariant when optimizing for size

login
register
mail settings
Submitter Bin Cheng
Date Aug. 29, 2013, 3:18 a.m.
Message ID <003801cea466$65659a60$3030cf20$@arm.com>
Download mbox | patch
Permalink /patch/270685/
State New
Headers show

Comments

Bin Cheng - Aug. 29, 2013, 3:18 a.m.
Hi,

The attached patch disables rtl loop invariant when optimizing for code
size.  Committed to ARM/Embedded-4_8-branch as r202067.

Thanks.
bin

2013-08-29  Zhenqiang Chen  <zhenqiang.chen@arm.com>

	* config/arm/arm.c (arm_option_override): Disable loop2_invariant
	pass when optimize_size and ira-loop-pressure is not enabled.

Patch

Index: gcc/ChangeLog.arm
===================================================================
--- gcc/ChangeLog.arm	(revision 202066)
+++ gcc/ChangeLog.arm	(revision 202067)
@@ -1,3 +1,8 @@ 
+2013-08-29  Zhenqiang Chen  <zhenqiang.chen@arm.com>
+
+	* config/arm/arm.c (arm_option_override): Disable loop2_invariant
+	pass when optimize_size and ira-loop-pressure is not enabled.
+
 2013-08-05  Terry Guo  <terry.guo@arm.com>
 
 	Backport from mainline r197956
Index: gcc/config/arm/arm.c
===================================================================
--- gcc/config/arm/arm.c	(revision 202066)
+++ gcc/config/arm/arm.c	(revision 202067)
@@ -2134,6 +2134,13 @@ 
                          global_options.x_param_values,
                          global_options_set.x_param_values);
 
+  /* Do not move invariants out of loops since it tends to increase register
+     pressure.  The heuristic to estimate register pressure does not fit for
+     ARM.  -fira-loop-pressure tends to get more precise estimation.  But it
+     still need more tuning.  */
+  if (optimize_function_for_size_p (cfun) && !flag_ira_loop_pressure)
+    flag_move_loop_invariants = 0;
+
   /* Register global variables with the garbage collector.  */
   arm_add_gc_roots ();
 }