Commit 18153f6c by Richard Henderson Committed by Richard Henderson

ifcvt.c (merge_if_block): Be prepared for JOIN to have no remaining edges.

        * ifcvt.c (merge_if_block): Be prepared for JOIN to have no
        remaining edges.
        (find_if_block): Allow THEN with no outgoing edges.
        * flow.c (merge_blocks_nomove): Remove a barrier not following
        a jump as well.

From-SVN: r34317
parent e0fa93b3
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
2000-05-31 Richard Henderson <rth@cygnus.com> 2000-05-31 Richard Henderson <rth@cygnus.com>
* ifcvt.c (merge_if_block): Be prepared for JOIN to have no
remaining edges.
(find_if_block): Allow THEN with no outgoing edges.
* flow.c (merge_blocks_nomove): Remove a barrier not following * flow.c (merge_blocks_nomove): Remove a barrier not following
a jump as well. a jump as well.
......
...@@ -1356,8 +1356,10 @@ merge_if_block (test_bb, then_bb, else_bb, join_bb) ...@@ -1356,8 +1356,10 @@ merge_if_block (test_bb, then_bb, else_bb, join_bb)
/* The JOIN block may have had quite a number of other predecessors too. /* The JOIN block may have had quite a number of other predecessors too.
Since we've already merged the TEST, THEN and ELSE blocks, we should Since we've already merged the TEST, THEN and ELSE blocks, we should
have only one remaining edge from our if-then-else diamond. If there have only one remaining edge from our if-then-else diamond. If there
is more than one remaining edge, it must come from elsewhere. */ is more than one remaining edge, it must come from elsewhere. There
else if (join_bb->pred->pred_next == NULL) may be zero incoming edges if the THEN block didn't actually join
back up (as with a call to abort). */
else if (join_bb->pred == NULL || join_bb->pred->pred_next == NULL)
{ {
/* We can merge the JOIN. */ /* We can merge the JOIN. */
if (combo_bb->global_live_at_end) if (combo_bb->global_live_at_end)
...@@ -1459,15 +1461,29 @@ find_if_block (test_bb, then_edge, else_edge) ...@@ -1459,15 +1461,29 @@ find_if_block (test_bb, then_edge, else_edge)
if (then_bb->pred->pred_next != NULL_EDGE) if (then_bb->pred->pred_next != NULL_EDGE)
return FALSE; return FALSE;
/* The THEN block of an IF-THEN combo must have exactly one successor. */ /* The THEN block of an IF-THEN combo must have zero or one successors. */
if (then_succ == NULL_EDGE if (then_succ != NULL_EDGE
|| then_succ->succ_next != NULL_EDGE && (then_succ->succ_next != NULL_EDGE
|| (then_succ->flags & EDGE_COMPLEX)) || (then_succ->flags & EDGE_COMPLEX)))
return FALSE; return FALSE;
/* If the THEN block has no successors, conditional execution can still
make a conditional call. Don't do this unless the ELSE block has
only one incoming edge -- the CFG manipulation is too ugly otherwise. */
if (then_succ == NULL)
{
if (else_bb->pred->pred_next == NULL_EDGE)
{
join_bb = else_bb;
else_bb = NULL_BLOCK;
}
else
return FALSE;
}
/* If the THEN block's successor is the other edge out of the TEST block, /* If the THEN block's successor is the other edge out of the TEST block,
then we have an IF-THEN combo without an ELSE. */ then we have an IF-THEN combo without an ELSE. */
if (then_succ->dest == else_bb) else if (then_succ->dest == else_bb)
{ {
join_bb = else_bb; join_bb = else_bb;
else_bb = NULL_BLOCK; else_bb = NULL_BLOCK;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment