From 77f78a8f6fa5f3134da3941b5fce1e2c9a577bf5 Mon Sep 17 00:00:00 2001
From: kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Thu, 8 Nov 2001 23:40:15 +0000
Subject: [PATCH] 	* reload1.c (reload): Don't delete equiv insn if can
 throw.

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

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a718a8fadffe..82ec7f9a5792 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,7 @@
 Thu Nov  8 18:00:55 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
+	* reload1.c (reload): Don't delete equiv insn if can throw.
+
 	* expr.c (emit_block_move): If X is readonly emit CLOBBER for it.
 	(clear_storage): Likewise, for OBJECT.
 
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 165573bdf8d8..ffc80de8e6ab 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -1071,9 +1071,16 @@ reload (first, global)
 	  for (list = reg_equiv_init[i]; list; list = XEXP (list, 1))
 	    {
 	      rtx equiv_insn = XEXP (list, 0);
-	      if (GET_CODE (equiv_insn) == NOTE)
-		continue;
-	      if (reg_set_p (regno_reg_rtx[i], PATTERN (equiv_insn)))
+
+	      /* If we already deleted the insn or if it may trap, we can't
+		 delete it.  The latter case shouldn't happen, but can
+		 if an insn has a variable address, gets a REG_EH_REGION
+		 note added to it, and then gets converted into an load
+		 from a constant address.  */
+	      if (GET_CODE (equiv_insn) == NOTE
+		  || can_throw_internal (equiv_insn))
+		;
+	      else if (reg_set_p (regno_reg_rtx[i], PATTERN (equiv_insn)))
 		delete_dead_insn (equiv_insn);
 	      else
 		{
-- 
GitLab