From 72e1a42b5d19652e77e37936ed5cdf619d76a08f Mon Sep 17 00:00:00 2001 From: rakdver Date: Fri, 27 Apr 2007 20:40:26 +0000 Subject: [PATCH] * tree-cfgcleanup.c (cleanup_tree_cfg): Verify dominance info if it claims to be available. * tree-ssa-dce.c (remove_dead_stmt): Mark cfg as altered when edge is redirected. (perform_tree_ssa_dce): Always free postdominators. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124236 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/tree-cfgcleanup.c | 7 ++++++- gcc/tree-ssa-dce.c | 11 ++++++++--- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1b3f0ef..b50c1aa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2007-04-27 Zdenek Dvorak + + * tree-cfgcleanup.c (cleanup_tree_cfg): Verify dominance info + if it claims to be available. + * tree-ssa-dce.c (remove_dead_stmt): Mark cfg as altered when + edge is redirected. + (perform_tree_ssa_dce): Always free postdominators. + 2007-04-27 Richard Henderson * config/alpha/predicates.md (aligned_memory_operand): Mark diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c index 92ac237..aaf6ce8 100644 --- a/gcc/tree-cfgcleanup.c +++ b/gcc/tree-cfgcleanup.c @@ -615,7 +615,12 @@ cleanup_tree_cfg (void) calculate_dominance_info (CDI_DOMINATORS); } else - changed = false; + { +#ifdef ENABLE_CHECKING + verify_dominators (CDI_DOMINATORS); +#endif + changed = false; + } changed |= cleanup_tree_cfg_1 (); diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c index 3631add..7da5cdf 100644 --- a/gcc/tree-ssa-dce.c +++ b/gcc/tree-ssa-dce.c @@ -607,7 +607,6 @@ remove_dead_stmt (block_stmt_iterator *i, basic_block bb) 3. If the post dominator has PHI nodes we may be able to compute the right PHI args for them. - In each of these cases we must remove the control statement as it may reference SSA_NAMEs which are going to be removed and we remove all but one outgoing edge from the block. */ @@ -620,6 +619,11 @@ remove_dead_stmt (block_stmt_iterator *i, basic_block bb) /* Redirect the first edge out of BB to reach POST_DOM_BB. */ redirect_edge_and_branch (EDGE_SUCC (bb, 0), post_dom_bb); PENDING_STMT (EDGE_SUCC (bb, 0)) = NULL; + + /* It is not sufficient to set cfg_altered below during edge + removal, in case BB has two successors and one of them + is POST_DOM_BB. */ + cfg_altered = true; } EDGE_SUCC (bb, 0)->probability = REG_BR_PROB_BASE; EDGE_SUCC (bb, 0)->count = bb->count; @@ -718,6 +722,7 @@ eliminate_unnecessary_stmts (void) } } } + return something_changed; } @@ -837,8 +842,8 @@ perform_tree_ssa_dce (bool aggressive) something_changed |= eliminate_unnecessary_stmts (); something_changed |= cfg_altered; - if (aggressive && something_changed) - free_dominance_info (CDI_POST_DOMINATORS); + /* We do not update postdominators, so free them unconditionally. */ + free_dominance_info (CDI_POST_DOMINATORS); /* If we removed paths in the CFG, then we need to update dominators as well. I haven't investigated the possibility -- 2.7.4