https://gcc.gnu.org/g:bf1ef45735e94247fe632602ee4dda091a5fd2bf
commit bf1ef45735e94247fe632602ee4dda091a5fd2bf Author: Ondřej Machota <ondrejmach...@gmail.com> Date: Mon Apr 29 21:38:47 2024 +0200 rtl-ssa: Create new dce pass Diff: --- gcc/dce.cc | 41 +++++++++++++++++++++++++++++++++++++++++ gcc/dce.h | 1 + gcc/passes.def | 2 +- gcc/tree-pass.h | 1 + 4 files changed, 44 insertions(+), 1 deletion(-) diff --git a/gcc/dce.cc b/gcc/dce.cc index be1a2a87732..9ded9256c3b 100644 --- a/gcc/dce.cc +++ b/gcc/dce.cc @@ -1299,3 +1299,44 @@ make_pass_fast_rtl_dce (gcc::context *ctxt) { return new pass_fast_rtl_dce (ctxt); } + +namespace { + +const pass_data pass_data_rtl_ssa_dce = { + RTL_PASS, /* type */ + "rtl_ssa_dce", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ + TV_DCE, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_df_finish, /* todo_flags_finish */ +}; + +class pass_rtl_ssa_dce : public rtl_opt_pass +{ +public: + pass_rtl_ssa_dce (gcc::context *ctxt) + : rtl_opt_pass (pass_data_rtl_ssa_dce, ctxt) + {} + + /* opt_pass methods: */ + bool gate (function *) final override { return flag_dce; } + + unsigned int execute (function *) final override + { + if (dump_file) + fprintf (dump_file, "pass_rtl_ssa_dce called\n"); + return 0; + } + +}; // class pass_fast_rtl_dce + +} // namespace + +rtl_opt_pass * +make_pass_rtl_ssa_dce (gcc::context *ctxt) +{ + return new pass_rtl_ssa_dce (ctxt); +} diff --git a/gcc/dce.h b/gcc/dce.h index 346fb28d80e..806aa6a18bc 100644 --- a/gcc/dce.h +++ b/gcc/dce.h @@ -23,5 +23,6 @@ along with GCC; see the file COPYING3. If not see extern void run_word_dce (void); extern void run_fast_dce (void); extern void run_fast_df_dce (void); +extern void run_rtl_ssa_dce (void); #endif /* GCC_DCE_H */ diff --git a/gcc/passes.def b/gcc/passes.def index 1cbbd413097..f55a2ee5e82 100644 --- a/gcc/passes.def +++ b/gcc/passes.def @@ -526,7 +526,7 @@ along with GCC; see the file COPYING3. If not see NEXT_PASS (pass_regrename); NEXT_PASS (pass_fold_mem_offsets); NEXT_PASS (pass_cprop_hardreg); - NEXT_PASS (pass_fast_rtl_dce); + NEXT_PASS (pass_rtl_ssa_dce); NEXT_PASS (pass_reorder_blocks); NEXT_PASS (pass_leaf_regs); NEXT_PASS (pass_split_before_sched2); diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h index 29267589eeb..fbdd95a1e04 100644 --- a/gcc/tree-pass.h +++ b/gcc/tree-pass.h @@ -562,6 +562,7 @@ extern rtl_opt_pass *make_pass_jump2 (gcc::context *ctxt); extern rtl_opt_pass *make_pass_lower_subreg (gcc::context *ctxt); extern rtl_opt_pass *make_pass_cse (gcc::context *ctxt); extern rtl_opt_pass *make_pass_fast_rtl_dce (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_rtl_ssa_dce (gcc::context *ctxt); extern rtl_opt_pass *make_pass_ud_rtl_dce (gcc::context *ctxt); extern rtl_opt_pass *make_pass_rtl_dce (gcc::context *ctxt); extern rtl_opt_pass *make_pass_rtl_dse1 (gcc::context *ctxt);