Patch for jump optimization

Michael P. Hayes michaelh@ongaonga.chch.cri.nz
Tue Feb 3 02:43:00 GMT 1998


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)




More information about the Gcc mailing list