This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix pre_insert_copy_insn
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc-patches at gcc dot gnu dot org, rth at redhat dot com
- Date: Tue, 17 Jun 2003 22:18:31 +0200
- Subject: Fix pre_insert_copy_insn
Hi,
the following testcase when compiled with -O3 -mcpu=pentium4
-minline-all-stringops crashes gcse. Gcse is dealing with limited amount of
parallels when it is able to break them up so pre_insert_copy_insn needs to
cope with them (even when it does complette nonsense in this case - it won't
obsolette the whole thing)
Honza
struct T
{
unsigned char o[1];
};
void
f (struct T *r)
{
memcpy (r->o, 0, r->o + 1);
memcpy (r->o, 0, r->o + 1);
}
Tue Jun 17 22:15:21 CEST 2003 Jan Hubicka <jh@suse.cz>
* gcse.c (pre_insert_copy_insn): Deal nicely with parallels.
Index: gcse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
retrieving revision 1.222.2.6
diff -c -3 -p -r1.222.2.6 gcse.c
*** gcse.c 20 May 2003 10:16:09 -0000 1.222.2.6
--- gcse.c 17 Jun 2003 20:14:47 -0000
*************** pre_insert_copy_insn (expr, insn)
*** 5311,5321 ****
rtx reg = expr->reaching_reg;
int regno = REGNO (reg);
int indx = expr->bitmap_index;
! rtx set = single_set (insn);
rtx new_insn;
! if (!set)
! abort ();
new_insn = emit_insn_after (gen_move_insn (reg, SET_DEST (set)), insn);
--- 5311,5333 ----
rtx reg = expr->reaching_reg;
int regno = REGNO (reg);
int indx = expr->bitmap_index;
! rtx pat = PATTERN (insn), set = pat;
rtx new_insn;
+ int i;
! if (GET_CODE (set) == PARALLEL)
! {
! for (i = 0; i < XVECLEN (pat, 0); i++)
! {
! set = XVECEXP (pat, 0, i);
!
! if (GET_CODE (set) == SET
! && rtx_equal_p (SET_SRC (set), expr->expr))
! break;
! }
! if (!set)
! abort ();
! }
new_insn = emit_insn_after (gen_move_insn (reg, SET_DEST (set)), insn);