diff mbox

PR other/51165: add new adress_escapes predicate

Message ID 4F144924.8030007@redhat.com
State New
Headers show

Commit Message

Aldy Hernandez Jan. 16, 2012, 3:58 p.m. UTC
> Not really - you handle both ptr and *ptr in the same predicate and
> call both "address escaped".  What I suggested was sth like

I think I confused myself and you by asking the wrong question in the 
first place.

Actually, what I want is to handle VAR_DECL correctly, and your original 
suggestion of using may_be_aliased() fits the bill.  The other calls to 
ptr_deref_may_alias_global_p() were fine because we have an SSA_NAME.

We're now down to a one-liner :).

How about this?  All TM memory optimization tests fixed, and no regressions.
PR other/51165
	* trans-mem.c (requires_barrier): Call may_be_aliased.
testsuite/
	PR other/51165
	* gcc.dg/tm/memopt-3.c: Remove xfail.
	* gcc.dg/tm/memopt-4.c: Remove xfail.
	* gcc.dg/tm/memopt-5.c: Remove xfail.
	* gcc.dg/tm/memopt-7.c: Remove xfail.

Comments

Richard Biener Jan. 17, 2012, 9:09 a.m. UTC | #1
On Mon, Jan 16, 2012 at 4:58 PM, Aldy Hernandez <aldyh@redhat.com> wrote:
>
>> Not really - you handle both ptr and *ptr in the same predicate and
>> call both "address escaped".  What I suggested was sth like
>
>
> I think I confused myself and you by asking the wrong question in the first
> place.
>
> Actually, what I want is to handle VAR_DECL correctly, and your original
> suggestion of using may_be_aliased() fits the bill.  The other calls to
> ptr_deref_may_alias_global_p() were fine because we have an SSA_NAME.
>
> We're now down to a one-liner :).
>
> How about this?  All TM memory optimization tests fixed, and no regressions.

Ok.  Note that may_be_aliased (x) is also true if x is an automatic variable
that has its address taken.  You can use is_global_var (x) instead if you
only want to test for "global memory".

Richard.
Aldy Hernandez Jan. 17, 2012, 1:20 p.m. UTC | #2
On 01/17/12 03:09, Richard Guenther wrote:
> On Mon, Jan 16, 2012 at 4:58 PM, Aldy Hernandez<aldyh@redhat.com>  wrote:
>>
>>> Not really - you handle both ptr and *ptr in the same predicate and
>>> call both "address escaped".  What I suggested was sth like
>>
>>
>> I think I confused myself and you by asking the wrong question in the first
>> place.
>>
>> Actually, what I want is to handle VAR_DECL correctly, and your original
>> suggestion of using may_be_aliased() fits the bill.  The other calls to
>> ptr_deref_may_alias_global_p() were fine because we have an SSA_NAME.
>>
>> We're now down to a one-liner :).
>>
>> How about this?  All TM memory optimization tests fixed, and no regressions.
>
> Ok.  Note that may_be_aliased (x) is also true if x is an automatic variable
> that has its address taken.  You can use is_global_var (x) instead if you
> only want to test for "global memory".
>
> Richard.

is_global_var is fine.  Thanks.

Committed.
diff mbox

Patch

Index: testsuite/gcc.dg/tm/memopt-3.c
===================================================================
--- testsuite/gcc.dg/tm/memopt-3.c	(revision 183072)
+++ testsuite/gcc.dg/tm/memopt-3.c	(working copy)
@@ -16,5 +16,5 @@  int f()
   return lala.x[0];
 }
 
-/* { dg-final { scan-tree-dump-times "logging: lala.x\\\[i_1\\\]" 1 "tmmark" { xfail *-*-* }  } } */
+/* { dg-final { scan-tree-dump-times "logging: lala.x\\\[i_1\\\]" 1 "tmmark" } } */
 /* { dg-final { cleanup-tree-dump "tmmark" } } */
Index: testsuite/gcc.dg/tm/memopt-5.c
===================================================================
--- testsuite/gcc.dg/tm/memopt-5.c	(revision 183072)
+++ testsuite/gcc.dg/tm/memopt-5.c	(working copy)
@@ -19,5 +19,5 @@  int f()
   return lala.x[i];
 }
 
-/* { dg-final { scan-tree-dump-times "ITM_LU\[0-9\] \\\(&lala.x\\\[55\\\]" 1 "tmedge" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "ITM_LU\[0-9\] \\\(&lala.x\\\[55\\\]" 1 "tmedge" } } */
 /* { dg-final { cleanup-tree-dump "tmedge" } } */
Index: testsuite/gcc.dg/tm/memopt-7.c
===================================================================
--- testsuite/gcc.dg/tm/memopt-7.c	(revision 183072)
+++ testsuite/gcc.dg/tm/memopt-7.c	(working copy)
@@ -17,6 +17,6 @@  int f()
   return lala.x[asdf];
 }
 
-/* { dg-final { scan-tree-dump-times "tm_save.\[0-9_\]+ = lala" 1 "tmedge" { xfail *-*-* } } } */
-/* { dg-final { scan-tree-dump-times "lala = tm_save" 1 "tmedge" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "tm_save.\[0-9_\]+ = lala" 1 "tmedge" } } */
+/* { dg-final { scan-tree-dump-times "lala = tm_save" 1 "tmedge" } } */
 /* { dg-final { cleanup-tree-dump "tmedge" } } */
Index: testsuite/gcc.dg/tm/memopt-4.c
===================================================================
--- testsuite/gcc.dg/tm/memopt-4.c	(revision 183072)
+++ testsuite/gcc.dg/tm/memopt-4.c	(working copy)
@@ -19,6 +19,6 @@  int f()
   return lala.x[i];
 }
 
-/* { dg-final { scan-tree-dump-times "tm_save.\[0-9_\]+ = lala.x\\\[55\\\]" 1 "tmedge" { xfail *-*-* } } } */
-/* { dg-final { scan-tree-dump-times "lala.x\\\[55\\\] = tm_save" 1 "tmedge" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "tm_save.\[0-9_\]+ = lala.x\\\[55\\\]" 1 "tmedge" } } */
+/* { dg-final { scan-tree-dump-times "lala.x\\\[55\\\] = tm_save" 1 "tmedge" } } */
 /* { dg-final { cleanup-tree-dump "tmedge" } } */
Index: trans-mem.c
===================================================================
--- trans-mem.c	(revision 183072)
+++ trans-mem.c	(working copy)
@@ -1498,7 +1498,7 @@  requires_barrier (basic_block entry_bloc
 	     lower_sequence_tm altogether.  */
 	  needs_to_live_in_memory (x)
 	  /* X escapes.  */
-	  || ptr_deref_may_alias_global_p (x))
+	  || may_be_aliased (x))
 	return true;
       else
 	{