[PATCH] Add checking that during RTL bbs don't mix EH and non-complex predecessor edges

Jakub Jelinek jakub@redhat.com
Wed Jun 20 14:12:00 GMT 2018


On Sat, Jun 16, 2018 at 02:13:32PM +0200, Eric Botcazou wrote:
> > Now committed after successful bootstrap/regtest on x86_64-linux and
> > i686-linux.  Is the cfgrtl.c change ok for trunk too?
> > http://gcc.gnu.org/ml/gcc-patches/2018-06/msg00967.html
> 
> Don't we actually need to verify that all incoming edges are EH or none is?

This also passes bootstrap/regtest for me (dwarf exceptions only though).
So is this ok for trunk instead?

2018-06-20  Jakub Jelinek  <jakub@redhat.com>

	* cfgrtl.c (rtl_verify_edges): Formatting fix.  If bb->preds has any
	EDGE_EH edges, verify they are all EDGE_EH.

--- gcc/cfgrtl.c.jj	2018-06-15 21:23:02.513600038 +0200
+++ gcc/cfgrtl.c	2018-06-20 12:57:12.079755604 +0200
@@ -2540,15 +2540,15 @@ rtl_verify_edges (void)
 	    n_abnormal++;
 	}
 
-        if (!has_crossing_edge
-	    && JUMP_P (BB_END (bb))
-	    && CROSSING_JUMP_P (BB_END (bb)))
-          {
-	    print_rtl_with_bb (stderr, get_insns (), TDF_BLOCKS | TDF_DETAILS);
-            error ("Region crossing jump across same section in bb %i",
-                   bb->index);
-            err = 1;
-          }
+      if (!has_crossing_edge
+	  && JUMP_P (BB_END (bb))
+	  && CROSSING_JUMP_P (BB_END (bb)))
+	{
+	  print_rtl_with_bb (stderr, get_insns (), TDF_BLOCKS | TDF_DETAILS);
+	  error ("Region crossing jump across same section in bb %i",
+		 bb->index);
+	  err = 1;
+	}
 
       if (n_eh && !find_reg_note (BB_END (bb), REG_EH_REGION, NULL_RTX))
 	{
@@ -2606,6 +2606,19 @@ rtl_verify_edges (void)
 	  error ("abnormal edges for no purpose in bb %i", bb->index);
 	  err = 1;
 	}
+
+      int has_eh = -1;
+      FOR_EACH_EDGE (e, ei, bb->preds)
+	{
+	  if (has_eh == -1)
+	    has_eh = (e->flags & EDGE_EH);
+	  if ((e->flags & EDGE_EH) == has_eh)
+	    continue;
+	  error ("EH incoming edge mixed with non-EH incoming edges "
+		 "in bb %i", bb->index);
+	  err = 1;
+	  break;
+	}
     }
 
   /* If there are partitions, do a sanity check on them: A basic block in


	Jakub



More information about the Gcc-patches mailing list