From 237424b6b47d30f19deb6163779308d5da8637af Mon Sep 17 00:00:00 2001
From: rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri, 14 Apr 2000 17:38:35 +0000
Subject: [PATCH] 	* flow.c (find_auto_inc): Don't autoinc eliminable
 registers. 	If the original source is dead in the incr insn, it's dead
 now.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33150 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog |  5 +++++
 gcc/flow.c    | 10 +++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d068b59f3036..4465c292dfcd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2000-04-14  Richard Henderson  <rth@cygnus.com>
+
+	* flow.c (find_auto_inc): Don't autoinc eliminable registers.
+	If the original source is dead in the incr insn, it's dead now.
+
 Fri Apr 14 07:40:32 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
 	* stor-layout.c (layout_decl): Properly compare KNOWN_ALIGN to
diff --git a/gcc/flow.c b/gcc/flow.c
index a0b1266b032e..33a54ae18839 100644
--- a/gcc/flow.c
+++ b/gcc/flow.c
@@ -4309,7 +4309,10 @@ find_auto_inc (pbi, x, insn)
 				    ? (offset ? PRE_INC : POST_INC)
 				    : (offset ? PRE_DEC : POST_DEC));
 
-	  if (dead_or_set_p (incr, addr))
+	  if (dead_or_set_p (incr, addr)
+	      /* Mustn't autoinc an eliminable register.  */
+	      && (regno >= FIRST_PSEUDO_REGISTER
+	          || ! TEST_HARD_REG_BIT (elim_reg_set, regno)))
 	    {
 	      /* This is the simple case.  Try to make the auto-inc.  If
 		 we can't, we are done.  Otherwise, we will do any
@@ -4410,6 +4413,11 @@ find_auto_inc (pbi, x, insn)
 	     register.  */
 	  if (SET_DEST (set) == addr)
 	    {
+	      /* If the original source was dead, it's dead now.  */
+	      rtx note = find_reg_note (incr, REG_DEAD, NULL_RTX);
+	      if (note && XEXP (note, 0) != addr)
+		SET_REGNO_REG_SET (pbi->new_dead, REGNO (XEXP (note, 0)));
+	      
 	      PUT_CODE (incr, NOTE);
 	      NOTE_LINE_NUMBER (incr) = NOTE_INSN_DELETED;
 	      NOTE_SOURCE_FILE (incr) = 0;
-- 
GitLab