This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch RFA] Keep the correct peep2_current_count
- From: Kaz Kojima <kkojima at rr dot iij4u dot or dot jp>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 22 Oct 2005 13:06:52 +0900 (JST)
- Subject: [patch RFA] Keep the correct peep2_current_count
[This is a follow-up of the thread at gcc@ starting with
http://gcc.gnu.org/ml/gcc/2005-10/msg00617.html]
It seems that peep2_current_count is wrongly incremented when
writing a insn to peep2_insn_data[i].insn which holds a insn
already. The attached patch is to fix it.
It's tested with bootstrap and the toplevel "make -k check" on
i686-pc-linux-gnu and powerpc-apple-darwin7.9.0 with no new
failures. Although bootstrap on sh4-unknown-linux-gnu isn't
completed yet, there are no regressions on x86-linux cross
sh4-/sh64-unknown-linux-gnu.
Regards,
kaz
--
:ADDPATCH:
2005-10-22 Kaz Kojima <kkojima@gcc.gnu.org>
PR target/23832
* recog.c (peephole2_optimize): Increment peep2_current_count
only when the slot is empty.
diff -uprN ORIG/gcc/gcc/recog.c TMP/gcc/gcc/recog.c
--- ORIG/gcc/gcc/recog.c 2005-08-28 20:11:17.000000000 +0900
+++ TMP/gcc/gcc/recog.c 2005-10-21 15:44:55.000000000 +0900
@@ -3091,7 +3091,8 @@ peephole2_optimize (FILE *dump_file ATTR
/* Record this insn. */
if (--peep2_current < 0)
peep2_current = MAX_INSNS_PER_PEEP2;
- if (peep2_current_count < MAX_INSNS_PER_PEEP2)
+ if (peep2_current_count < MAX_INSNS_PER_PEEP2
+ && peep2_insn_data[peep2_current].insn == NULL_RTX)
peep2_current_count++;
peep2_insn_data[peep2_current].insn = insn;
propagate_one_insn (pbi, insn);
@@ -3253,7 +3254,8 @@ peephole2_optimize (FILE *dump_file ATTR
{
if (--i < 0)
i = MAX_INSNS_PER_PEEP2;
- if (peep2_current_count < MAX_INSNS_PER_PEEP2)
+ if (peep2_current_count < MAX_INSNS_PER_PEEP2
+ && peep2_insn_data[i].insn == NULL_RTX)
peep2_current_count++;
peep2_insn_data[i].insn = x;
propagate_one_insn (pbi, x);