dbgcnt.def (cprop1, [...]): Remove

* dbgcnt.def (cprop1, cprop2, gcse, jump_bypass): Remove
	(cprop, hoist, pre, store_motion): New debug counters.
	* tree-pass.h (pass_tracer): Move to list of gimple passes, it
	is not an RTL pass anymore.
	(pass_profiling): Remove extern decl for pass removed in 2005.
	(pass_gcse, pass_jump_bypass): Remove.
	* final.c (rest_of_clean_state): Set flag_rerun_cse_after_global_opts
	to 0 for clean state.
	* toplev.h (flag_rerun_cse_after_global_opts): Add extern declaration.
	* cse.c (gate_handle_cse_after_global_opts,
	rest_of_handle_cse_after_global_opts): New functions.
	(pass_cse_after_global_opts): New pass, does local CSE.
	* timevar.def (TV_GCSE, TV_CPROP1, TV_CPROP2, TV_BYPASS): Remove.
	(TV_CPROP): New timevar.
	* gcse.c (flag_rerun_cse_after_global_opts): New global variable.
	(run_jump_opt_after_gcse, max_gcse_regno): Remove global vars.
	(gcse_main, recompute_all_luids): Remove.
	(compute_hash_table_work): Call max_reg_num instead of reading
	max_gcse_regno.
	(cprop_jump): Don't set run_jump_opt_after_gcse.
	(constprop_register): Always allow to alter jumps.
	(cprop_insn): Likewise.
	(do_local_cprop): Likewise.
	(local_cprop_pass): Likewise.  Return non-zero if something changed.
	(cprop): Remove function, fold interesting bits into one_cprop_pass.
	(find_implicit_sets): Add note about missed optimization opportunity.
	(one_cprop_pass): Rewrite to be "the" CPROP pass, called from the
	pass_rtl_cprop execute function.
	Don't bother tracking the pass number, each pass gets its own dumpfile
	now anyway.
	Always allow to alter jumpsand bypass jumps.
	(bypass_block): Don't ignore regno >= max_gcse_regno, find_bypass_set
	will just find no suitable set.
	(pre_edge_insert): Fix dumping, this function is for PRE only.
	(one_pre_gcse_pass): Rewrite to be "the" PRE pass, called from the
	pass_rtl_pre execute function.
	(hoist_code): Return non-zero if something changed.  Keep track of
	substitutions and insertions for statistics gathering similar to PRE.
	(one_code_hoisting_pass): Rewrite to be "the" code hoisting pass,
	called from the pass_rtl_hoist execute function.  Show pass statistics.
	(compute_store_table): Use max_reg_num directly instead of using the
	formerly global max_gcse_regno.
	(build_store_vectors): Likewise.
	(replace_store_insn): Fix dumping.
	(store_motion): Rename to ...
	(one_store_motion_pass): ... this.  Rewrite to be "the" STORE_MOTION
	pass, called from the pass_rtl_store_motion execute function.  Keep
	track of substitutions and insertions for statistics gathering similar
	to PRE.
	(bypass_jumps): Remove, fold interesting bits into ...
	(one_cprop_pass): ... this.  Rewrite to be "the" CPROP pass, called
	from the pass_rtl_cprop execute function.
	(gate_handle_jump_bypass, rest_of_handle_jump_bypass,
	pass_jump_bypass): Remove.
	(gate_handle_gcse, rest_of_handle_gcse): Remove.
	(gate_rtl_cprop, execute_rtl_cprop, pass_rtl_cprop): New.
	(gate_rtl_pre, execute_rtl_pre, pass_rtl_pre): New.
	(gate_rtl_hoist, execute_rtl_hoist, pass_rtl_hoist): New.
	(gate_rtl_store_motion, execute_rtl_store_motion,
	pass_rtl_store_motion): New.
	* common.opt: Remove flag_cse_skip_blocks, adjust documentation to
	make it clear that -fcse-skip-blocks is a no-op for backward compat.
	* passes.c (init_optimization_passes): Remove pass_gcse and
	pass_jump_bypass.  Schedule cprop, pre, hoist, cprop, store_motion,
	and cse_after_global_opts in place of pass_gcse.  Schedule cprop
	instead of pass_jump_bypass.

