This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
A patch for gcc.c-torture/execute/980505-1.c
- To: egcs-patches at cygnus dot com
- Subject: A patch for gcc.c-torture/execute/980505-1.c
- From: hjl at lucon dot org (H.J. Lu)
- Date: Wed, 10 Jun 1998 18:57:34 -0700 (PDT)
- Cc: law at cygnus dot com
Hi,
This patch seems to fix gcc.c-torture/execute/980505-1.c. But I
don't know if it is 100% correct.
--
H.J. Lu (hjl@gnu.org)
---
Wed Jun 10 18:53:50 1998 H.J. Lu (hjl@gnu.org)
* cse.c (delete_trivially_dead_insns): Update REG_NOTES when
delete a insn.
Index: cse.c
===================================================================
RCS file: /home/work/cvs/gnu/egcs/gcc/cse.c,v
retrieving revision 1.1.1.26
diff -u -p -r1.1.1.26 cse.c
--- cse.c 1998/06/09 14:37:37 1.1.1.26
+++ cse.c 1998/06/11 01:50:58
@@ -8893,6 +8894,36 @@ delete_trivially_dead_insns (insns, nreg
if (! live_insn)
{
+ rtx set = single_set (insn);
+ rtx dest;
+
+ if (set && (dest = SET_DEST (set), GET_CODE (dest) == REG))
+ {
+ rtx src = SET_SRC (set);
+ rtx next;
+ rtx *reg_map;
+ int nregs = REGNO (dest) + 1;
+
+ reg_map = (rtx *) alloca (nregs * sizeof (rtx));
+ memset (reg_map, 0, nregs * sizeof (rtx));
+ reg_map [REGNO (dest)] = src;
+
+ /* We start from here and go forward until we find it is
+ set. */
+ for (next = NEXT_INSN (insn); next;
+ next = NEXT_INSN (next))
+ {
+ if (GET_CODE (next) == INSN)
+ {
+ set = single_set (next);
+ if (set && rtx_equal_p (SET_DEST (set), dest))
+ break;
+
+ replace_regs (REG_NOTES (next), reg_map,
+ nregs, 0);
+ }
+ }
+ }
count_reg_usage (insn, counts, NULL_RTX, -1);
delete_insn (insn);
}