From 9477eb38c651080b94d228554d56fadf946949c1 Mon Sep 17 00:00:00 2001
From: Jan Hubicka <jh@suse.cz>
Date: Fri, 5 Jan 2007 13:18:21 +0100
Subject: [PATCH] tree-inline.c (fold_marked_statements): Update operand caches
 and EH after folding

	* tree-inline.c (fold_marked_statements): Update operand caches
	and EH after folding

From-SVN: r120477
---
 gcc/ChangeLog     |  5 +++++
 gcc/tree-inline.c | 10 +++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5bcf02a4defa..4557a6fefb99 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2007-01-04  Jan Hubicka  <jh@suse.cz>
+
+	* tree-inline.c (fold_marked_statements): Update operand caches
+	and EH after folding
+
 2007-01-04  Ian Lance Taylor  <iant@google.com>
 
 	* c-common.c (check_function_nonnull): Whitespace fix.
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index bcfdd91b421d..b3fc03fda7b1 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -2597,7 +2597,15 @@ fold_marked_statements (int first, struct pointer_set_t *statements)
 	for (bsi = bsi_start (BASIC_BLOCK (first));
 	     !bsi_end_p (bsi); bsi_next (&bsi))
 	  if (pointer_set_contains (statements, bsi_stmt (bsi)))
-	    fold_stmt (bsi_stmt_ptr (bsi));
+	    {
+	      tree old_stmt = bsi_stmt (bsi);
+	      if (fold_stmt (bsi_stmt_ptr (bsi)))
+		{
+		  update_stmt (bsi_stmt (bsi));
+		  if (maybe_clean_or_replace_eh_stmt (old_stmt, bsi_stmt (bsi)))
+		     tree_purge_dead_eh_edges (BASIC_BLOCK (first));
+		}
+	    }
       }
 }
 
-- 
GitLab