From-SVN: r146848
This commit is contained in:
Steven Bosscher 2009-04-27 17:21:27 +00:00
parent c685de4a22
commit 5f39ad476c
10 changed files with 510 additions and 482 deletions

View File

@ -1,3 +1,72 @@
2009-04-27 Steven Bosscher <steven@gcc.gnu.org>
* dbgcnt.def (cprop1, cprop2, gcse, jump_bypass): Remove
(cprop, hoist, pre, store_motion): New debug counters.
* tree-pass.h (pass_tracer): Move to list of gimple passes, it
is not an RTL pass anymore.
(pass_profiling): Remove extern decl for pass removed in 2005.
(pass_gcse, pass_jump_bypass): Remove.
* final.c (rest_of_clean_state): Set flag_rerun_cse_after_global_opts
to 0 for clean state.
* toplev.h (flag_rerun_cse_after_global_opts): Add extern declaration.
* cse.c (gate_handle_cse_after_global_opts,
rest_of_handle_cse_after_global_opts): New functions.
(pass_cse_after_global_opts): New pass, does local CSE.
* timevar.def (TV_GCSE, TV_CPROP1, TV_CPROP2, TV_BYPASS): Remove.
(TV_CPROP): New timevar.
* gcse.c (flag_rerun_cse_after_global_opts): New global variable.
(run_jump_opt_after_gcse, max_gcse_regno): Remove global vars.
(gcse_main, recompute_all_luids): Remove.
(compute_hash_table_work): Call max_reg_num instead of reading
max_gcse_regno.
(cprop_jump): Don't set run_jump_opt_after_gcse.
(constprop_register): Always allow to alter jumps.
(cprop_insn): Likewise.
(do_local_cprop): Likewise.
(local_cprop_pass): Likewise. Return non-zero if something changed.
(cprop): Remove function, fold interesting bits into one_cprop_pass.
(find_implicit_sets): Add note about missed optimization opportunity.
(one_cprop_pass): Rewrite to be "the" CPROP pass, called from the
pass_rtl_cprop execute function.
Don't bother tracking the pass number, each pass gets its own dumpfile
now anyway.
Always allow to alter jumpsand bypass jumps.
(bypass_block): Don't ignore regno >= max_gcse_regno, find_bypass_set
will just find no suitable set.
(pre_edge_insert): Fix dumping, this function is for PRE only.
(one_pre_gcse_pass): Rewrite to be "the" PRE pass, called from the
pass_rtl_pre execute function.
(hoist_code): Return non-zero if something changed. Keep track of
substitutions and insertions for statistics gathering similar to PRE.
(one_code_hoisting_pass): Rewrite to be "the" code hoisting pass,
called from the pass_rtl_hoist execute function. Show pass statistics.
(compute_store_table): Use max_reg_num directly instead of using the
formerly global max_gcse_regno.
(build_store_vectors): Likewise.
(replace_store_insn): Fix dumping.
(store_motion): Rename to ...
(one_store_motion_pass): ... this. Rewrite to be "the" STORE_MOTION
pass, called from the pass_rtl_store_motion execute function. Keep
track of substitutions and insertions for statistics gathering similar
to PRE.
(bypass_jumps): Remove, fold interesting bits into ...
(one_cprop_pass): ... this. Rewrite to be "the" CPROP pass, called
from the pass_rtl_cprop execute function.
(gate_handle_jump_bypass, rest_of_handle_jump_bypass,
pass_jump_bypass): Remove.
(gate_handle_gcse, rest_of_handle_gcse): Remove.
(gate_rtl_cprop, execute_rtl_cprop, pass_rtl_cprop): New.
(gate_rtl_pre, execute_rtl_pre, pass_rtl_pre): New.
(gate_rtl_hoist, execute_rtl_hoist, pass_rtl_hoist): New.
(gate_rtl_store_motion, execute_rtl_store_motion,
pass_rtl_store_motion): New.
* common.opt: Remove flag_cse_skip_blocks, adjust documentation to
make it clear that -fcse-skip-blocks is a no-op for backward compat.
* passes.c (init_optimization_passes): Remove pass_gcse and
pass_jump_bypass. Schedule cprop, pre, hoist, cprop, store_motion,
and cse_after_global_opts in place of pass_gcse. Schedule cprop
instead of pass_jump_bypass.
2009-04-27 Richard Guenther <rguenther@suse.de>
PR middle-end/39928

