[PATCH] don't add REG_LABEL note to jump insn

Roman Zippel zippel@linux-m68k.org
Mon Aug 9 23:19:00 GMT 2004


Hi,

I found this problem in combination with the previous patch, which accepts 
a few more address patterns.

When combine tries to merge the following instructions, it generates an 
invalid jump instruction by attaching a REG_LABEL note to it.

(insn 14 13 15 0 (set (reg/f:SI 37)
        (plus:SI (reg:SI 35)
            (label_ref:SI 18))) 95 {*addsi3_internal} (insn_list 13 (nil))
    (expr_list:REG_DEAD (reg:SI 35)
        (insn_list:REG_LABEL 18 (nil))))

(jump_insn 15 14 16 0 (set (pc)
        (reg/f:SI 37)) 365 {indirect_jump} (insn_list 14 (nil))
    (expr_list:REG_DEAD (reg/f:SI 37)
        (nil)))

Tested on linux-m68k and linux-i586.

bye, Roman

2004-08-10  Roman Zippel  <zippel@linux-m68k.org>

	* combine.c (distribute_notes): Don't add REG_LABEL to jump insn.

Index: combine.c
===================================================================
RCS file: /home/roman/src/gcc-cvs/gcc/gcc/combine.c,v
retrieving revision 1.445
diff -u -p -c -r1.445 combine.c
*** combine.c	17 Jul 2004 00:31:05 -0000	1.445
--- combine.c	9 Aug 2004 20:15:54 -0000
*************** distribute_notes (rtx notes, rtx from_in
*** 11840,11860 ****
  		place = i2;
  	    }
  
! 	  /* Don't attach REG_LABEL note to a JUMP_INSN which has
! 	     JUMP_LABEL already.  Instead, decrement LABEL_NUSES.  */
! 	  if (place && JUMP_P (place) && JUMP_LABEL (place))
! 	    {
! 	      if (JUMP_LABEL (place) != XEXP (note, 0))
  		abort ();
! 	      if (LABEL_P (JUMP_LABEL (place)))
  		LABEL_NUSES (JUMP_LABEL (place))--;
  	      place = 0;
  	    }
! 	  if (place2 && JUMP_P (place2) && JUMP_LABEL (place2))
  	    {
! 	      if (JUMP_LABEL (place2) != XEXP (note, 0))
  		abort ();
! 	      if (LABEL_P (JUMP_LABEL (place2)))
  		LABEL_NUSES (JUMP_LABEL (place2))--;
  	      place2 = 0;
  	    }
--- 11845,11869 ----
  		place = i2;
  	    }
  
! 	  /* Don't attach REG_LABEL note to a JUMP_INSN.  Add
! 	     a JUMP_LABEL instead or decrement LABEL_NUSES.  */
! 	  if (place && JUMP_P (place))
! 	    {
! 	      if (!JUMP_LABEL (place))
! 		JUMP_LABEL (place) = XEXP (note, 0);
! 	      else if (JUMP_LABEL (place) != XEXP (note, 0))
  		abort ();
! 	      else if (LABEL_P (JUMP_LABEL (place)))
  		LABEL_NUSES (JUMP_LABEL (place))--;
  	      place = 0;
  	    }
! 	  if (place2 && JUMP_P (place2))
  	    {
! 	      if (!JUMP_LABEL (place2))
! 		JUMP_LABEL (place2) = XEXP (note, 0);
! 	      else if (JUMP_LABEL (place2) != XEXP (note, 0))
  		abort ();
! 	      else if (LABEL_P (JUMP_LABEL (place2)))
  		LABEL_NUSES (JUMP_LABEL (place2))--;
  	      place2 = 0;
  	    }



More information about the Gcc-patches mailing list