Commit 35b6b437 by Richard Sandiford Committed by Richard Sandiford

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
parent fa0a2ae5
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> 2004-07-25 David Edelsohn <edelsohn@gnu.org>
* config/rs6000/rs6000.md (movdi_internal64): Further disparage * config/rs6000/rs6000.md (movdi_internal64): Further disparage
......
...@@ -676,7 +676,7 @@ extern bool inside_basic_block_p (rtx); ...@@ -676,7 +676,7 @@ extern bool inside_basic_block_p (rtx);
extern bool control_flow_insn_p (rtx); extern bool control_flow_insn_p (rtx);
/* In bb-reorder.c */ /* 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); extern void partition_hot_cold_basic_blocks (void);
/* In cfg.c */ /* In cfg.c */
......
...@@ -1908,10 +1908,11 @@ fix_edges_for_rarely_executed_code (edge *crossing_edges, ...@@ -1908,10 +1908,11 @@ fix_edges_for_rarely_executed_code (edge *crossing_edges,
add_reg_crossing_jump_notes (); 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 void
reorder_basic_blocks (void) reorder_basic_blocks (unsigned int flags)
{ {
int n_traces; int n_traces;
int i; int i;
...@@ -1925,7 +1926,7 @@ reorder_basic_blocks (void) ...@@ -1925,7 +1926,7 @@ reorder_basic_blocks (void)
timevar_push (TV_REORDER_BLOCKS); timevar_push (TV_REORDER_BLOCKS);
cfg_layout_initialize (); cfg_layout_initialize (flags);
set_edge_can_fallthru_flag (); set_edge_can_fallthru_flag ();
mark_dfs_back_edges (); mark_dfs_back_edges ();
...@@ -1999,7 +2000,7 @@ partition_hot_cold_basic_blocks (void) ...@@ -1999,7 +2000,7 @@ partition_hot_cold_basic_blocks (void)
crossing_edges = xcalloc (max_edges, sizeof (edge)); crossing_edges = xcalloc (max_edges, sizeof (edge));
cfg_layout_initialize (); cfg_layout_initialize (0);
FOR_EACH_BB (cur_bb) FOR_EACH_BB (cur_bb)
if (cur_bb->index >= 0 if (cur_bb->index >= 0
......
...@@ -1133,11 +1133,15 @@ cfg_layout_duplicate_bb (basic_block bb) ...@@ -1133,11 +1133,15 @@ cfg_layout_duplicate_bb (basic_block bb)
return new_bb; return new_bb;
} }
/* Main entry point to this module - initialize the data structures for /* Main entry point to this module - initialize the datastructures for
CFG layout changes. It keeps LOOPS up-to-date if not null. */ 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 void
cfg_layout_initialize (void) cfg_layout_initialize (unsigned int flags)
{ {
basic_block bb; basic_block bb;
...@@ -1152,7 +1156,7 @@ cfg_layout_initialize (void) ...@@ -1152,7 +1156,7 @@ cfg_layout_initialize (void)
record_effective_endpoints (); record_effective_endpoints ();
cleanup_cfg (CLEANUP_CFGLAYOUT); cleanup_cfg (CLEANUP_CFGLAYOUT | flags);
} }
/* Splits superblocks. */ /* Splits superblocks. */
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
extern rtx cfg_layout_function_footer; 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 cfg_layout_finalize (void);
extern void insn_locators_initialize (void); extern void insn_locators_initialize (void);
extern void reemit_insn_block_notes (void); extern void reemit_insn_block_notes (void);
......
...@@ -5213,7 +5213,7 @@ thread_prologue_and_epilogue_insns (rtx f ATTRIBUTE_UNUSED) ...@@ -5213,7 +5213,7 @@ thread_prologue_and_epilogue_insns (rtx f ATTRIBUTE_UNUSED)
use return. Inserting a jump 'by hand' is extremely messy, so use return. Inserting a jump 'by hand' is extremely messy, so
we take advantage of cfg_layout_finalize using we take advantage of cfg_layout_finalize using
fixup_fallthru_exit_predecessor. */ fixup_fallthru_exit_predecessor. */
cfg_layout_initialize (); cfg_layout_initialize (0);
FOR_EACH_BB (cur_bb) FOR_EACH_BB (cur_bb)
if (cur_bb->index >= 0 && cur_bb->next_bb->index >= 0) if (cur_bb->index >= 0 && cur_bb->next_bb->index >= 0)
cur_bb->rbi->next = cur_bb->next_bb; cur_bb->rbi->next = cur_bb->next_bb;
......
...@@ -549,7 +549,7 @@ rest_of_handle_stack_regs (void) ...@@ -549,7 +549,7 @@ rest_of_handle_stack_regs (void)
| (flag_crossjumping ? CLEANUP_CROSSJUMP : 0)) | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0))
&& (flag_reorder_blocks || flag_reorder_blocks_and_partition)) && (flag_reorder_blocks || flag_reorder_blocks_and_partition))
{ {
reorder_basic_blocks (); reorder_basic_blocks (0);
cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK); cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK);
} }
} }
...@@ -734,23 +734,22 @@ static void ...@@ -734,23 +734,22 @@ static void
rest_of_handle_reorder_blocks (void) rest_of_handle_reorder_blocks (void)
{ {
bool changed; bool changed;
unsigned int liveness_flags;
open_dump_file (DFI_bbro, current_function_decl); open_dump_file (DFI_bbro, current_function_decl);
/* Last attempt to optimize CFG, as scheduling, peepholing and insn /* Last attempt to optimize CFG, as scheduling, peepholing and insn
splitting possibly introduced more crossjumping opportunities. */ splitting possibly introduced more crossjumping opportunities. */
changed = cleanup_cfg (CLEANUP_EXPENSIVE liveness_flags = (!HAVE_conditional_execution ? CLEANUP_UPDATE_LIFE : 0);
| (!HAVE_conditional_execution changed = cleanup_cfg (CLEANUP_EXPENSIVE | liveness_flags);
? CLEANUP_UPDATE_LIFE : 0));
if (flag_sched2_use_traces && flag_schedule_insns_after_reload) if (flag_sched2_use_traces && flag_schedule_insns_after_reload)
tracer (); tracer (liveness_flags);
if (flag_reorder_blocks || flag_reorder_blocks_and_partition) 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 if (flag_reorder_blocks || flag_reorder_blocks_and_partition
|| (flag_sched2_use_traces && flag_schedule_insns_after_reload)) || (flag_sched2_use_traces && flag_schedule_insns_after_reload))
changed |= cleanup_cfg (CLEANUP_EXPENSIVE changed |= cleanup_cfg (CLEANUP_EXPENSIVE | liveness_flags);
| (!HAVE_conditional_execution
? CLEANUP_UPDATE_LIFE : 0));
/* On conditional execution targets we can not update the life cheaply, so /* 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 we deffer the updating to after both cleanups. This may lose some cases
...@@ -897,7 +896,7 @@ rest_of_handle_tracer (void) ...@@ -897,7 +896,7 @@ rest_of_handle_tracer (void)
open_dump_file (DFI_tracer, current_function_decl); open_dump_file (DFI_tracer, current_function_decl);
if (dump_file) if (dump_file)
dump_flow_info (dump_file); dump_flow_info (dump_file);
tracer (); tracer (0);
cleanup_cfg (CLEANUP_EXPENSIVE); cleanup_cfg (CLEANUP_EXPENSIVE);
reg_scan (get_insns (), max_reg_num (), 0); reg_scan (get_insns (), max_reg_num (), 0);
close_dump_file (DFI_tracer, print_rtl_with_bb, get_insns ()); close_dump_file (DFI_tracer, print_rtl_with_bb, get_insns ());
...@@ -1353,7 +1352,7 @@ rest_of_handle_loop2 (void) ...@@ -1353,7 +1352,7 @@ rest_of_handle_loop2 (void)
dump_flow_info (dump_file); dump_flow_info (dump_file);
/* Initialize structures for layout changes. */ /* Initialize structures for layout changes. */
cfg_layout_initialize (); cfg_layout_initialize (0);
loops = loop_optimizer_init (dump_file); loops = loop_optimizer_init (dump_file);
......
...@@ -2432,7 +2432,7 @@ extern void if_convert (int); ...@@ -2432,7 +2432,7 @@ extern void if_convert (int);
extern void invert_br_probabilities (rtx); extern void invert_br_probabilities (rtx);
extern bool expensive_function_p (int); extern bool expensive_function_p (int);
/* In tracer.c */ /* In tracer.c */
extern void tracer (void); extern void tracer (unsigned int);
/* In var-tracking.c */ /* In var-tracking.c */
extern void variable_tracking_main (void); extern void variable_tracking_main (void);
......
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> 2004-07-26 Niall Douglas <s_fsfeurope2@nedprod.com>
Brian Ryner <bryner@brianryner.com> Brian Ryner <bryner@brianryner.com>
......
/* 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;
}
...@@ -354,17 +354,18 @@ layout_superblocks (void) ...@@ -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 void
tracer (void) tracer (unsigned int flags)
{ {
if (n_basic_blocks <= 1) if (n_basic_blocks <= 1)
return; return;
timevar_push (TV_TRACER); timevar_push (TV_TRACER);
cfg_layout_initialize (); cfg_layout_initialize (flags);
mark_dfs_back_edges (); mark_dfs_back_edges ();
if (dump_file) if (dump_file)
dump_flow_info (dump_file); dump_flow_info (dump_file);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment