Patchwork [trans-mem] do not propagate irr bit outside of a transaction

login
register
mail settings
Submitter Aldy Hernandez
Date Feb. 28, 2011, 7:42 p.m.
Message ID <4D6BFA8C.4050707@redhat.com>
Download mbox | patch
Permalink /patch/84861/
State New
Headers show

Comments

Aldy Hernandez - Feb. 28, 2011, 7:42 p.m.
In the attached testcase, the call to funcA() dominates the call to 
funcB(), even though funcB() is outside of the transaction.  The 
propagation logic doesn't currently verify that the dominated children 
are inside of a transaction.  Luckily, after Andrew's patch, we have a 
global bitmap with all the BB's in transaction.  I use this bitmap to 
make sure we don't propagate outside of a transaction.

OK for branch?
PR 47905
	* trans-mem.c (ipa_tm_propagate_irr): Do not propagate to blocks
	outside of a TM region.
Richard Henderson - Feb. 28, 2011, 10:36 p.m.
On 03/01/2011 05:42 AM, Aldy Hernandez wrote:
> 	PR 47905
> 	* trans-mem.c (ipa_tm_propagate_irr): Do not propagate to blocks
> 	outside of a TM region.

Ok.


r~

Patch

Index: testsuite/gcc.dg/tm/pr47905.c
===================================================================
--- testsuite/gcc.dg/tm/pr47905.c	(revision 0)
+++ testsuite/gcc.dg/tm/pr47905.c	(revision 0)
@@ -0,0 +1,14 @@ 
+/* { dg-do compile }
+   { dg-options "-fgnu-tm" } */
+
+void funcA();
+void funcB();
+
+void *thread()
+{
+        __transaction [[relaxed]]
+        {
+                funcA();
+        };
+        funcB();
+}
Index: trans-mem.c
===================================================================
--- trans-mem.c	(revision 170562)
+++ trans-mem.c	(working copy)
@@ -3752,8 +3752,10 @@  ipa_tm_propagate_irr (basic_block entry_
 	       son;
 	       son = next_dom_son (CDI_DOMINATORS, son))
 	    {
-	      /* Make sure a block isn't already in old_irr.  */
-	      if (!old_irr || !bitmap_bit_p (old_irr, son->index))
+	      /* Make sure block is actually in a TM region, and it
+		 isn't already in old_irr.  */
+	      if ((!old_irr || !bitmap_bit_p (old_irr, son->index))
+		  && bitmap_bit_p (bb_in_TM_region, son->index))
 		bitmap_set_bit (new_irr, son->index);
 	    }
 	}