This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch committed] [SH] Not run scheduling before reload as default.


Hi,

The scheduling before reload is enabled for sh4.  This caused
"unable to find a register to spill in class‘R0_REGS" errors
in several times and there are some PRs which are related to
the first insn scheduling on this target.  We already disabled
it when specifying -fpic or -fexceptions to avoid some of them.  
When revisiting one such PR, I've found that the average performance
gain with the scheduling before reload on this target is a noise
(< 1%), at least for tests in CSiBE and there are some CSiBE
tests with loss:

Execution time (in sec)

with -fno-schedule-insns
bzip2-1.0.2,bzip2.c	44.98	45.07	45.08

with -fschedule-insns
bzip2-1.0.2,bzip2.c	45.95	46.00	46.16

OTOH, it consumes the unignorable compile time.  Here is a report
for fold-const.i with a cross sh4 trunk compiler:

 scheduling :   2.48 ( 4%) usr   0.38 (19%) sys   2.96 ( 4%) wall

and it took 2-5% of the total compile time for enough large
files I've examined.
So I'm inclined to think that it doesn't pay off in general.
The attached patch is to enable the scheduling before reload
for sh4 only with the explicit user request.
It's tested with bootstrap and the top level "make -k check" on
sh4-unknown-linux-gnu with no new failures.

Regards,
	kaz
--
2009-05-12  Kaz Kojima  <kkojima@gcc.gnu.org>

	* config/sh/sh.h (OVERRIDE_OPTIONS): Clear flag_schedule_insns
	unless -fschedule-insns is specified.

--- ORIG/trunk/gcc/config/sh/sh.h	2009-05-12 22:06:55.000000000 +0900
+++ trunk/gcc/config/sh/sh.h	2009-05-12 22:07:10.000000000 +0900
@@ -709,8 +709,9 @@ do {									\
       /* Never run scheduling before reload, since that can		\
 	 break global alloc, and generates slower code anyway due	\
 	 to the pressure on R0.  */					\
-      /* Enable sched1 for SH4; ready queue will be reordered by	\
-	 the target hooks when pressure is high. We can not do this for \
+      /* Enable sched1 for SH4 if the user explicitly requests.		\
+	 When sched1 is enabled, the ready queue will be reordered by	\
+	 the target hooks if pressure is high.  We can not do this for	\
 	 PIC, SH3 and lower as they give spill failures for R0.  */	\
       if (!TARGET_HARD_SH4 || flag_pic)					\
         flag_schedule_insns = 0;		 			\
@@ -725,6 +726,8 @@ do {									\
 	    warning (0, "ignoring -fschedule-insns because of exception handling bug");	\
 	  flag_schedule_insns = 0;		 			\
 	}								\
+      else if (flag_schedule_insns == 2)				\
+	flag_schedule_insns = 0;		 			\
     }									\
 									\
   if (align_loops == 0)							\


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]