This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Stage1 of current CVS gcc aborts when compiling reload1.c
- To: Jan Hubicka <jh at suse dot cz>
- Subject: Re: Stage1 of current CVS gcc aborts when compiling reload1.c
- From: Richard Henderson <rth at cygnus dot com>
- Date: Thu, 18 May 2000 20:44:03 -0700
- Cc: Philipp Thomas <pthomas at suse dot de>, gcc-bugs at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- References: <20000517002110.F18255@Jeffreys.suse.de> <20000517201739.B16266@atrey.karlin.mff.cuni.cz>
On Wed, May 17, 2000 at 08:17:39PM +0200, Jan Hubicka wrote:
> > Any update on that? I ask because current CVS still fails when configured
> > for k6-* at the exact same location.
>
> I've investigated a bug a bit and have proper fix for it in my local sources,
> but it depends on some of my other patches to loop.c not reviewed yet.
> I will probably need to make independent fix, but I will probably not
> able to do that before 10th, since I am leaving to Spain soon.
Here's a nice small independant patch for this problem.
Bootstrapped with BOOT_CFLAGS='-O2 -g -march=k6'.
r~
* rtlanal.c (insn_dependant_p, insn_dependant_p_1): New.
* rtl.h (insn_dependant_p): Declare it.
* loop.c (strength_reduce): Use it.
Index: loop.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/loop.c,v
retrieving revision 1.247
diff -c -p -d -r1.247 loop.c
*** loop.c 2000/05/15 17:07:13 1.247
--- loop.c 2000/05/19 03:41:10
*************** strength_reduce (loop, insn_count, flags
*** 4119,4128 ****
for (next = NEXT_INSN (dominator); ; next = NEXT_INSN (next))
{
! if ((INSN_P (next)
! && (reg_mentioned_p (giv, PATTERN (next))
! || reg_set_p (bl2->biv->src_reg, next)))
! || GET_CODE (next) == JUMP_INSN)
break;
#ifdef HAVE_cc0
if (! INSN_P (next)
--- 4119,4127 ----
for (next = NEXT_INSN (dominator); ; next = NEXT_INSN (next))
{
! if (GET_CODE (next) == JUMP_INSN
! || (INSN_P (next)
! && insn_dependant_p (giv_insn, next)))
break;
#ifdef HAVE_cc0
if (! INSN_P (next)
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/rtl.h,v
retrieving revision 1.201
diff -c -p -d -r1.201 rtl.h
*** rtl.h 2000/05/15 19:53:07 1.201
--- rtl.h 2000/05/19 03:41:10
*************** extern int modified_between_p PARAMS ((
*** 1212,1217 ****
--- 1212,1218 ----
extern int no_labels_between_p PARAMS ((rtx, rtx));
extern int no_jumps_between_p PARAMS ((rtx, rtx));
extern int modified_in_p PARAMS ((rtx, rtx));
+ extern int insn_dependant_p PARAMS ((rtx, rtx));
extern int reg_set_p PARAMS ((rtx, rtx));
extern rtx single_set PARAMS ((rtx));
extern int multiple_sets PARAMS ((rtx));
Index: rtlanal.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/rtlanal.c,v
retrieving revision 1.61
diff -c -p -d -r1.61 rtlanal.c
*** rtlanal.c 2000/05/09 04:58:44 1.61
--- rtlanal.c 2000/05/19 03:41:10
*************** Boston, MA 02111-1307, USA. */
*** 26,31 ****
--- 26,32 ----
static int rtx_addr_can_trap_p PARAMS ((rtx));
static void reg_set_p_1 PARAMS ((rtx, rtx, void *));
+ static void insn_dependant_p_1 PARAMS ((rtx, rtx, void *));
static void reg_set_last_1 PARAMS ((rtx, rtx, void *));
*************** modified_in_p (x, insn)
*** 686,691 ****
--- 687,731 ----
}
return 0;
+ }
+
+ /* Return true if anything in insn X is (anti,output,true) dependant on
+ anything in insn Y. */
+
+ int
+ insn_dependant_p (x, y)
+ rtx x, y;
+ {
+ rtx tmp;
+
+ if (! INSN_P (x) || ! INSN_P (y))
+ abort ();
+
+ tmp = PATTERN (y);
+ note_stores (PATTERN (x), insn_dependant_p_1, &tmp);
+ if (tmp == NULL_RTX)
+ return 1;
+
+ tmp = PATTERN (x);
+ note_stores (PATTERN (y), insn_dependant_p_1, &tmp);
+ if (tmp == NULL_RTX)
+ return 1;
+
+ return 0;
+ }
+
+ /* A helper routine for insn_dependant_p called through note_stores. */
+
+ static void
+ insn_dependant_p_1 (x, pat, data)
+ rtx x;
+ rtx pat ATTRIBUTE_UNUSED;
+ void *data;
+ {
+ rtx * pinsn = (rtx *) data;
+
+ if (*pinsn && reg_mentioned_p (x, *pinsn))
+ *pinsn = NULL_RTX;
}
/* Given an INSN, return a SET expression if this insn has only a single SET.