re PR rtl-optimization/16643 (verify_local_live_at_start ICE after crossjumping ...
authorRichard Sandiford <rsandifo@redhat.com>
Mon, 26 Jul 2004 14:34:19 +0000 (14:34 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Mon, 26 Jul 2004 14:34:19 +0000 (14:34 +0000)
PR rtl-optimization/16643
* cfglayout.h (cfg_layout_initialize): Add a flags parameter.
* cfglayout.c (cfg_layout_initialize): Pass it to cleanup_cfg.
* basic-block.h (reorder_basic_blocks): Add a flags parameter.
* cfglayout.c (reorder_basic_blocks): Pass it to cfg_layout_initialize.
(partition_hot_cold_basic_blocks): Pass 0 to cfg_layout_initialize.
* function.c (thread_prologue_and_epilogue_insns): Likewise.
* rtl.h (tracer): Add a flags parameter.
* tracer.c (tracer): Pass it to cfg_layout_initialise.
* passes.c (rest_of_handle_stack_regs): Pass 0 to reorder_basic_blocks.
(rest_of_handle_reorder_blocks): Update calls to tracer and
reorder_basic_blocks, passing CLEANUP_UPDATE_LIFE if appropriate.
(rest_of_handle_tracer): Pass 0 to tracer.
(rest_of_handle_loop2): Pass 0 to cfg_layout_initialize.

From-SVN: r85191

gcc/ChangeLog
gcc/basic-block.h
gcc/bb-reorder.c
gcc/cfglayout.c
gcc/cfglayout.h
gcc/function.c
gcc/passes.c
gcc/rtl.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20040726-1.c [new file with mode: 0644]
gcc/tracer.c

index bf54285..87eb275 100644 (file)
@@ -1,3 +1,20 @@
+2004-07-26  Richard Sandiford  <rsandifo@redhat.com>
+
+       PR rtl-optimization/16643
+       * cfglayout.h (cfg_layout_initialize): Add a flags parameter.
+       * cfglayout.c (cfg_layout_initialize): Pass it to cleanup_cfg.
+       * basic-block.h (reorder_basic_blocks): Add a flags parameter.
+       * cfglayout.c (reorder_basic_blocks): Pass it to cfg_layout_initialize.
+       (partition_hot_cold_basic_blocks): Pass 0 to cfg_layout_initialize.
+       * function.c (thread_prologue_and_epilogue_insns): Likewise.
+       * rtl.h (tracer): Add a flags parameter.
+       * tracer.c (tracer): Pass it to cfg_layout_initialise.
+       * passes.c (rest_of_handle_stack_regs): Pass 0 to reorder_basic_blocks.
+       (rest_of_handle_reorder_blocks): Update calls to tracer and
+       reorder_basic_blocks, passing CLEANUP_UPDATE_LIFE if appropriate.
+       (rest_of_handle_tracer): Pass 0 to tracer.
+       (rest_of_handle_loop2): Pass 0 to cfg_layout_initialize.
+
 2004-07-25  David Edelsohn  <edelsohn@gnu.org>
 
        * config/rs6000/rs6000.md (movdi_internal64): Further disparage
index bb334fd..c42a66d 100644 (file)
@@ -676,7 +676,7 @@ extern bool inside_basic_block_p (rtx);
 extern bool control_flow_insn_p (rtx);
 
 /* In bb-reorder.c */
-extern void reorder_basic_blocks (void);
+extern void reorder_basic_blocks (unsigned int);
 extern void partition_hot_cold_basic_blocks (void);
 
 /* In cfg.c */
index c739eb6..90c1454 100644 (file)
@@ -1908,10 +1908,11 @@ fix_edges_for_rarely_executed_code (edge *crossing_edges,
   add_reg_crossing_jump_notes ();
 }
 
-/* Reorder basic blocks.  The main entry point to this file.  */
+/* Reorder basic blocks.  The main entry point to this file.  FLAGS is
+   the set of flags to pass to cfg_layout_initialize().  */
 
 void
-reorder_basic_blocks (void)
+reorder_basic_blocks (unsigned int flags)
 {
   int n_traces;
   int i;
@@ -1925,7 +1926,7 @@ reorder_basic_blocks (void)
 
   timevar_push (TV_REORDER_BLOCKS);
 
-  cfg_layout_initialize ();
+  cfg_layout_initialize (flags);
 
   set_edge_can_fallthru_flag ();
   mark_dfs_back_edges ();
@@ -1999,7 +2000,7 @@ partition_hot_cold_basic_blocks (void)
   
   crossing_edges = xcalloc (max_edges, sizeof (edge));
 
-  cfg_layout_initialize ();
+  cfg_layout_initialize (0);
   
   FOR_EACH_BB (cur_bb)
     if (cur_bb->index >= 0
index 457305c..a81ce4c 100644 (file)
@@ -1133,11 +1133,15 @@ cfg_layout_duplicate_bb (basic_block bb)
   return new_bb;
 }
 \f
-/* Main entry point to this module - initialize the data structures for
-   CFG layout changes.  It keeps LOOPS up-to-date if not null.  */
+/* Main entry point to this module - initialize the datastructures for
+   CFG layout changes.  It keeps LOOPS up-to-date if not null.
+
+   FLAGS is a set of additional flags to pass to cleanup_cfg().  It should
+   include CLEANUP_UPDATE_LIFE if liveness information must be kept up
+   to date.  */
 
 void
-cfg_layout_initialize (void)
+cfg_layout_initialize (unsigned int flags)
 {
   basic_block bb;
 
@@ -1152,7 +1156,7 @@ cfg_layout_initialize (void)
 
   record_effective_endpoints ();
 
-  cleanup_cfg (CLEANUP_CFGLAYOUT);
+  cleanup_cfg (CLEANUP_CFGLAYOUT | flags);
 }
 
 /* Splits superblocks.  */
index 4216fbb..444e76a 100644 (file)
@@ -25,7 +25,7 @@
 
 extern rtx cfg_layout_function_footer;
 
-extern void cfg_layout_initialize (void);
+extern void cfg_layout_initialize (unsigned int);
 extern void cfg_layout_finalize (void);
 extern void insn_locators_initialize (void);
 extern void reemit_insn_block_notes (void);
index a55b023..20c5c5c 100644 (file)
@@ -5213,7 +5213,7 @@ thread_prologue_and_epilogue_insns (rtx f ATTRIBUTE_UNUSED)
          use return.  Inserting a jump 'by hand' is extremely messy, so
         we take advantage of cfg_layout_finalize using
        fixup_fallthru_exit_predecessor.  */
-      cfg_layout_initialize ();
+      cfg_layout_initialize (0);
       FOR_EACH_BB (cur_bb)
        if (cur_bb->index >= 0 && cur_bb->next_bb->index >= 0)
          cur_bb->rbi->next = cur_bb->next_bb;
index b124b3e..c290ff3 100644 (file)
@@ -549,7 +549,7 @@ rest_of_handle_stack_regs (void)
                       | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0))
          && (flag_reorder_blocks || flag_reorder_blocks_and_partition))
        {
-         reorder_basic_blocks ();
+         reorder_basic_blocks (0);
          cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK);
        }
     }
