From 724880aebafbaf7c618ecfd66003f133f5d1a130 Mon Sep 17 00:00:00 2001
From: rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue, 6 Apr 1999 16:21:09 +0000
Subject: [PATCH] Jan Hubicka  <hubicka@paru.cas.cz>         * flow.c
 (split_edge) update correctly flow graph, disable         EDGE_CRITICAL flag
 on the split edge, update NUSES for new label.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26222 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog |  5 +++++
 gcc/flow.c    | 25 +++++++++++++++++--------
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 79d7c164ee8a..d3892b20f5cb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+Tue Apr  6 16:18:58 1999  Jan Hubicka  <hubicka@paru.cas.cz>
+
+	* flow.c (split_edge) update correctly flow graph, disable
+	EDGE_CRITICAL flag on the split edge, update NUSES for new label.
+
 Tue Apr  6 15:47:51 1999  Richard Henderson  <rth@cygnus.com>
 
 	* emit-rtl.c (gen_rtx_CONST_DOUBLE): Use XWINT not XINT.
diff --git a/gcc/flow.c b/gcc/flow.c
index 365f5fae550e..d2d1d5008250 100644
--- a/gcc/flow.c
+++ b/gcc/flow.c
@@ -1180,6 +1180,7 @@ split_edge (edge_in)
     for (pp = &old_succ->pred; *pp != edge_in; pp = &(*pp)->pred_next)
       continue;
     *pp = edge_in->pred_next;
+    edge_in->pred_next = NULL;
   }
 
   /* Create the new structures.  */
@@ -1207,9 +1208,18 @@ split_edge (edge_in)
   /* Wire them up.  */
   bb->pred = edge_in;
   bb->succ = edge_out;
+
   edge_in->dest = bb;
+  edge_in->flags &= ~EDGE_CRITICAL;
+
+  edge_out->pred_next = old_succ->pred;
+  edge_out->succ_next = NULL;
   edge_out->src = bb;
   edge_out->dest = old_succ;
+  edge_out->flags = EDGE_FALLTHRU;
+  edge_out->probability = REG_BR_PROB_BASE;
+
+  old_succ->pred = edge_out;
 
   /* Tricky case -- if there existed a fallthru into the successor
      (and we're not it) we must add a new unconditional jump around
@@ -1222,7 +1232,7 @@ split_edge (edge_in)
   if ((edge_in->flags & EDGE_FALLTHRU) == 0)
     {
       edge e;
-      for (e = old_succ->pred; e ; e = e->pred_next)
+      for (e = edge_out->pred_next; e ; e = e->pred_next)
 	if (e->flags & EDGE_FALLTHRU)
 	  break;
 
@@ -1236,7 +1246,6 @@ split_edge (edge_in)
 	      /* Non critical -- we can simply add a jump to the end
 		 of the existing predecessor.  */
 	      jump_block = e->src;
-	      pos = jump_block->end;
 	    }
 	  else
 	    {
@@ -1245,13 +1254,16 @@ split_edge (edge_in)
 	         call ourselves.  */
 	      jump_block = split_edge (e);
 	      e = jump_block->succ;
-	      pos = jump_block->head;
 	    }
 
-	  /* Now add the jump insn...  */
-	  pos = emit_jump_insn_after (gen_jump (old_succ->head), pos);
+	  /* Now add the jump insn ...  */
+	  pos = emit_jump_insn_after (gen_jump (old_succ->head),
+				      jump_block->end);
 	  jump_block->end = pos;
 	  emit_barrier_after (pos);
+
+	  /* ... let jump know that label is in use, ...  */
+	  ++LABEL_NUSES (old_succ->head);
 	  
 	  /* ... and clear fallthru on the outgoing edge.  */
 	  e->flags &= ~EDGE_FALLTHRU;
@@ -1331,9 +1343,6 @@ split_edge (edge_in)
       bb->head = new_label;
     }
 
-  /* In all cases, the new block falls through to the successor.  */
-  edge_out->flags = EDGE_FALLTHRU;
-
   return bb;
 }
 
-- 
GitLab