This is the mail archive of the 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]

[vta] fix thinkos in ifcvt

If there's a note between debug insns, ifcvt wouldn't scan back far
enough for insn_b, because of a thinko in one of my ifcvt patches
already installed in the vta branch.

While at that, I figured the uses of PREV_INSN in the tests for insn_b
could vary depending on the presence of notes (or debug insns) between
insn_b and cond_earliest.  Since the case of insn_b modifying one of
its inputs is already covered by reg_overlap_mentioned_p (x, SET_SRC
(set_b)), I've modified the code to start scanning for other
modifications to insn_b's inputs right after insn_b.

Installing in the vta branch.

for  gcc/ChangeLog.vta
from  Alexandre Oliva  <>

	* ifcvt.c (noce_process_if_block): Skip notes in between debug
	insns when scanning back for insn_b.  Check for mods starting
	after insn_b.

Index: gcc/ifcvt.c
--- gcc/ifcvt.c.orig	2007-10-01 22:49:01.000000000 -0300
+++ gcc/ifcvt.c	2007-11-11 05:09:34.000000000 -0200
@@ -2198,7 +2198,7 @@ noce_process_if_block (struct noce_if_in
       insn_b = prev_nonnote_insn (if_info->cond_earliest);
       while (insn_b && DEBUG_INSN_P (insn_b))
-	insn_b = PREV_INSN (insn_b);
+	insn_b = prev_nonnote_insn (insn_b);
       /* We're going to be moving the evaluation of B down from above
 	 COND_EARLIEST to JUMP.  Make sure the relevant data is still
 	 intact.  */
@@ -2209,14 +2209,13 @@ noce_process_if_block (struct noce_if_in
 	  || ! rtx_equal_p (x, SET_DEST (set_b))
 	  || ! noce_operand_ok (SET_SRC (set_b))
 	  || reg_overlap_mentioned_p (x, SET_SRC (set_b))
-	  || modified_between_p (SET_SRC (set_b),
-				 PREV_INSN (if_info->cond_earliest), jump)
+	  || modified_between_p (SET_SRC (set_b), NEXT_INSN (insn_b), jump)
 	  /* Likewise with X.  In particular this can happen when
 	     noce_get_condition looks farther back in the instruction
 	     stream than one might expect.  */
 	  || reg_overlap_mentioned_p (x, cond)
 	  || reg_overlap_mentioned_p (x, a)
-	  || modified_between_p (x, PREV_INSN (if_info->cond_earliest), jump))
+	  || modified_between_p (x, NEXT_INSN (insn_b), jump))
 	insn_b = set_b = NULL_RTX;
Alexandre Oliva
FSF Latin America Board Member
Red Hat Compiler Engineer   aoliva@{,}
Free Software Evangelist  oliva@{,}

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