http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51165

--- Comment #6 from rguenther at suse dot de <rguenther at suse dot de> 
2012-01-11 15:13:39 UTC ---
On Wed, 11 Jan 2012, aldyh at gcc dot gnu.org wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51165
> 
> Aldy Hernandez <aldyh at gcc dot gnu.org> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |rguenth at gcc dot gnu.org,
>                    |                            |rth at gcc dot gnu.org
> 
> --- Comment #5 from Aldy Hernandez <aldyh at gcc dot gnu.org> 2012-01-11 
> 15:07:15 UTC ---
> The main problem here is that we are using ptr_deref_may_alias_global_p() to
> determine if a dereferenced address escapes whereas we were previously using
> is_call_clobbered() which understood VAR_DECLs, not just SSA_NAMEs.
> 
> In requires_barrier() we call ptr_deref_may_alias_global_p() to determine if
> the address of `lala' below will escape:
> 
> struct large { int x[100]; };
> extern struct large foobie (void) __attribute__((transaction_safe));
> int asdf;
> 
> int f()
> { 
>   struct large lala;
>   struct large lacopy = foobie();
>   __transaction_atomic {
>     lala = lacopy;   <-- STORE SHOULD BE TRXN/THREAD LOCAL
>   }
>   return lala.x[asdf];
> }
> 
> Before the fix to PR tree-optimization/43572, we used is_call_clobbered() 
> which
> returned false for `lala', and everything worked fine.  However, we are now
> using ptr_deref_may_alias_global_p() which only understands SSA_NAMEs, and
> `lala' is a VAR_DECL.
> 
> Mr. Guenther (or Mr. Henderson), what is the recommended course of action 
> here?

If you want to check whether something possibly escaped you can
use may_be_aliased (get_base_address (xxxx)) and if xxx is always
a VAR_DECL you can omit get_base_address.  If get_base_addres (xxxx)
returns a MEM_REF you can refine the result by calling
ptr_deref_may_alias_global_p on its operand 0 (the pointer to the object).
There is no existing predicate that would answer whether a tree
accesses possibly 'escaped' memory (yet).  If you write one,
stick it into tree-ssa-alias.c.

Richard.

Reply via email to