This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][3.4] for PR16408
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 25 Aug 2004 20:16:58 +0200
- Subject: [PATCH][3.4] for PR16408
Hello,
replace_store_insn removes an insn, but leaves references to it
in libcall/retval notes. This causes an attempt to remove the
insn second time in dce and consequently the ICE.
The same problem is latently present in mainline.
Bootstrapped and regtested on i686.
Zdenek
PR rtl-optimization/16408
* gcse.c (replace_store_insn): Fix LIBCALL/RETVAL notes.
Index: gcse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
retrieving revision 1.288.2.4
diff -c -3 -p -r1.288.2.4 gcse.c
*** gcse.c 25 Mar 2004 16:44:42 -0000 1.288.2.4
--- gcse.c 25 Aug 2004 15:37:28 -0000
*************** remove_reachable_equiv_notes (basic_bloc
*** 7824,7830 ****
static void
replace_store_insn (rtx reg, rtx del, basic_block bb, struct ls_expr *smexpr)
{
! rtx insn, mem, note, set, ptr;
mem = smexpr->pattern;
insn = gen_move_insn (reg, SET_SRC (single_set (del)));
--- 7824,7830 ----
static void
replace_store_insn (rtx reg, rtx del, basic_block bb, struct ls_expr *smexpr)
{
! rtx insn, mem, note, set, ptr, pair;
mem = smexpr->pattern;
insn = gen_move_insn (reg, SET_SRC (single_set (del)));
*************** replace_store_insn (rtx reg, rtx del, ba
*** 7846,7851 ****
--- 7846,7871 ----
XEXP (ptr, 0) = insn;
break;
}
+
+ /* Move the notes from the deleted insn to its replacement, and patch
+ up the LIBCALL notes. */
+ REG_NOTES (insn) = REG_NOTES (del);
+
+ note = find_reg_note (insn, REG_RETVAL, NULL_RTX);
+ if (note)
+ {
+ pair = XEXP (note, 0);
+ note = find_reg_note (pair, REG_LIBCALL, NULL_RTX);
+ XEXP (note, 0) = insn;
+ }
+ note = find_reg_note (insn, REG_LIBCALL, NULL_RTX);
+ if (note)
+ {
+ pair = XEXP (note, 0);
+ note = find_reg_note (pair, REG_RETVAL, NULL_RTX);
+ XEXP (note, 0) = insn;
+ }
+
delete_insn (del);
/* Now we must handle REG_EQUAL notes whose contents is equal to the mem;