From dbdc7f9732197852984693602a4d13b9e3ccf54d Mon Sep 17 00:00:00 2001
From: Zdenek Dvorak <dvorakz@suse.cz>
Date: Thu, 26 Jul 2007 01:19:56 +0200
Subject: [PATCH] cfghooks.c (split_block): Fix the information about loop
 latch.

	* cfghooks.c (split_block): Fix the information about loop latch.

From-SVN: r126936
---
 gcc/ChangeLog  | 4 ++++
 gcc/cfghooks.c | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 24430b652e5c..5102f813873a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2007-07-25  Zdenek Dvorak  <dvorakz@suse.cz>
+
+	* cfghooks.c (split_block): Fix the information about loop latch.
+
 2007-07-25  Zdenek Dvorak  <dvorakz@suse.cz>
 
 	* cfgloopmanip.c (fix_loop_structure): Call force_single_succ_latches.
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index d436f011fac3..948300c028e1 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -432,7 +432,11 @@ split_block (basic_block bb, void *i)
     }
 
   if (current_loops != NULL)
-    add_bb_to_loop (new_bb, bb->loop_father);
+    {
+      add_bb_to_loop (new_bb, bb->loop_father);
+      if (bb->loop_father->latch == bb)
+	bb->loop_father->latch = new_bb;
+    }
 
   return make_single_succ_edge (bb, new_bb, EDGE_FALLTHRU);
 }
-- 
GitLab