------- Comment #5 from kkojima at gcc dot gnu dot org 2008-07-02 03:50 ------- SH backend enables insn scheduling before reload for SH4 when the estimated R0 register pressure is low. This PR reveals that it doesn't work well for PIC which will make many implicit R0 uses. It seems that there is no easy way to compute accurate R0 register pressure in that case. I'm testing the patch below.
--- ORIG/trunk/gcc/config/sh/sh.h 2008-05-23 07:30:02.000000000 +0900 +++ INTEST/trunk/gcc/config/sh/sh.h 2008-07-02 08:41:42.000000000 +0900 @@ -712,8 +712,8 @@ do { \ 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 \ - SH3 and lower as they give spill failures for R0. */ \ - if (!TARGET_HARD_SH4) \ + PIC, SH3 and lower as they give spill failures for R0. */ \ + if (!TARGET_HARD_SH4 || flag_pic) \ flag_schedule_insns = 0; \ /* ??? Current exception handling places basic block boundaries \ after call_insns. It causes the high pressure on R0 and gives \ -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36684