From c8c3cb28fa6b56640e6ec8ce6feaf30e7c848cb5 Mon Sep 17 00:00:00 2001
From: Eric Botcazou <ebotcazou@adacore.com>
Date: Mon, 2 Jan 2006 22:47:50 +0000
Subject: [PATCH] cfglayout.c (fixup_reorder_chain): Remove kludge for the case
 of conditional jump jumping to the next instruction.

	* cfglayout.c (fixup_reorder_chain): Remove kludge for the
	case of conditional jump jumping to the next instruction.
	* cfgrtl.c (force_nonfallthru_and_redirect): Accept all
	cases of conditional jump jumping to the next instruction.


Co-Authored-By: Jan Hubicka <jh@suse.cz>

From-SVN: r109247
---
 gcc/ChangeLog   |  8 ++++++++
 gcc/cfglayout.c | 40 ++++++----------------------------------
 gcc/cfgrtl.c    |  3 ---
 3 files changed, 14 insertions(+), 37 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 28340961b8f7..0423185b2207 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2006-01-02  Eric Botcazou  <ebotcazou@adacore.com>
+            Jan Hubicka  <jh@suse.cz>
+
+	* cfglayout.c (fixup_reorder_chain): Remove kludge for the
+	case of conditional jump jumping to the next instruction.
+	* cfgrtl.c (force_nonfallthru_and_redirect): Accept all
+	cases of conditional jump jumping to the next instruction.
+
 2006-01-02  Jan Hubicka  <jh@suse.cz>
 
 	* i386.c (*_cost): Add COSTS_N_INSNS.
diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c
index d2580b4e19ff..5880819a9182 100644
--- a/gcc/cfglayout.c
+++ b/gcc/cfglayout.c
@@ -680,41 +680,13 @@ fixup_reorder_chain (void)
 		continue;
 
 	      /* The degenerated case of conditional jump jumping to the next
-		 instruction can happen on target having jumps with side
-		 effects.
-
-		 Create temporarily the duplicated edge representing branch.
-		 It will get unidentified by force_nonfallthru_and_redirect
-		 that would otherwise get confused by fallthru edge not pointing
-		 to the next basic block.  */
+		 instruction can happen for jumps with side effects.  We need
+		 to construct a forwarder block and this will be done just
+		 fine by force_nonfallthru below.  */
 	      if (!e_taken)
-		{
-		  rtx note;
-		  edge e_fake;
-		  bool redirected;
-
-		  e_fake = unchecked_make_edge (bb, e_fall->dest, 0);
-
-		  redirected = redirect_jump (BB_END (bb),
-					      block_label (bb), 0);
-		  gcc_assert (redirected);
-		  
-		  note = find_reg_note (BB_END (bb), REG_BR_PROB, NULL_RTX);
-		  if (note)
-		    {
-		      int prob = INTVAL (XEXP (note, 0));
-
-		      e_fake->probability = prob;
-		      e_fake->count = e_fall->count * prob / REG_BR_PROB_BASE;
-		      e_fall->probability -= e_fall->probability;
-		      e_fall->count -= e_fake->count;
-		      if (e_fall->probability < 0)
-			e_fall->probability = 0;
-		      if (e_fall->count < 0)
-			e_fall->count = 0;
-		    }
-		}
-	      /* There is one special case: if *neither* block is next,
+		;
+
+	      /* There is another special case: if *neither* block is next,
 		 such as happens at the very end of a function, then we'll
 		 need to add a new unconditional jump.  Choose the taken
 		 edge based on known or assumed probability.  */
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index fcf359070b71..6ff6c3911931 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -1014,9 +1014,6 @@ force_nonfallthru_and_redirect (edge e, basic_block target)
      by creating a basic block afterwards to redirect fallthru edge.  */
   if (e->src != ENTRY_BLOCK_PTR && e->dest != EXIT_BLOCK_PTR
       && any_condjump_p (BB_END (e->src))
-      /* When called from cfglayout, fallthru edges do not
-         necessarily go to the next block.  */
-      && e->src->next_bb == e->dest
       && JUMP_LABEL (BB_END (e->src)) == BB_HEAD (e->dest))
     {
       rtx note;
-- 
GitLab