@@ -734,23 +734,22 @@ static void
 rest_of_handle_reorder_blocks (void)
 {
   bool changed;
+  unsigned int liveness_flags;
+
   open_dump_file (DFI_bbro, current_function_decl);
 
   /* Last attempt to optimize CFG, as scheduling, peepholing and insn
      splitting possibly introduced more crossjumping opportunities.  */
-  changed = cleanup_cfg (CLEANUP_EXPENSIVE
-                        | (!HAVE_conditional_execution
-                           ? CLEANUP_UPDATE_LIFE : 0));
+  liveness_flags = (!HAVE_conditional_execution ? CLEANUP_UPDATE_LIFE : 0);
+  changed = cleanup_cfg (CLEANUP_EXPENSIVE | liveness_flags);
 
   if (flag_sched2_use_traces && flag_schedule_insns_after_reload)
-    tracer ();
+    tracer (liveness_flags);
   if (flag_reorder_blocks || flag_reorder_blocks_and_partition)
-    reorder_basic_blocks ();
+    reorder_basic_blocks (liveness_flags);
   if (flag_reorder_blocks || flag_reorder_blocks_and_partition
       || (flag_sched2_use_traces && flag_schedule_insns_after_reload))
-    changed |= cleanup_cfg (CLEANUP_EXPENSIVE
-                           | (!HAVE_conditional_execution
-                              ? CLEANUP_UPDATE_LIFE : 0));
+    changed |= cleanup_cfg (CLEANUP_EXPENSIVE | liveness_flags);
 
   /* On conditional execution targets we can not update the life cheaply, so
      we deffer the updating to after both cleanups.  This may lose some cases
@@ -897,7 +896,7 @@ rest_of_handle_tracer (void)
   open_dump_file (DFI_tracer, current_function_decl);
   if (dump_file)
     dump_flow_info (dump_file);
-  tracer ();
+  tracer (0);
   cleanup_cfg (CLEANUP_EXPENSIVE);
   reg_scan (get_insns (), max_reg_num (), 0);
   close_dump_file (DFI_tracer, print_rtl_with_bb, get_insns ());
@@ -1353,7 +1352,7 @@ rest_of_handle_loop2 (void)
     dump_flow_info (dump_file);
 
   /* Initialize structures for layout changes.  */
-  cfg_layout_initialize ();
+  cfg_layout_initialize (0);
 
   loops = loop_optimizer_init (dump_file);
 
index 3fd8baf..2d3390a 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2432,7 +2432,7 @@ extern void if_convert (int);
 extern void invert_br_probabilities (rtx);
 extern bool expensive_function_p (int);
 /* In tracer.c */
-extern void tracer (void);
+extern void tracer (unsigned int);
 
 /* In var-tracking.c */
 extern void variable_tracking_main (void);
index e3a38be..27ba1fc 100644 (file)
@@ -1,3 +1,7 @@
+2004-07-26  Richard Sandiford  <rsandifo@redhat.com>
+
+       * gcc.c-torture/compile/20040726-1.c: New test.
+
 2004-07-26  Niall Douglas  <s_fsfeurope2@nedprod.com>
            Brian Ryner  <bryner@brianryner.com>
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040726-1.c b/gcc/testsuite/gcc.c-torture/compile/20040726-1.c
new file mode 100644 (file)
index 0000000..e53ccd6
--- /dev/null
@@ -0,0 +1,14 @@
+/* PR rtl-optimization/16643 */
+void foo (int a, int b, int c, int d, int e, int *f)
+{
+  if (a == 0)
+    if (b == 0)
+      if (c == 0)
+       if (d == 0)
+         {
+           *f = e;
+           return;
+         }
+  *f = e;
+  return;
+}
index 9635737..dd263c4 100644 (file)
@@ -354,17 +354,18 @@ layout_superblocks (void)
     }
 }
 
-/* Main entry point to this file.  */
+/* Main entry point to this file.  FLAGS is the set of flags to pass
+   to cfg_layout_initialize().  */
 
 void
-tracer (void)
+tracer (unsigned int flags)
 {
   if (n_basic_blocks <= 1)
     return;
 
   timevar_push (TV_TRACER);
 
-  cfg_layout_initialize ();
+  cfg_layout_initialize (flags);
   mark_dfs_back_edges ();
   if (dump_file)
     dump_flow_info (dump_file);