This adjusts the CFG cleanup flow back to what it was before the last change which fixes the observed regression of 541.leela_r with LTO and FDO.
Boostrapped on x86_64-unknown-linux-gnu, testing in progress. 2022-01-12 Richard Biener <rguent...@suse.de> PR tree-optimization/103990 * tree-pass.h (tail_merge_optimize): Drop unused argument. * tree-ssa-tail-merge.c (tail_merge_optimize): Likewise. * tree-ssa-pre.c (pass_pre::execute): Retain TODO_cleanup_cfg and adjust call to tail_merge_optimize. --- gcc/tree-pass.h | 2 +- gcc/tree-ssa-pre.c | 6 ++---- gcc/tree-ssa-tail-merge.c | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h index 36097cf2736..606d1d60b85 100644 --- a/gcc/tree-pass.h +++ b/gcc/tree-pass.h @@ -412,7 +412,7 @@ extern gimple_opt_pass *make_pass_early_thread_jumps (gcc::context *ctxt); extern gimple_opt_pass *make_pass_split_crit_edges (gcc::context *ctxt); extern gimple_opt_pass *make_pass_laddress (gcc::context *ctxt); extern gimple_opt_pass *make_pass_pre (gcc::context *ctxt); -extern unsigned int tail_merge_optimize (unsigned int, bool); +extern unsigned int tail_merge_optimize (bool); extern gimple_opt_pass *make_pass_profile (gcc::context *ctxt); extern gimple_opt_pass *make_pass_strip_predict_hints (gcc::context *ctxt); extern gimple_opt_pass *make_pass_lower_complex_O0 (gcc::context *ctxt); diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index ab24fa98a1f..5113256802e 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -4442,7 +4442,6 @@ pass_pre::execute (function *fun) if (todo & TODO_cleanup_cfg) { cleanup_tree_cfg (); - todo &= ~TODO_cleanup_cfg; need_crit_edge_split = true; } @@ -4458,9 +4457,8 @@ pass_pre::execute (function *fun) It should either: - call merge_blocks after each tail merge iteration - call merge_blocks after all tail merge iterations - - mark TODO_cleanup_cfg when necessary - - share the cfg cleanup with fini_pre. */ - todo |= tail_merge_optimize (todo, need_crit_edge_split); + - mark TODO_cleanup_cfg when necessary. */ + todo |= tail_merge_optimize (need_crit_edge_split); free_rpo_vn (); diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c index fd333800f0f..8e1ea1a982e 100644 --- a/gcc/tree-ssa-tail-merge.c +++ b/gcc/tree-ssa-tail-merge.c @@ -1724,7 +1724,7 @@ update_debug_stmts (void) /* Runs tail merge optimization. */ unsigned int -tail_merge_optimize (unsigned int todo, bool need_crit_edge_split) +tail_merge_optimize (bool need_crit_edge_split) { int nr_bbs_removed_total = 0; int nr_bbs_removed; @@ -1814,5 +1814,5 @@ tail_merge_optimize (unsigned int todo, bool need_crit_edge_split) timevar_pop (TV_TREE_TAIL_MERGE); - return todo; + return 0; } -- 2.31.1