public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Patch for jump optimization
@ 1998-02-02 21:49 Weiwen Liu
  1998-02-02 23:05 ` Jeffrey A Law
  1998-02-03  2:43 ` Michael P. Hayes
  0 siblings, 2 replies; 9+ messages in thread
From: Weiwen Liu @ 1998-02-02 21:49 UTC (permalink / raw)
  To: egcs

On alpha-dec-osf4.0, the current egcs in the cvs tree fails to build
libgcc2.a, because the jump optimization (modified_in_p) fails to
process the following insn.

(jump_insn 52 51 54 (set (pc)
        (if_then_else (eq (reg:DI 102)
                (const_int 0))
            (label_ref 56)
            (pc))) 178 {umindi3+2} (nil)
    (nil))

I use the following patch to get the bootstrap going.

Mon Feb  2 1998 11:00:20  Weiwen Liu <weiwen.liu@yale.edu>
	* rtlanal.c (modified_in_p): Do not check modified_in_p if
	XEXP (x, i) is NULL.

Index: rtlanal.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/rtlanal.c,v
retrieving revision 1.6
diff -u -p -r1.6 rtlanal.c
--- rtlanal.c	1998/01/28 19:21:48	1.6
+++ rtlanal.c	1998/02/03 03:46:30
@@ -594,7 +594,7 @@ modified_in_p (x, insn)
   fmt = GET_RTX_FORMAT (code);
   for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
     {
-      if (fmt[i] == 'e' && modified_in_p (XEXP (x, i), insn))
+      if (fmt[i] == 'e' && XEXP (x, i) && modified_in_p (XEXP (x, i), insn))
 	return 1;
 
       if (fmt[i] == 'E')




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Patch for jump optimization
  1998-02-02 21:49 Patch for jump optimization Weiwen Liu
@ 1998-02-02 23:05 ` Jeffrey A Law
  1998-02-03  0:08   ` Richard Henderson
                     ` (2 more replies)
  1998-02-03  2:43 ` Michael P. Hayes
  1 sibling, 3 replies; 9+ messages in thread
From: Jeffrey A Law @ 1998-02-02 23:05 UTC (permalink / raw)
  To: Weiwen Liu; +Cc: egcs

  In message < Pine.OSF.3.96.980202225739.10800A-100000@ylws34 >you write:
  > On alpha-dec-osf4.0, the current egcs in the cvs tree fails to build
  > libgcc2.a, because the jump optimization (modified_in_p) fails to
  > process the following insn.
  > 
  > (jump_insn 52 51 54 (set (pc)
  >         (if_then_else (eq (reg:DI 102)
  >                 (const_int 0))
  >             (label_ref 56)
  >             (pc))) 178 {umindi3+2} (nil)
  >     (nil))
  > 
  > I use the following patch to get the bootstrap going.
  > 
  > Mon Feb  2 1998 11:00:20  Weiwen Liu <weiwen.liu@yale.edu>
  > 	* rtlanal.c (modified_in_p): Do not check modified_in_p if
  > 	XEXP (x, i) is NULL.
What field number was NULL (ie, what is the value of 'i' when it failed)?

The real bug might be elsewhere...

jeff

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Patch for jump optimization
  1998-02-02 23:05 ` Jeffrey A Law
@ 1998-02-03  0:08   ` Richard Henderson
  1998-02-03  0:08     ` Jeffrey A Law
  1998-02-03  1:16   ` Richard Henderson
  1998-02-03  4:00   ` Weiwen Liu
  2 siblings, 1 reply; 9+ messages in thread
From: Richard Henderson @ 1998-02-03  0:08 UTC (permalink / raw)
  To: law; +Cc: egcs

Err, not PATTERN (temp) but 

	modifued_in_p (PATTERN (insn), temp)

certainly that fixes the immediate problem.


r~

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Patch for jump optimization
  1998-02-03  0:08   ` Richard Henderson
@ 1998-02-03  0:08     ` Jeffrey A Law
  0 siblings, 0 replies; 9+ messages in thread
From: Jeffrey A Law @ 1998-02-03  0:08 UTC (permalink / raw)
  To: Richard Henderson; +Cc: egcs

  In message < 19980203000517.65224@dot.cygnus.com >you write:
  > Err, not PATTERN (temp) but 
  > 
  > 	modifued_in_p (PATTERN (insn), temp)
  > 
  > certainly that fixes the immediate problem.
Agreed.  The first arg should be a pattern, the second an actual insn.

I'll go fix it :-)

jeff

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Patch for jump optimization
  1998-02-02 23:05 ` Jeffrey A Law
  1998-02-03  0:08   ` Richard Henderson
@ 1998-02-03  1:16   ` Richard Henderson
  1998-02-03  4:00   ` Weiwen Liu
  2 siblings, 0 replies; 9+ messages in thread
From: Richard Henderson @ 1998-02-03  1:16 UTC (permalink / raw)
  To: law; +Cc: Weiwen Liu, egcs

On Tue, Feb 03, 1998 at 12:06:56AM -0700, Jeffrey A Law wrote:
>   > (jump_insn 52 51 54 (set (pc)
>   >         (if_then_else (eq (reg:DI 102)
>   >                 (const_int 0))
>   >             (label_ref 56)
>   >             (pc))) 178 {umindi3+2} (nil)
>   >     (nil))
>
> What field number was NULL (ie, what is the value of 'i' when it failed)?

6 -- that (nil) up there.

> The real bug might be elsewhere...

I'm inclined to think those modified_in_p calls you added
shouldn't be passing in temp, but rather PATTERN(temp).


r~

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Patch for jump optimization
  1998-02-02 21:49 Patch for jump optimization Weiwen Liu
  1998-02-02 23:05 ` Jeffrey A Law
@ 1998-02-03  2:43 ` Michael P. Hayes
  1998-02-03 21:35   ` Jeffrey A Law
  1 sibling, 1 reply; 9+ messages in thread
From: Michael P. Hayes @ 1998-02-03  2:43 UTC (permalink / raw)
  To: Weiwen Liu, j.law; +Cc: egcs

Weiwen Liu writes:
 > On alpha-dec-osf4.0, the current egcs in the cvs tree fails to build
 > libgcc2.a, because the jump optimization (modified_in_p) fails to
 > process the following insn.
 > 
 > (jump_insn 52 51 54 (set (pc)
 >         (if_then_else (eq (reg:DI 102)
 >                 (const_int 0))
 >             (label_ref 56)
 >             (pc))) 178 {umindi3+2} (nil)
 >     (nil))

The problem is that Jeff got a little carried away installing an old
patch of mine that disabled some jump optimisations if the inserted
insn clobbered something required by the following insn.
I fixed the problem for GCC 2.8.0 by looking for safer places that
the insn could be inserted, and then only rejecting the optimisation
if it couldn't find a suitable place.

The calls to modified_in_p aren't required.


Index: jump.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/jump.c,v
retrieving revision 1.10
diff -p -u -r1.10 jump.c
--- jump.c	1998/02/03 00:09:57	1.10
+++ jump.c	1998/02/03 08:38:26
@@ -995,7 +995,6 @@ jump_optimize (f, cross_jump, noop_moves
 	      && GET_CODE (SET_SRC (temp1)) != REG
 	      && GET_CODE (SET_SRC (temp1)) != SUBREG
 	      && GET_CODE (SET_SRC (temp1)) != CONST_INT
-	      && ! modified_in_p (PATTERN (insn), temp)
 	      && ! side_effects_p (SET_SRC (temp1))
 	      && ! may_trap_p (SET_SRC (temp1))
 	      && rtx_cost (SET_SRC (temp1), SET) < 10)
@@ -1035,13 +1034,11 @@ jump_optimize (f, cross_jump, noop_moves
 	      && GET_MODE_CLASS (GET_MODE (temp2)) == MODE_INT
 	      && (! SMALL_REGISTER_CLASSES
 		  || REGNO (temp2) >= FIRST_PSEUDO_REGISTER)
-	      && ! modified_in_p (PATTERN (insn), temp)
 	      && ! side_effects_p (SET_SRC (temp1))
 	      && ! may_trap_p (SET_SRC (temp1))
 	      && rtx_cost (SET_SRC (temp1), SET) < 10
 	      && (temp4 = single_set (temp3)) != 0
 	      && rtx_equal_p (SET_DEST (temp4), temp2)
-	      && ! modified_in_p (PATTERN (insn), temp3)
 	      && ! side_effects_p (SET_SRC (temp4))
 	      && ! may_trap_p (SET_SRC (temp4))
 	      && rtx_cost (SET_SRC (temp4), SET) < 10)
@@ -1094,7 +1091,6 @@ jump_optimize (f, cross_jump, noop_moves
 	      && REGNO (temp5) >= FIRST_PSEUDO_REGISTER
 	      && REGNO_FIRST_UID (REGNO (temp5)) == INSN_UID (temp)
 	      && REGNO_LAST_UID (REGNO (temp5)) == INSN_UID (temp3)
-	      && ! modified_in_p (PATTERN (insn), temp)
 	      && ! side_effects_p (SET_SRC (temp1))
 	      && ! may_trap_p (SET_SRC (temp1))
 	      && rtx_cost (SET_SRC (temp1), SET) < 10
@@ -1104,7 +1100,6 @@ jump_optimize (f, cross_jump, noop_moves
 	      && (! SMALL_REGISTER_CLASSES
 		  || REGNO (temp2) >= FIRST_PSEUDO_REGISTER)
 	      && rtx_equal_p (SET_DEST (temp4), temp2)
-	      && ! modified_in_p (PATTERN (insn), temp3)
 	      && ! side_effects_p (SET_SRC (temp4))
 	      && ! may_trap_p (SET_SRC (temp4))
 	      && rtx_cost (SET_SRC (temp4), SET) < 10)


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Patch for jump optimization
  1998-02-02 23:05 ` Jeffrey A Law
  1998-02-03  0:08   ` Richard Henderson
  1998-02-03  1:16   ` Richard Henderson
@ 1998-02-03  4:00   ` Weiwen Liu
  2 siblings, 0 replies; 9+ messages in thread
From: Weiwen Liu @ 1998-02-03  4:00 UTC (permalink / raw)
  To: law; +Cc: egcs

On Tue, 3 Feb 1998, Jeffrey A Law wrote:

> 
>   In message < Pine.OSF.3.96.980202225739.10800A-100000@ylws34 >you write:
>   > On alpha-dec-osf4.0, the current egcs in the cvs tree fails to build
>   > libgcc2.a, because the jump optimization (modified_in_p) fails to
>   > process the following insn.
>   > 
>   > (jump_insn 52 51 54 (set (pc)
>   >         (if_then_else (eq (reg:DI 102)
>   >                 (const_int 0))
>   >             (label_ref 56)
>   >             (pc))) 178 {umindi3+2} (nil)
>   >     (nil))
>   > 
>   > I use the following patch to get the bootstrap going.
>   > 
>   > Mon Feb  2 1998 11:00:20  Weiwen Liu <weiwen.liu@yale.edu>
>   > 	* rtlanal.c (modified_in_p): Do not check modified_in_p if
>   > 	XEXP (x, i) is NULL.
> What field number was NULL (ie, what is the value of 'i' when it failed)?
> 
> The real bug might be elsewhere...
> 
> jeff
> 

When i is 6, XEXP (x, 6) = (nil)


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Patch for jump optimization
  1998-02-03  2:43 ` Michael P. Hayes
@ 1998-02-03 21:35   ` Jeffrey A Law
  1998-02-04 18:12     ` Michael P. Hayes
  0 siblings, 1 reply; 9+ messages in thread
From: Jeffrey A Law @ 1998-02-03 21:35 UTC (permalink / raw)
  To: Michael P. Hayes; +Cc: Weiwen Liu, law, egcs

  In message < 199802030846.VAA11549@ongaonga.chch.cri.nz >you write:
  > Weiwen Liu writes:
  >  > On alpha-dec-osf4.0, the current egcs in the cvs tree fails to build
  >  > libgcc2.a, because the jump optimization (modified_in_p) fails to
  >  > process the following insn.
  >  > 
  >  > (jump_insn 52 51 54 (set (pc)
  >  >         (if_then_else (eq (reg:DI 102)
  >  >                 (const_int 0))
  >  >             (label_ref 56)
  >  >             (pc))) 178 {umindi3+2} (nil)
  >  >     (nil))
  > 
  > The problem is that Jeff got a little carried away installing an old
  > patch of mine that disabled some jump optimisations if the inserted
  > insn clobbered something required by the following insn.
  > I fixed the problem for GCC 2.8.0 by looking for safer places that
  > the insn could be inserted, and then only rejecting the optimisation
  > if it couldn't find a suitable place.
  > 
I must have missed that -- I didn't remember seeing any related changes go
into gcc-2.8.  I must have missed them.

Just so we're both clear, the stuff to handle constants in memory should be
OK right?

  > The calls to modified_in_p aren't required.
I'll install your updated patch :-)

Thanks for clarifying things!

jeff

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Patch for jump optimization
  1998-02-03 21:35   ` Jeffrey A Law
@ 1998-02-04 18:12     ` Michael P. Hayes
  0 siblings, 0 replies; 9+ messages in thread
From: Michael P. Hayes @ 1998-02-04 18:12 UTC (permalink / raw)
  To: law; +Cc: Michael P. Hayes, Weiwen Liu, egcs

Jeffrey A Law writes:
 >   > I fixed the problem for GCC 2.8.0 by looking for safer places that
 >   > the insn could be inserted, and then only rejecting the optimisation
 >   > if it couldn't find a suitable place.
 >   > 
 > I must have missed that -- I didn't remember seeing any related changes go
 > into gcc-2.8.  I must have missed them.
 > 
 > Just so we're both clear, the stuff to handle constants in memory should be
 > OK right?

Yes, the stuff to handle conditional floating point loads and
conditional loads of constants in memory should be OK.  We could
probably generalise things to any operand supported by the backend.

Michael.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~1998-02-04 18:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-02 21:49 Patch for jump optimization Weiwen Liu
1998-02-02 23:05 ` Jeffrey A Law
1998-02-03  0:08   ` Richard Henderson
1998-02-03  0:08     ` Jeffrey A Law
1998-02-03  1:16   ` Richard Henderson
1998-02-03  4:00   ` Weiwen Liu
1998-02-03  2:43 ` Michael P. Hayes
1998-02-03 21:35   ` Jeffrey A Law
1998-02-04 18:12     ` Michael P. Hayes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).