This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Committed, fix for PR regression/19898, cris_notice_update_cc


In final, at time of call to NOTICE_UPDATE_CC, we had for -O2:

(insn:QI 44 42 45 (set (cc0)
        (compare (reg/f:SI 1 r1 [orig:34 ivtmp.30 ] [34])
            (reg/v/f:SI 13 r13 [orig:36 p ] [36]))) 9 {cmpsi}
(insn_list:REG_DEP_TRUE 42 (nil))
    (nil))

(jump_insn 45 44 130 (set (pc)
        (if_then_else (eq (cc0)
                (const_int 0 [0x0]))
            (label_ref 46)
            (pc))) 150 {beq} (nil)
    (expr_list:REG_BR_PRED (const_int 18 [0x12])
        (expr_list:REG_BR_PROB (const_int 1100 [0x44c])
            (nil))))

(note 130 45 186 NOTE_INSN_LOOP_END)

(note 186 130 183 [bb 15] NOTE_INSN_BASIC_BLOCK)

(insn 183 186 184 (set (mem:QI (post_inc:SI (reg/v/f:SI 13 r13
[orig:36 p ] [36])) [0 S1 A8])
        (const_int 0 [0x0])) 41 {movqi} (nil)
    (expr_list:REG_INC (reg/v/f:SI 13 r13 [orig:36 p ] [36])
        (nil)))

(insn 184 183 185 (set (cc0)
        (compare (reg/f:SI 1 r1 [orig:34 ivtmp.30 ] [34])
            (reg/v/f:SI 13 r13 [orig:36 p ] [36]))) 9 {cmpsi} (nil)
    (nil))


Insn 183 doesn't change condition codes, but it does invalidate
that cc0 of (compare (reg/f:SI 1 r1) (reg/v/f:SI 13 r13) through
the postincrement, so insn 184 is *not* redundant.  Exposed by
gcc.c-torture/execute/strlen-1.c just recently, but the
correction should be installed on all branches.

	PR regression/19898.
	* config/cris/cris.c (cris_notice_update_cc): When testing if insn
	changes cc_status, use apply modified_in_p to part of cc_status
	and insn, not cris_reg_overlap_mentioned_p on SET_DEST of insn
	body.

Index: cris.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/cris/cris.c,v
retrieving revision 1.64
diff -c -p -u -p -r1.64 cris.c
cvs diff: conflicting specifications of output style
--- cris.c	10 Feb 2005 18:59:07 -0000	1.64
+++ cris.c	12 Feb 2005 00:49:01 -0000
@@ -1834,13 +1834,11 @@ cris_notice_update_cc (rtx exp, rtx insn
       if (GET_CODE (exp) == SET)
 	{
 	  if (cc_status.value1
-	      && cris_reg_overlap_mentioned_p (SET_DEST (exp),
-					     cc_status.value1))
+	      && modified_in_p (cc_status.value1, insn))
 	    cc_status.value1 = 0;
 
 	  if (cc_status.value2
-	      && cris_reg_overlap_mentioned_p (SET_DEST (exp),
-					     cc_status.value2))
+	      && modified_in_p (cc_status.value2, insn))
 	    cc_status.value2 = 0;
 	}
       return;
@@ -1970,14 +1968,12 @@ cris_notice_update_cc (rtx exp, rtx insn
 		{
 		  /* There's no CC0 change when clearing a register or
 		     memory.  Just check for overlap.  */
-		  if ((cc_status.value1
-		       && cris_reg_overlap_mentioned_p (SET_DEST (exp),
-							cc_status.value1)))
+		  if (cc_status.value1
+		      && modified_in_p (cc_status.value1, insn))
 		    cc_status.value1 = 0;
 
-		  if ((cc_status.value2
-		       && cris_reg_overlap_mentioned_p (SET_DEST (exp),
-							cc_status.value2)))
+		  if (cc_status.value2
+		      && modified_in_p (cc_status.value2, insn))
 		    cc_status.value2 = 0;
 
 		  return;
@@ -2009,14 +2005,12 @@ cris_notice_update_cc (rtx exp, rtx insn
 	    {
 	      /* When SET to MEM, then CC is not changed (except for
 		 overlap).  */
-	      if ((cc_status.value1
-		   && cris_reg_overlap_mentioned_p (SET_DEST (exp),
-						    cc_status.value1)))
+	      if (cc_status.value1
+		  && modified_in_p (cc_status.value1, insn))
 		cc_status.value1 = 0;
 
-	      if ((cc_status.value2
-		   && cris_reg_overlap_mentioned_p (SET_DEST (exp),
-						    cc_status.value2)))
+	      if (cc_status.value2
+		  && modified_in_p (cc_status.value2, insn))
 		cc_status.value2 = 0;
 
 	      return;
@@ -2053,31 +2047,11 @@ cris_notice_update_cc (rtx exp, rtx insn
 		  /* For "move.S rz,[rx=ry+o]" and "clear.S [rx=ry+o]",
 		     say flags are not changed, except for overlap.  */
 		  if (cc_status.value1
-		      && cris_reg_overlap_mentioned_p (XEXP
-						       (XVECEXP
-							(exp, 0, 0), 0),
-						       cc_status.value1))
-		    cc_status.value1 = 0;
-
-		  if (cc_status.value1
-		      && cris_reg_overlap_mentioned_p (XEXP
-						       (XVECEXP
-							(exp, 0, 1), 0),
-						       cc_status.value1))
+		      && modified_in_p (cc_status.value1, insn))
 		    cc_status.value1 = 0;
 
 		  if (cc_status.value2
-		      && cris_reg_overlap_mentioned_p (XEXP
-						       (XVECEXP
-							(exp, 0, 0), 0),
-						       cc_status.value2))
-		    cc_status.value2 = 0;
-
-		  if (cc_status.value2
-		      && cris_reg_overlap_mentioned_p (XEXP
-						       (XVECEXP
-							(exp, 0, 1), 0),
-						       cc_status.value2))
+		      && modified_in_p (cc_status.value2, insn))
 		    cc_status.value2 = 0;
 
 		  return;

brgds, H-P


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]