]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/40956 (Constants are never candidates for hoisting)
authorMaxim Kuvyrkov <maxim@codesourcery.com>
Tue, 27 Jul 2010 19:34:55 +0000 (19:34 +0000)
committerMaxim Kuvyrkov <mkuvyrkov@gcc.gnu.org>
Tue, 27 Jul 2010 19:34:55 +0000 (19:34 +0000)
PR rtl-optimization/40956
PR target/42495
PR middle-end/42574
* gcse.c (compute_code_hoist_vbeinout): Consider more expressions
for hoisting.
(hoist_code): Count occurences in current block too.

From-SVN: r162590

gcc/ChangeLog
gcc/gcse.c

index 0861109ab2d2f099866435e1793c5b8b9ba36f3a..d39fbfca76f1f7cdd41c278a5e8817a7a48e9547 100644 (file)
@@ -1,3 +1,12 @@
+2010-07-27  Maxim Kuvyrkov  <maxim@codesourcery.com>
+
+       PR rtl-optimization/40956
+       PR target/42495
+       PR middle-end/42574
+       * gcse.c (compute_code_hoist_vbeinout): Consider more expressions
+       for hoisting.
+       (hoist_code): Count occurences in current block too.
+
 2010-07-27  Maxim Kuvyrkov  <maxim@codesourcery.com>
 
        * gcse.c (struct expr:max_distance): New field.
index 9b44083fccd57ab9df954aa16cd0554eebbd419d..4b2547c33670d1db8dc374d12edab884c88ed33a 100644 (file)
@@ -4247,8 +4247,15 @@ compute_code_hoist_vbeinout (void)
       FOR_EACH_BB_REVERSE (bb)
        {
          if (bb->next_bb != EXIT_BLOCK_PTR)
-           sbitmap_intersection_of_succs (hoist_vbeout[bb->index],
-                                          hoist_vbein, bb->index);
+           {
+             sbitmap_intersection_of_succs (hoist_vbeout[bb->index],
+                                            hoist_vbein, bb->index);
+
+             /* Include expressions in VBEout that are calculated
+                in BB and available at its end.  */
+             sbitmap_a_or_b (hoist_vbeout[bb->index],
+                             hoist_vbeout[bb->index], comp[bb->index]);
+           }
 
          changed |= sbitmap_a_or_b_and_c_cg (hoist_vbein[bb->index],
                                              antloc[bb->index],
@@ -4430,6 +4437,11 @@ hoist_code (void)
 
          if (TEST_BIT (hoist_vbeout[bb->index], i))
            {
+             /* If an expression is computed in BB and is available at end of
+                BB, hoist all occurences dominated by BB to BB.  */
+             if (TEST_BIT (comp[bb->index], i))
+               hoistable++;
+
              /* We've found a potentially hoistable expression, now
                 we look at every block BB dominates to see if it
                 computes the expression.  */