This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
pretty-ipa merge part 12: EH redirection preparations
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc-patches at gcc dot gnu dot org, rguenther at suse dot de
- Date: Fri, 24 Apr 2009 17:12:13 +0200
- Subject: pretty-ipa merge part 12: EH redirection preparations
Hi,
this patch makes CFG/inline/propagate code happy with EH edges being
non-abnormal. There is not much interesting in it, but I would like to
break it out from the redirection patch itself.
Honza
bootstrapped/regtested x86_64-linux, OK?
* tree-cfg.c (gimple_can_merge_blocks_p): EH edges are unmergable.
(gimple_can_remove_branch_p): EH edges won't remove branch by
redirection.
* tree-inline.c (update_ssa_across_abnormal_edges): Do handle
updating of non-abnormal EH edges.
* tree-ssa-propagate (simulate_block): Handle EH edges too;
update comment.
*** /aux/hubicka/trunk-write/gcc/tree-cfg.c Wed Apr 22 15:38:19 2009
--- tree-cfg.c Sat Apr 18 17:56:15 2009
*************** gimple_can_merge_blocks_p (basic_block a
*** 1212,1218 ****
if (!single_succ_p (a))
return false;
! if (single_succ_edge (a)->flags & EDGE_ABNORMAL)
return false;
if (single_succ (a) != b)
--- 1212,1218 ----
if (!single_succ_p (a))
return false;
! if (single_succ_edge (a)->flags & (EDGE_ABNORMAL | EDGE_EH))
return false;
if (single_succ (a) != b)
*************** gimple_redirect_edge_and_branch (edge e,
*** 4892,4898 ****
static bool
gimple_can_remove_branch_p (const_edge e)
{
! if (e->flags & EDGE_ABNORMAL)
return false;
return true;
--- 4895,4901 ----
static bool
gimple_can_remove_branch_p (const_edge e)
{
! if (e->flags & (EDGE_ABNORMAL | EDGE_EH))
return false;
return true;
*** /aux/hubicka/trunk-write/gcc/tree-ssa-propagate.c Sat Apr 18 20:37:41 2009
--- tree-ssa-propagate.c Sat Apr 18 17:53:34 2009
*************** simulate_block (basic_block block)
*** 449,458 ****
simulate_stmt (stmt);
}
! /* We can not predict when abnormal edges will be executed, so
once a block is considered executable, we consider any
outgoing abnormal edges as executable.
At the same time, if this block has only one successor that is
reached by non-abnormal edges, then add that successor to the
worklist. */
--- 449,462 ----
simulate_stmt (stmt);
}
! /* We can not predict when abnormal and EH edges will be executed, so
once a block is considered executable, we consider any
outgoing abnormal edges as executable.
+ TODO: This is not exactly true. Simplifying statement might
+ prove it non-throwing and also computed goto can be handled
+ when destination is known.
+
At the same time, if this block has only one successor that is
reached by non-abnormal edges, then add that successor to the
worklist. */
*************** simulate_block (basic_block block)
*** 460,466 ****
normal_edge = NULL;
FOR_EACH_EDGE (e, ei, block->succs)
{
! if (e->flags & EDGE_ABNORMAL)
add_control_edge (e);
else
{
--- 464,470 ----
normal_edge = NULL;
FOR_EACH_EDGE (e, ei, block->succs)
{
! if (e->flags & (EDGE_ABNORMAL | EDGE_EH))
add_control_edge (e);
else
{
*** /aux/hubicka/trunk-write/gcc/tree-inline.c Sat Apr 11 20:19:36 2009
--- tree-inline.c Sun Apr 12 00:22:48 2009
*************** update_ssa_across_abnormal_edges (basic_
*** 1608,1615 ****
gimple phi;
gimple_stmt_iterator si;
- gcc_assert (e->flags & EDGE_ABNORMAL);
-
if (!nonlocal_goto)
gcc_assert (e->flags & EDGE_EH);
--- 1882,1887 ----
*************** update_ssa_across_abnormal_edges (basic_
*** 1625,1631 ****
/* There shouldn't be any PHI nodes in the ENTRY_BLOCK. */
gcc_assert (!e->dest->aux);
! gcc_assert (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (PHI_RESULT (phi)));
if (!is_gimple_reg (PHI_RESULT (phi)))
{
--- 1897,1903 ----
/* There shouldn't be any PHI nodes in the ENTRY_BLOCK. */
gcc_assert (!e->dest->aux);
! gcc_assert ((e->flags & EDGE_EH) || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (PHI_RESULT (phi)));
if (!is_gimple_reg (PHI_RESULT (phi)))
{