From ab74c5841e38e0a61067ed9c7416b11dc4159734 Mon Sep 17 00:00:00 2001
From: davem <davem@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Sat, 18 Dec 1999 18:30:41 +0000
Subject: [PATCH] 	* toplev.c (rest_of_compilation): Restore BLOCK tree 
 reconstruction and branch shortening changes lost in 	December 18th change.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31013 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog |  6 ++++++
 gcc/toplev.c  | 21 +++++++++++++++------
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 27ce71598627..8be52e9e335e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+1999-12-18  David S. Miller  <davem@redhat.com>
+
+	* toplev.c (rest_of_compilation): Restore BLOCK tree
+	reconstruction and branch shortening changes lost in
+	December 18th change.
+
 Sat Dec 18 05:29:29 1999  Scott Bambrough  <scottb@netwinder.org>
 
 	* config/arm/linux-elf.h: Change all instances of 
diff --git a/gcc/toplev.c b/gcc/toplev.c
index a3fbd02489c0..39354a56096e 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -2750,6 +2750,14 @@ rest_of_compilation (decl)
      collector to reclaim the memory used by the notes.  */
   remove_unncessary_notes ();
 
+  /* In function-at-a-time mode, we do not attempt to keep the BLOCK
+     tree in sensible shape.  So, we just recalculate it here.  */
+  if (current_function->x_whole_function_mode_p)
+    {
+      find_loop_tree_blocks ();
+      unroll_block_trees ();
+    }
+
   /* If we are reconsidering an inline function
      at the end of compilation, skip the stuff for making it inline.  */
 
@@ -3205,6 +3213,7 @@ rest_of_compilation (decl)
 	(flow_time,
 	 {
 	   find_basic_blocks (insns, max_reg_num (), rtl_dump_file, 1);
+	   calculate_loop_depth (rtl_dump_file);
 	   life_analysis (insns, max_reg_num (), rtl_dump_file, 1);
 	 });
 
@@ -3537,12 +3546,6 @@ rest_of_compilation (decl)
      ggc_collect ();
 #endif
 
-  /* Shorten branches.  */
-  TIMEVAR (shorten_branch_time,
-	   {
-	     shorten_branches (get_insns ());
-	   });
-
 #ifdef STACK_REGS
   if (stack_reg_dump)
     open_dump_file (".20.stack", decl_printable_name (decl, 2));
@@ -3560,6 +3563,12 @@ rest_of_compilation (decl)
      ggc_collect ();
 #endif
 
+  /* Shorten branches.  */
+  TIMEVAR (shorten_branch_time,
+	   {
+	     shorten_branches (get_insns ());
+	   });
+
   /* Now turn the rtl into assembler code.  */
 
   TIMEVAR (final_time,
-- 
GitLab