Commit 78b6731d by Kazu Hirata Committed by Kazu Hirata

tree-cfg.c (tree_forwarder_block_p): Don't set forwardable.

	* tree-cfg.c (tree_forwarder_block_p): Don't set forwardable.
	(thread_jumps): Use forwardable as cache of
	tree_forwarder_block_p throughout the function.

From-SVN: r89243
parent 320b0f6a
2004-10-18 Kazu Hirata <kazu@cs.umass.edu>
* tree-cfg.c (tree_forwarder_block_p): Don't set forwardable.
(thread_jumps): Use forwardable as cache of
tree_forwarder_block_p throughout the function.
2004-10-18 Andreas Krebbel <krebbel1@de.ibm.com> 2004-10-18 Andreas Krebbel <krebbel1@de.ibm.com>
* cfg.c (dump_flow_info): Remove redundant dump of reg life info. * cfg.c (dump_flow_info): Remove redundant dump of reg life info.
......
...@@ -3720,11 +3720,6 @@ tree_forwarder_block_p (basic_block bb) ...@@ -3720,11 +3720,6 @@ tree_forwarder_block_p (basic_block bb)
edge e; edge e;
edge_iterator ei; edge_iterator ei;
/* If we have already determined that this block is not forwardable,
then no further checks are necessary. */
if (! bb_ann (bb)->forwardable)
return false;
/* BB must have a single outgoing edge. */ /* BB must have a single outgoing edge. */
if (EDGE_COUNT (bb->succs) != 1 if (EDGE_COUNT (bb->succs) != 1
/* BB can not have any PHI nodes. This could potentially be /* BB can not have any PHI nodes. This could potentially be
...@@ -3735,10 +3730,7 @@ tree_forwarder_block_p (basic_block bb) ...@@ -3735,10 +3730,7 @@ tree_forwarder_block_p (basic_block bb)
|| EDGE_SUCC (bb, 0)->dest == EXIT_BLOCK_PTR || EDGE_SUCC (bb, 0)->dest == EXIT_BLOCK_PTR
/* BB may not have an abnormal outgoing edge. */ /* BB may not have an abnormal outgoing edge. */
|| (EDGE_SUCC (bb, 0)->flags & EDGE_ABNORMAL)) || (EDGE_SUCC (bb, 0)->flags & EDGE_ABNORMAL))
{ return false;
bb_ann (bb)->forwardable = 0;
return false;
}
#if ENABLE_CHECKING #if ENABLE_CHECKING
gcc_assert (bb != ENTRY_BLOCK_PTR); gcc_assert (bb != ENTRY_BLOCK_PTR);
...@@ -3747,10 +3739,7 @@ tree_forwarder_block_p (basic_block bb) ...@@ -3747,10 +3739,7 @@ tree_forwarder_block_p (basic_block bb)
/* Successors of the entry block are not forwarders. */ /* Successors of the entry block are not forwarders. */
FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR->succs) FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR->succs)
if (e->dest == bb) if (e->dest == bb)
{ return false;
bb_ann (bb)->forwardable = 0;
return false;
}
/* Now walk through the statements. We can ignore labels, anything else /* Now walk through the statements. We can ignore labels, anything else
means this is not a forwarder block. */ means this is not a forwarder block. */
...@@ -3766,7 +3755,6 @@ tree_forwarder_block_p (basic_block bb) ...@@ -3766,7 +3755,6 @@ tree_forwarder_block_p (basic_block bb)
break; break;
default: default:
bb_ann (bb)->forwardable = 0;
return false; return false;
} }
} }
...@@ -3794,21 +3782,17 @@ thread_jumps (void) ...@@ -3794,21 +3782,17 @@ thread_jumps (void)
bool retval = false; bool retval = false;
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
bb_ann (bb)->forwardable = 1; bb_ann (bb)->forwardable = tree_forwarder_block_p (bb);
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
{ {
edge_iterator ei; edge_iterator ei;
bool this_jump_threaded = false;
/* Don't waste time on forwarders. */ /* Don't waste time on forwarders. */
if (tree_forwarder_block_p (bb)) if (bb_ann (bb)->forwardable)
continue; continue;
/* This block is now part of a forwarding path, mark it as not
forwardable so that we can detect loops. This bit will be
reset below. */
bb_ann (bb)->forwardable = 0;
/* Examine each of our block's successors to see if it is /* Examine each of our block's successors to see if it is
forwardable. */ forwardable. */
for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); ) for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
...@@ -3819,7 +3803,7 @@ thread_jumps (void) ...@@ -3819,7 +3803,7 @@ thread_jumps (void)
/* If the edge is abnormal or its destination is not /* If the edge is abnormal or its destination is not
forwardable, then there's nothing to do. */ forwardable, then there's nothing to do. */
if ((e->flags & EDGE_ABNORMAL) if ((e->flags & EDGE_ABNORMAL)
|| !tree_forwarder_block_p (e->dest)) || !bb_ann (e->dest)->forwardable)
{ {
ei_next (&ei); ei_next (&ei);
continue; continue;
...@@ -3834,7 +3818,7 @@ thread_jumps (void) ...@@ -3834,7 +3818,7 @@ thread_jumps (void)
last = EDGE_SUCC (e->dest, 0); last = EDGE_SUCC (e->dest, 0);
bb_ann (e->dest)->forwardable = 0; bb_ann (e->dest)->forwardable = 0;
for (dest = EDGE_SUCC (e->dest, 0)->dest; for (dest = EDGE_SUCC (e->dest, 0)->dest;
tree_forwarder_block_p (dest); bb_ann (dest)->forwardable;
last = EDGE_SUCC (dest, 0), last = EDGE_SUCC (dest, 0),
dest = EDGE_SUCC (dest, 0)->dest) dest = EDGE_SUCC (dest, 0)->dest)
bb_ann (dest)->forwardable = 0; bb_ann (dest)->forwardable = 0;
...@@ -3875,7 +3859,7 @@ thread_jumps (void) ...@@ -3875,7 +3859,7 @@ thread_jumps (void)
} }
/* Perform the redirection. */ /* Perform the redirection. */
retval = true; retval = this_jump_threaded = true;
old_dest = e->dest; old_dest = e->dest;
e = redirect_edge_and_branch (e, dest); e = redirect_edge_and_branch (e, dest);
...@@ -3955,9 +3939,13 @@ thread_jumps (void) ...@@ -3955,9 +3939,13 @@ thread_jumps (void)
} }
} }
/* Reset the forwardable bit on our block since it's no longer in /* If we succeeded in threading a jump at BB, update the
a forwarding chain path. */ forwardable mark as BB may have become a new forwarder block.
bb_ann (bb)->forwardable = 1; This could happen if we have a useless "if" statement whose
two arms eventually merge without any intervening
statements. */
if (this_jump_threaded && tree_forwarder_block_p (bb))
bb_ann (bb)->forwardable = true;
} }
return retval; return retval;
......
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