This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
A new patch for delete_trivially_dead_insns
- To: law at cygnus dot com
- Subject: A new patch for delete_trivially_dead_insns
- From: hjl at lucon dot org (H.J. Lu)
- Date: Thu, 11 Jun 1998 10:47:34 -0700 (PDT)
- Cc: egcs-patches at cygnus dot com
Hi,
Here is a new patch to fix gcc.c-torture/execute/980505-1.c.
--
H.J. Lu (hjl@gnu.org)
----
Thu Jun 11 07:21:07 1998 H.J. Lu (hjl@gnu.org)
* cse.c (delete_trivially_dead_insns): Update REG_NOTES when
deleting 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 16:46:50
@@ -8893,8 +8894,46 @@ delete_trivially_dead_insns (insns, nreg
if (! live_insn)
{
+ /* We should update REG_NOTES when deleting a insn. */
+ rtx set = single_set (insn);
+ rtx dest;
+ rtx src = NULL_RTX;
+ rtx next;
+
+ if (set)
+ {
+ dest = SET_DEST (set);
+ if (GET_CODE (dest) == REG)
+ {
+ src = SET_SRC (set);
+ if (!CONSTANT_P (src)
+ && GET_CODE (src) != REG
+ && GET_CODE (src) != SUBREG)
+ src = NULL_RTX;
+ }
+ }
+
count_reg_usage (insn, counts, NULL_RTX, -1);
- delete_insn (insn);
+ next = delete_insn (insn);
+
+ if (src)
+ {
+ /* We start from here and go forward until DEST is set. */
+ for (; next; next = NEXT_INSN (next))
+ {
+ if (REG_NOTES (next)
+ && (GET_CODE (next) == INSN
+ || GET_CODE (next) == JUMP_INSN
+ || GET_CODE (next) == CALL_INSN))
+ {
+ set = single_set (next);
+ if (set && rtx_equal_p (SET_DEST (set), dest))
+ break;
+
+ replace_rtx (REG_NOTES (next), dest, src);
+ }
+ }
+ }
}
if (find_reg_note (insn, REG_LIBCALL, NULL_RTX))