Commit 9a287593 by Alexandre Oliva Committed by Alexandre Oliva

tree-ssa-sink.c (sink_code_in_bb): Don't stop sinking after sinking the last stmt in a BB.

* tree-ssa-sink.c (sink_code_in_bb): Don't stop sinking after
sinking the last stmt in a BB.

From-SVN: r128913
parent a64036a7
2007-10-01 Alexandre Oliva <aoliva@redhat.com> 2007-10-01 Alexandre Oliva <aoliva@redhat.com>
* tree-ssa-sink.c (sink_code_in_bb): Don't stop sinking after
sinking the last stmt in a BB.
2007-10-01 Alexandre Oliva <aoliva@redhat.com>
PR middle-end/22156 PR middle-end/22156
* tree-sra.c (struct sra_elt): Add in_bitfld_block. * tree-sra.c (struct sra_elt): Add in_bitfld_block.
(sra_hash_tree): Handle BIT_FIELD_REFs. (sra_hash_tree): Handle BIT_FIELD_REFs.
...@@ -433,6 +433,7 @@ sink_code_in_bb (basic_block bb) ...@@ -433,6 +433,7 @@ sink_code_in_bb (basic_block bb)
block_stmt_iterator bsi; block_stmt_iterator bsi;
edge_iterator ei; edge_iterator ei;
edge e; edge e;
bool last = true;
/* If this block doesn't dominate anything, there can't be any place to sink /* If this block doesn't dominate anything, there can't be any place to sink
the statements to. */ the statements to. */
...@@ -454,6 +455,7 @@ sink_code_in_bb (basic_block bb) ...@@ -454,6 +455,7 @@ sink_code_in_bb (basic_block bb)
{ {
if (!bsi_end_p (bsi)) if (!bsi_end_p (bsi))
bsi_prev (&bsi); bsi_prev (&bsi);
last = false;
continue; continue;
} }
if (dump_file) if (dump_file)
...@@ -472,6 +474,19 @@ sink_code_in_bb (basic_block bb) ...@@ -472,6 +474,19 @@ sink_code_in_bb (basic_block bb)
bsi_move_before (&bsi, &tobsi); bsi_move_before (&bsi, &tobsi);
sink_stats.sunk++; sink_stats.sunk++;
/* If we've just removed the last statement of the BB, the
bsi_end_p() test below would fail, but bsi_prev() would have
succeeded, and we want it to succeed. So we keep track of
whether we're at the last statement and pick up the new last
statement. */
if (last)
{
bsi = bsi_last (bb);
continue;
}
last = false;
if (!bsi_end_p (bsi)) if (!bsi_end_p (bsi))
bsi_prev (&bsi); bsi_prev (&bsi);
......
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