From: Richard Sandiford Date: Mon, 26 Jul 2004 14:34:19 +0000 (+0000) Subject: re PR rtl-optimization/16643 (verify_local_live_at_start ICE after crossjumping ... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=35b6b437aa03e95ab2eb6fa5acaf25e07a9b1433;p=gcc.git re PR rtl-optimization/16643 (verify_local_live_at_start ICE after crossjumping & cfgcleanup) 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bf542855705..87eb2754359 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,20 @@ +2004-07-26 Richard Sandiford + + 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 * config/rs6000/rs6000.md (movdi_internal64): Further disparage diff --git a/gcc/basic-block.h b/gcc/basic-block.h index bb334fd2add..c42a66d6f0a 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -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 */ diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c index c739eb6b546..90c14547aa6 100644 --- a/gcc/bb-reorder.c +++ b/gcc/bb-reorder.c @@ -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 diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c index 457305c1087..a81ce4c7f8c 100644 --- a/gcc/cfglayout.c +++ b/gcc/cfglayout.c @@ -1133,11 +1133,15 @@ cfg_layout_duplicate_bb (basic_block bb) return new_bb; } -/* 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. */ diff --git a/gcc/cfglayout.h b/gcc/cfglayout.h index 4216fbbf54a..444e76a9e1e 100644 --- a/gcc/cfglayout.h +++ b/gcc/cfglayout.h @@ -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); diff --git a/gcc/function.c b/gcc/function.c index a55b023887b..20c5c5c3fb6 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -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; diff --git a/gcc/passes.c b/gcc/passes.c index b124b3eafcd..c290ff30d4e 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -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); diff --git a/gcc/rtl.h b/gcc/rtl.h index 3fd8bafecba..2d3390a6d17 100644 --- 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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e3a38beca46..27ba1fcc31b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-07-26 Richard Sandiford + + * gcc.c-torture/compile/20040726-1.c: New test. + 2004-07-26 Niall Douglas Brian Ryner 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 index 00000000000..e53ccd655bb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040726-1.c @@ -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; +} diff --git a/gcc/tracer.c b/gcc/tracer.c index 9635737ff53..dd263c4fdfd 100644 --- a/gcc/tracer.c +++ b/gcc/tracer.c @@ -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);