[patch] for -O2 -finline-functions tramp3d breakage
Zdenek Dvorak
rakdver@atrey.karlin.mff.cuni.cz
Fri Apr 27 19:41:00 GMT 2007
Hello,
in remove_dead_stmt, we forget to mark cfg altered if there are two
edges coming out of the basic block and one of them leads to the
postdominator.
Bootstrapped & regtested on i686.
Zdenek
* 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.
Index: tree-cfgcleanup.c
===================================================================
*** tree-cfgcleanup.c (revision 124214)
--- tree-cfgcleanup.c (working copy)
*************** cleanup_tree_cfg (void)
*** 615,621 ****
calculate_dominance_info (CDI_DOMINATORS);
}
else
! changed = false;
changed |= cleanup_tree_cfg_1 ();
--- 615,626 ----
calculate_dominance_info (CDI_DOMINATORS);
}
else
! {
! #ifdef ENABLE_CHECKING
! verify_dominators (CDI_DOMINATORS);
! #endif
! changed = false;
! }
changed |= cleanup_tree_cfg_1 ();
Index: tree-ssa-dce.c
===================================================================
*** tree-ssa-dce.c (revision 124214)
--- tree-ssa-dce.c (working copy)
*************** remove_dead_stmt (block_stmt_iterator *i
*** 607,613 ****
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. */
--- 607,612 ----
*************** remove_dead_stmt (block_stmt_iterator *i
*** 620,625 ****
--- 619,629 ----
/* 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;
*************** eliminate_unnecessary_stmts (void)
*** 718,723 ****
--- 722,728 ----
}
}
}
+
return something_changed;
}
*************** perform_tree_ssa_dce (bool aggressive)
*** 837,844 ****
something_changed |= eliminate_unnecessary_stmts ();
something_changed |= cfg_altered;
! if (aggressive && something_changed)
! 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
--- 842,849 ----
something_changed |= eliminate_unnecessary_stmts ();
something_changed |= cfg_altered;
! /* 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
More information about the Gcc-patches
mailing list