Patchwork 0003-Improve-VBEout-computation.patch

login
register
mail settings
Submitter Maxim Kuvyrkov
Date June 23, 2010, 6:53 p.m.
Message ID <4C225847.1020900@codesourcery.com>
Download mbox | patch
Permalink /patch/56702/
State New
Headers show

Comments

Maxim Kuvyrkov - June 23, 2010, 6:53 p.m.
On 6/22/10 4:02 PM, Maxim Kuvyrkov wrote:
...
> I'll post another version of the patch in a couple of days when I finish
> reworking other pieces of improvements to hoisting.

Updated version.  OK to check in?

Thanks,
Maxim Kuvyrkov - June 29, 2010, 6:12 p.m.
On 6/23/10 10:53 PM, Maxim Kuvyrkov wrote:
> On 6/22/10 4:02 PM, Maxim Kuvyrkov wrote:
> ...
>> I'll post another version of the patch in a couple of days when I finish
>> reworking other pieces of improvements to hoisting.
>
> Updated version. OK to check in?

Ping?  Bootstrapped and regtested on {i686,x86_64,arm}-linux-gnu.

Thanks,
Jeff Law - June 30, 2010, 4:32 p.m.
On 06/29/10 12:12, Maxim Kuvyrkov wrote:
> On 6/23/10 10:53 PM, Maxim Kuvyrkov wrote:
>> On 6/22/10 4:02 PM, Maxim Kuvyrkov wrote:
>> ...
>>> I'll post another version of the patch in a couple of days when I 
>>> finish
>>> reworking other pieces of improvements to hoisting.
>>
>> Updated version. OK to check in?
>
> Ping?  Bootstrapped and regtested on {i686,x86_64,arm}-linux-gnu.
>
> Thanks,
>
OK.
Jeff

Patch

diff --git a/gcc/gcse.c b/gcc/gcse.c
index 103f0e0..22576ca 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -4171,8 +4171,16 @@  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);
+
+	      /* One of the quirks of code hoisting algorithm in Muchnick
+		 is that VBEout[BB] does not include expressions calculated
+		 in BB itself and available at its end.  Fix this.  */
+	      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],
@@ -4184,7 +4192,17 @@  compute_code_hoist_vbeinout (void)
     }
 
   if (dump_file)
-    fprintf (dump_file, "hoisting vbeinout computation: %d passes\n", passes);
+    {
+      fprintf (dump_file, "hoisting vbeinout computation: %d passes\n", passes);
+
+      FOR_EACH_BB (bb)
+        {
+	  fprintf (dump_file, "vbein (%d): ", bb->index);
+	  dump_sbitmap_file (dump_file, hoist_vbein[bb->index]);
+	  fprintf (dump_file, "vbeout(%d): ", bb->index);
+	  dump_sbitmap_file (dump_file, hoist_vbeout[bb->index]);
+	}
+    }
 }
 
 /* Top level routine to do the dataflow analysis needed by code hoisting.  */
@@ -4298,6 +4316,11 @@  hoist_code (void)
 	  if (TEST_BIT (hoist_vbeout[bb->index], i)
 	      && TEST_BIT (transpout[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.  */