From 6efe83b22e076ba8a2601ce0c31b8d4130d72704 Mon Sep 17 00:00:00 2001
From: Jeff Law <law@redhat.com>
Date: Fri, 15 Nov 2013 14:11:50 -0700
Subject: [PATCH] basic-block.h (has_abnormal_or_eh_outgoing_edge): Renamed
 from has_abnormal_or_outgoing_edge.

	* basic-block.h (has_abnormal_or_eh_outgoing_edge): Renamed from
	has_abnormal_or_outgoing_edge.  Check for EH edges as well.
	* gimple-ssa-isolate-paths.c
	(find_implicit_erroneous_behaviour): Corresponding changes.
	Do not check stmt_ends_bb_p or GIMPLE_RETURN anymore.
	(find_explicit_erroneous_behaviour): Likewise.

From-SVN: r204861
---
 gcc/ChangeLog                  |  9 +++++++++
 gcc/basic-block.h              |  4 ++--
 gcc/gimple-ssa-isolate-paths.c | 18 +++++-------------
 3 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d9e57b0c875a..3d528ba7e44f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2013-11-15  Jeff Law  <law@redhat.com>
+
+	* basic-block.h (has_abnormal_or_eh_outgoing_edge): Renamed from
+	has_abnormal_or_outgoing_edge.  Check for EH edges as well.
+	* gimple-ssa-isolate-paths.c
+	(find_implicit_erroneous_behaviour): Corresponding changes.
+	Do not check stmt_ends_bb_p or GIMPLE_RETURN anymore.
+	(find_explicit_erroneous_behaviour): Likewise.
+
 2013-11-15  Jeff Law  <law@redhat.com>
 
 	* ifcvt.c (find_cond_trap): Properly handle case where
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index b7e3b5042ff2..fd1681209fbb 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -1012,13 +1012,13 @@ inverse_probability (int prob1)
 /* Return true if BB has at least one abnormal outgoing edge.  */
 
 static inline bool
-has_abnormal_outgoing_edge_p (basic_block bb)
+has_abnormal_or_eh_outgoing_edge_p (basic_block bb)
 {
   edge e;
   edge_iterator ei;
 
   FOR_EACH_EDGE (e, ei, bb->succs)
-    if (e->flags & EDGE_ABNORMAL)
+    if (e->flags & (EDGE_ABNORMAL | EDGE_EH))
       return true;
 
   return false;
diff --git a/gcc/gimple-ssa-isolate-paths.c b/gcc/gimple-ssa-isolate-paths.c
index 66c13f4cf6fd..c42f112da8b3 100644
--- a/gcc/gimple-ssa-isolate-paths.c
+++ b/gcc/gimple-ssa-isolate-paths.c
@@ -224,7 +224,7 @@ find_implicit_erroneous_behaviour (void)
 	 the trap we insert.  We have to preserve abnormal edges out
 	 of the isolated block which in turn means updating PHIs at
 	 the targets of those abnormal outgoing edges.  */
-      if (has_abnormal_outgoing_edge_p (bb))
+      if (has_abnormal_or_eh_outgoing_edge_p (bb))
 	continue;
 
       /* First look for a PHI which sets a pointer to NULL and which
@@ -268,15 +268,8 @@ find_implicit_erroneous_behaviour (void)
 	        {
 	          /* We only care about uses in BB.  Catching cases in
 		     in other blocks would require more complex path
-		     isolation code. 
-
-		     If the statement must end a block and is not a
-		     GIMPLE_RETURN, then additional work would be
-		     necessary to isolate the path.  Just punt it for
-		     now.  */
-		  if (gimple_bb (use_stmt) != bb
-		      || (stmt_ends_bb_p (use_stmt)
-			  && gimple_code (use_stmt) != GIMPLE_RETURN))
+		     isolation code.   */
+		  if (gimple_bb (use_stmt) != bb)
 		    continue;
 
 		  if (infer_nonnull_range (use_stmt, lhs))
@@ -316,7 +309,7 @@ find_explicit_erroneous_behaviour (void)
 	 the trap we insert.  We have to preserve abnormal edges out
 	 of the isolated block which in turn means updating PHIs at
 	 the targets of those abnormal outgoing edges.  */
-      if (has_abnormal_outgoing_edge_p (bb))
+      if (has_abnormal_or_eh_outgoing_edge_p (bb))
 	continue;
 
       /* Now look at the statements in the block and see if any of
@@ -329,8 +322,7 @@ find_explicit_erroneous_behaviour (void)
 	  /* By passing null_pointer_node, we can use infer_nonnull_range
 	     to detect explicit NULL pointer dereferences and other uses
 	     where a non-NULL value is required.  */
-	  if ((!stmt_ends_bb_p (stmt) || gimple_code (stmt) == GIMPLE_RETURN)
-	      && infer_nonnull_range (stmt, null_pointer_node))
+	  if (infer_nonnull_range (stmt, null_pointer_node))
 	    {
 	      insert_trap_and_remove_trailing_statements (&si,
 							  null_pointer_node);
-- 
GitLab