View File

@ -397,8 +397,8 @@ Common Report Var(flag_cse_follow_jumps) Optimization
When running CSE, follow jumps to their targets
fcse-skip-blocks
Common Report Var(flag_cse_skip_blocks) Optimization
When running CSE, follow conditional jumps
Common
Does nothing. Preserved for backward compatibility.
fcx-limited-range
Common Report Var(flag_cx_limited_range) Optimization

View File

@ -6997,3 +6997,65 @@ struct rtl_opt_pass pass_cse2 =
TODO_verify_flow /* todo_flags_finish */
}
};
static bool
gate_handle_cse_after_global_opts (void)
{
return optimize > 0 && flag_rerun_cse_after_global_opts;
}
/* Run second CSE pass after loop optimizations. */
static unsigned int
rest_of_handle_cse_after_global_opts (void)
{
int save_cfj;
int tem;
/* We only want to do local CSE, so don't follow jumps. */
save_cfj = flag_cse_follow_jumps;
flag_cse_follow_jumps = 0;
rebuild_jump_labels (get_insns ());
tem = cse_main (get_insns (), max_reg_num ());
purge_all_dead_edges ();
delete_trivially_dead_insns (get_insns (), max_reg_num ());
cse_not_expected = !flag_rerun_cse_after_loop;
/* If cse altered any jumps, rerun jump opts to clean things up. */
if (tem == 2)
{
timevar_push (TV_JUMP);
rebuild_jump_labels (get_insns ());
cleanup_cfg (0);
timevar_pop (TV_JUMP);
}
else if (tem == 1)
cleanup_cfg (0);
flag_cse_follow_jumps = save_cfj;
return 0;
}
struct rtl_opt_pass pass_cse_after_global_opts =
{
{
RTL_PASS,
"cse_local", /* name */
gate_handle_cse_after_global_opts, /* gate */
rest_of_handle_cse_after_global_opts, /* execute */
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
TV_CSE, /* tv_id */
0, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
TODO_df_finish | TODO_verify_rtl_sharing |
TODO_dump_func |
TODO_ggc_collect |
TODO_verify_flow /* todo_flags_finish */
}
};

View File

@ -145,8 +145,7 @@ DEBUG_COUNTER (auto_inc_dec)
DEBUG_COUNTER (ccp)
DEBUG_COUNTER (cfg_cleanup)
DEBUG_COUNTER (cse2_move2add)
DEBUG_COUNTER (cprop1)
DEBUG_COUNTER (cprop2)
DEBUG_COUNTER (cprop)
DEBUG_COUNTER (dce)
DEBUG_COUNTER (dce_fast)
DEBUG_COUNTER (dce_ud)
@ -155,17 +154,17 @@ DEBUG_COUNTER (df_byte_scan)
DEBUG_COUNTER (dse)
DEBUG_COUNTER (dse1)
DEBUG_COUNTER (dse2)
DEBUG_COUNTER (gcse)
DEBUG_COUNTER (gcse2_delete)
DEBUG_COUNTER (global_alloc_at_func)
DEBUG_COUNTER (global_alloc_at_reg)
DEBUG_COUNTER (hoist)
DEBUG_COUNTER (ia64_sched2)
DEBUG_COUNTER (if_conversion)
DEBUG_COUNTER (if_after_combine)
DEBUG_COUNTER (if_after_reload)
DEBUG_COUNTER (jump_bypass)
DEBUG_COUNTER (local_alloc_for_sched)
DEBUG_COUNTER (postreload_cse)
DEBUG_COUNTER (pre)
DEBUG_COUNTER (pre_insn)
DEBUG_COUNTER (treepre_insert)
DEBUG_COUNTER (sched2_func)
@ -177,5 +176,6 @@ DEBUG_COUNTER (sel_sched_cnt)
DEBUG_COUNTER (sel_sched_region_cnt)
DEBUG_COUNTER (sel_sched_insn_cnt)
DEBUG_COUNTER (sms_sched_loop)
DEBUG_COUNTER (store_motion)
DEBUG_COUNTER (split_for_sched2)
DEBUG_COUNTER (tail_call)

View File

