]> gcc.gnu.org Git - gcc.git/commitdiff
tree-ssa-sink.c (sink_code_in_bb): Don't stop sinking after sinking the last stmt...
authorAlexandre Oliva <aoliva@redhat.com>
Mon, 1 Oct 2007 20:39:03 +0000 (20:39 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Mon, 1 Oct 2007 20:39:03 +0000 (20:39 +0000)
* tree-ssa-sink.c (sink_code_in_bb): Don't stop sinking after
sinking the last stmt in a BB.

From-SVN: r128913

gcc/ChangeLog
gcc/tree-ssa-sink.c

index 3c6aa3d0390bf647cc66fb58bce2aa7ffbce690b..45344244cce7c56b02e60d9286989876342024cd 100644 (file)
@@ -1,3 +1,8 @@
+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
index b70d082ba990f777e4b131bac316eead0a13ec09..cd57baa0d99b8c03113df3bb2e7f33ee1e23a252 100644 (file)
@@ -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);
       
This page took 0.505722 seconds and 5 git commands to generate.