From 8bd0242383ea824b5fac9f10946fa5f40cbcf9f9 Mon Sep 17 00:00:00 2001
From: nickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Thu, 13 Jul 2006 07:55:25 +0000
Subject: [PATCH] * config/sh/sh.c (sh_reorg): Ignore deleted insns whilst
 walking the   LOG_LINKS chain.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@115412 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog      |  5 +++++
 gcc/config/sh/sh.c | 11 ++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9e907dd36476..dd490fa8a054 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2006-07-13  Nick Clifton  <nickc@redhat.com>
+
+	* config/sh/sh.c (sh_reorg): Ignore deleted insns whilst
+	walking the LOG_LINKS chain.
+  
 2006-07-12  Geoffrey Keating  <geoffk@apple.com>
 
 	* doc/invoke.texi (C++ Dialect Options): Explain difference
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 7e11e3f199d5..97d87416f1c8 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -4466,12 +4466,17 @@ sh_reorg (void)
 
 	  for (link = LOG_LINKS (insn); link; link = XEXP (link, 1))
 	    {
+	      rtx linked_insn;
+
 	      if (REG_NOTE_KIND (link) != 0)
 		continue;
-	      set = single_set (XEXP (link, 0));
-	      if (set && rtx_equal_p (reg, SET_DEST (set)))
+	      linked_insn = XEXP (link, 0);
+	      set = single_set (linked_insn);
+	      if (set
+		  && rtx_equal_p (reg, SET_DEST (set))
+		  && ! INSN_DELETED_P (linked_insn))
 		{
-		  link = XEXP (link, 0);
+		  link = linked_insn;
 		  break;
 		}
 	    }
-- 
GitLab