@ -4298,6 +4298,7 @@ rest_of_clean_state (void)
sdbout_types (NULL_TREE);
#endif
flag_rerun_cse_after_global_opts = 0;
reload_completed = 0;
epilogue_completed = 0;
#ifdef STACK_REGS

File diff suppressed because it is too large Load Diff

View File

@ -729,7 +729,12 @@ init_optimization_passes (void)
NEXT_PASS (pass_df_initialize_opt);
NEXT_PASS (pass_cse);
NEXT_PASS (pass_rtl_fwprop);
NEXT_PASS (pass_gcse);
NEXT_PASS (pass_rtl_cprop);
NEXT_PASS (pass_rtl_pre);
NEXT_PASS (pass_rtl_hoist);
NEXT_PASS (pass_rtl_cprop);
NEXT_PASS (pass_rtl_store_motion);
NEXT_PASS (pass_cse_after_global_opts);
NEXT_PASS (pass_rtl_ifcvt);
/* Perform loop optimizations. It might be better to do them a bit
sooner, but we want the profile feedback to work more
@ -746,7 +751,7 @@ init_optimization_passes (void)
*p = NULL;
}
NEXT_PASS (pass_web);
NEXT_PASS (pass_jump_bypass);
NEXT_PASS (pass_rtl_cprop);
NEXT_PASS (pass_cse2);
NEXT_PASS (pass_rtl_dse1);
NEXT_PASS (pass_rtl_fwprop_addr);

View File

@ -154,13 +154,10 @@ DEFTIMEVAR (TV_DCE , "dead code elimination")
DEFTIMEVAR (TV_DSE1 , "dead store elim1")
DEFTIMEVAR (TV_DSE2 , "dead store elim2")
DEFTIMEVAR (TV_LOOP , "loop analysis")
DEFTIMEVAR (TV_GCSE , "global CSE")
DEFTIMEVAR (TV_CPROP1 , "CPROP 1")
DEFTIMEVAR (TV_CPROP , "CPROP")
DEFTIMEVAR (TV_PRE , "PRE")
DEFTIMEVAR (TV_HOIST , "code hoisting")
DEFTIMEVAR (TV_CPROP2 , "CPROP 2")
DEFTIMEVAR (TV_LSM , "LSM")
DEFTIMEVAR (TV_BYPASS , "bypass jumps")
DEFTIMEVAR (TV_TRACER , "tracer")
DEFTIMEVAR (TV_WEB , "web")
DEFTIMEVAR (TV_AUTO_INC_DEC , "auto inc dec")

View File

@ -132,6 +132,7 @@ extern int flag_if_conversion;
extern int flag_if_conversion2;
extern int flag_keep_static_consts;
extern int flag_peel_loops;
extern int flag_rerun_cse_after_global_opts;
extern int flag_rerun_cse_after_loop;
extern int flag_thread_jumps;
extern int flag_tracer;

View File

@ -394,6 +394,7 @@ extern struct gimple_opt_pass pass_rebuild_cgraph_edges;
extern struct gimple_opt_pass pass_remove_cgraph_callee_edges;
extern struct gimple_opt_pass pass_build_cgraph_edges;
extern struct gimple_opt_pass pass_local_pure_const;
extern struct gimple_opt_pass pass_tracer;
/* IPA Passes */
extern struct ipa_opt_pass pass_ipa_inline;
@ -433,11 +434,12 @@ extern struct rtl_opt_pass pass_rtl_dce;
extern struct rtl_opt_pass pass_rtl_dse1;
extern struct rtl_opt_pass pass_rtl_dse2;
extern struct rtl_opt_pass pass_rtl_dse3;
extern struct rtl_opt_pass pass_gcse;
extern struct rtl_opt_pass pass_jump_bypass;
extern struct rtl_opt_pass pass_profiling;
extern struct rtl_opt_pass pass_rtl_cprop;
extern struct rtl_opt_pass pass_rtl_pre;
extern struct rtl_opt_pass pass_rtl_hoist;
extern struct rtl_opt_pass pass_rtl_store_motion;
extern struct rtl_opt_pass pass_cse_after_global_opts;
extern struct rtl_opt_pass pass_rtl_ifcvt;
extern struct gimple_opt_pass pass_tracer;
extern struct rtl_opt_pass pass_into_cfg_layout_mode;
extern struct rtl_opt_pass pass_outof_cfg_layout_mode;