diff options
author | aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-10-01 20:39:03 +0000 |
---|---|---|
committer | aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-10-01 20:39:03 +0000 |
commit | 5add5f91420fb55b50b15960dddb0c89534681df (patch) | |
tree | faf137062ea3b3b6b77309be6a95bf0b938014ea | |
parent | 800c7017973bde64af30dc7bf500f11281cd035f (diff) | |
download | gcc-5add5f91420fb55b50b15960dddb0c89534681df.tar.gz |
* tree-ssa-sink.c (sink_code_in_bb): Don't stop sinking after
sinking the last stmt in a BB.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128913 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/tree-ssa-sink.c | 15 |
2 files changed, 20 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3c6aa3d0390..45344244cce 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 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 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. diff --git a/gcc/tree-ssa-sink.c b/gcc/tree-ssa-sink.c index b70d082ba99..cd57baa0d99 100644 --- a/gcc/tree-ssa-sink.c +++ b/gcc/tree-ssa-sink.c @@ -433,6 +433,7 @@ sink_code_in_bb (basic_block bb) block_stmt_iterator bsi; edge_iterator ei; edge e; + bool last = true; /* If this block doesn't dominate anything, there can't be any place to sink the statements to. */ @@ -454,6 +455,7 @@ sink_code_in_bb (basic_block bb) { if (!bsi_end_p (bsi)) bsi_prev (&bsi); + last = false; continue; } if (dump_file) @@ -472,6 +474,19 @@ sink_code_in_bb (basic_block bb) bsi_move_before (&bsi, &tobsi); 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)) bsi_prev (&bsi); |