Commit 1994bfea by Jan Hubicka Committed by Jan Hubicka

tree-vrp.c (finalize_jump_threads): Do not call cleanup_cfg by hand.

	* tree-vrp.c (finalize_jump_threads): Do not call cleanup_cfg by hand.
	* tree-tailcall (add_virtual_phis): Likewise.
	(optimize_tail_call): Return TODOs.
	(execute_tail_calls): Return TODOs.
	* tree-ssa-ccp (execute_fold_all_builtins): Do cleanup_cfg via TODO.
	* tree-cfgcleanup.c (cleanup_tree_cfg_loop): Return if something
	changed.
	* tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_value):
	Cleanup cfg using TODO.
	* tree-flow.h (cleanup_tree_cfg_loop): Update prototype.
	* passes.c (execute_function_todo): When cleanup did something, remove
	unused locals.
	* tree-cfg.c (pass_build_cfg): Add cleanup_cfg TODO.
	(make_edges): Don't cleanup_cfg.

From-SVN: r120900
parent d85c7550
2007-01-18 Jan Hubicka <jh@suse.cz>
* tree-vrp.c (finalize_jump_threads): Do not call cleanup_cfg by hand.
* tree-tailcall (add_virtual_phis): Likewise.
(optimize_tail_call): Return TODOs.
(execute_tail_calls): Return TODOs.
* tree-ssa-ccp (execute_fold_all_builtins): Do cleanup_cfg via TODO.
* tree-cfgcleanup.c (cleanup_tree_cfg_loop): Return if something
changed.
* tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_value):
Cleanup cfg using TODO.
* tree-flow.h (cleanup_tree_cfg_loop): Update prototype.
* passes.c (execute_function_todo): When cleanup did something, remove
unused locals.
* tree-cfg.c (pass_build_cfg): Add cleanup_cfg TODO.
(make_edges): Don't cleanup_cfg.
2007-01-18 Uros Bizjak <ubizjak@gmail.com> 2007-01-18 Uros Bizjak <ubizjak@gmail.com>
* reg-stack.c (subst_stack_regs_pat) [UNSPEC_SINCOS_COS, * reg-stack.c (subst_stack_regs_pat) [UNSPEC_SINCOS_COS,
......
...@@ -818,14 +818,19 @@ execute_function_todo (void *data) ...@@ -818,14 +818,19 @@ execute_function_todo (void *data)
if (!flags) if (!flags)
return; return;
/* Always cleanup the CFG before trying to update SSA . */ /* Always cleanup the CFG before trying to update SSA. */
if (flags & TODO_cleanup_cfg) if (flags & TODO_cleanup_cfg)
{ {
bool cleanup;
if (current_loops) if (current_loops)
cleanup_tree_cfg_loop (); cleanup = cleanup_tree_cfg_loop ();
else else
cleanup_tree_cfg (); cleanup = cleanup_tree_cfg ();
if (cleanup && (cfun->curr_properties & PROP_ssa))
flags |= TODO_remove_unused_locals;
/* When cleanup_tree_cfg merges consecutive blocks, it may /* When cleanup_tree_cfg merges consecutive blocks, it may
perform some simplistic propagation when removing single perform some simplistic propagation when removing single
valued PHI nodes. This propagation may, in turn, cause the valued PHI nodes. This propagation may, in turn, cause the
......
...@@ -237,7 +237,7 @@ struct tree_opt_pass pass_build_cfg = ...@@ -237,7 +237,7 @@ struct tree_opt_pass pass_build_cfg =
PROP_cfg, /* properties_provided */ PROP_cfg, /* properties_provided */
0, /* properties_destroyed */ 0, /* properties_destroyed */
0, /* todo_flags_start */ 0, /* todo_flags_start */
TODO_verify_stmts, /* todo_flags_finish */ TODO_verify_stmts | TODO_cleanup_cfg, /* todo_flags_finish */
0 /* letter */ 0 /* letter */
}; };
...@@ -579,9 +579,6 @@ make_edges (void) ...@@ -579,9 +579,6 @@ make_edges (void)
/* Fold COND_EXPR_COND of each COND_EXPR. */ /* Fold COND_EXPR_COND of each COND_EXPR. */
fold_cond_expr_cond (); fold_cond_expr_cond ();
/* Clean up the graph and warn for unreachable code. */
cleanup_tree_cfg ();
} }
......
...@@ -574,7 +574,7 @@ cleanup_tree_cfg (void) ...@@ -574,7 +574,7 @@ cleanup_tree_cfg (void)
/* Cleanup cfg and repair loop structures. */ /* Cleanup cfg and repair loop structures. */
void bool
cleanup_tree_cfg_loop (void) cleanup_tree_cfg_loop (void)
{ {
bool changed = cleanup_tree_cfg (); bool changed = cleanup_tree_cfg ();
...@@ -597,6 +597,7 @@ cleanup_tree_cfg_loop (void) ...@@ -597,6 +597,7 @@ cleanup_tree_cfg_loop (void)
#endif #endif
scev_reset (); scev_reset ();
} }
return changed;
} }
/* Merge the PHI nodes at BB into those at BB's sole successor. */ /* Merge the PHI nodes at BB into those at BB's sole successor. */
......
...@@ -678,7 +678,7 @@ extern basic_block move_sese_region_to_fn (struct function *, basic_block, ...@@ -678,7 +678,7 @@ extern basic_block move_sese_region_to_fn (struct function *, basic_block,
/* In tree-cfgcleanup.c */ /* In tree-cfgcleanup.c */
extern bool cleanup_tree_cfg (void); extern bool cleanup_tree_cfg (void);
extern void cleanup_tree_cfg_loop (void); extern bool cleanup_tree_cfg_loop (void);
/* In tree-pretty-print.c. */ /* In tree-pretty-print.c. */
extern void dump_generic_bb (FILE *, basic_block, int, int); extern void dump_generic_bb (FILE *, basic_block, int, int);
......
...@@ -2630,9 +2630,7 @@ execute_fold_all_builtins (void) ...@@ -2630,9 +2630,7 @@ execute_fold_all_builtins (void)
} }
/* Delete unreachable blocks. */ /* Delete unreachable blocks. */
if (cfg_changed) return cfg_changed ? TODO_cleanup_cfg : 0;
cleanup_tree_cfg ();
return 0;
} }
......
...@@ -1041,7 +1041,7 @@ tree_ssa_forward_propagate_single_use_vars (void) ...@@ -1041,7 +1041,7 @@ tree_ssa_forward_propagate_single_use_vars (void)
} }
if (cfg_changed) if (cfg_changed)
cleanup_tree_cfg (); todoflags |= TODO_cleanup_cfg;
return todoflags; return todoflags;
} }
......
...@@ -829,8 +829,6 @@ add_virtual_phis (void) ...@@ -829,8 +829,6 @@ add_virtual_phis (void)
if (!is_gimple_reg (var) && gimple_default_def (cfun, var) != NULL_TREE) if (!is_gimple_reg (var) && gimple_default_def (cfun, var) != NULL_TREE)
mark_sym_for_renaming (var); mark_sym_for_renaming (var);
} }
update_ssa (TODO_update_ssa_only_virtuals);
} }
/* Optimizes the tailcall described by T. If OPT_TAILCALLS is true, also /* Optimizes the tailcall described by T. If OPT_TAILCALLS is true, also
...@@ -865,7 +863,7 @@ optimize_tail_call (struct tailcall *t, bool opt_tailcalls) ...@@ -865,7 +863,7 @@ optimize_tail_call (struct tailcall *t, bool opt_tailcalls)
/* Optimizes tail calls in the function, turning the tail recursion /* Optimizes tail calls in the function, turning the tail recursion
into iteration. */ into iteration. */
static void static unsigned int
tree_optimize_tail_calls_1 (bool opt_tailcalls) tree_optimize_tail_calls_1 (bool opt_tailcalls)
{ {
edge e; edge e;
...@@ -877,7 +875,7 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls) ...@@ -877,7 +875,7 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls)
edge_iterator ei; edge_iterator ei;
if (!suitable_for_tail_opt_p ()) if (!suitable_for_tail_opt_p ())
return; return 0;
if (opt_tailcalls) if (opt_tailcalls)
opt_tailcalls = suitable_for_tail_call_opt_p (); opt_tailcalls = suitable_for_tail_call_opt_p ();
...@@ -985,20 +983,19 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls) ...@@ -985,20 +983,19 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls)
} }
if (changed) if (changed)
{ free_dominance_info (CDI_DOMINATORS);
free_dominance_info (CDI_DOMINATORS);
cleanup_tree_cfg ();
}
if (phis_constructed) if (phis_constructed)
add_virtual_phis (); add_virtual_phis ();
if (changed)
return TODO_cleanup_cfg | TODO_update_ssa_only_virtuals;
return 0;
} }
static unsigned int static unsigned int
execute_tail_recursion (void) execute_tail_recursion (void)
{ {
tree_optimize_tail_calls_1 (false); return tree_optimize_tail_calls_1 (false);
return 0;
} }
static bool static bool
...@@ -1010,8 +1007,7 @@ gate_tail_calls (void) ...@@ -1010,8 +1007,7 @@ gate_tail_calls (void)
static unsigned int static unsigned int
execute_tail_calls (void) execute_tail_calls (void)
{ {
tree_optimize_tail_calls_1 (true); return tree_optimize_tail_calls_1 (true);
return 0;
} }
struct tree_opt_pass pass_tail_recursion = struct tree_opt_pass pass_tail_recursion =
......
...@@ -4894,13 +4894,9 @@ finalize_jump_threads (void) ...@@ -4894,13 +4894,9 @@ finalize_jump_threads (void)
cfg_altered = thread_through_all_blocks (); cfg_altered = thread_through_all_blocks ();
/* If we threaded jumps, then we need to recompute the dominance /* If we threaded jumps, then we need to recompute the dominance
information, to safely do that we must clean up the CFG first. */ information. */
if (cfg_altered) if (cfg_altered)
{ free_dominance_info (CDI_DOMINATORS);
free_dominance_info (CDI_DOMINATORS);
cleanup_tree_cfg ();
calculate_dominance_info (CDI_DOMINATORS);
}
VEC_free (tree, heap, stack); VEC_free (tree, heap, stack);
} }
......
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