This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR other/51165: add new adress_escapes predicate
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Aldy Hernandez <aldyh at redhat dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 16 Jan 2012 15:42:02 +0100
- Subject: Re: PR other/51165: add new adress_escapes predicate
- References: <4F14342D.8080400@redhat.com>
On Mon, Jan 16, 2012 at 3:29 PM, Aldy Hernandez <aldyh@redhat.com> wrote:
> As discussed in the PR, the 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 the now non existent
> is_call_clobbered. ?The function ptr_deref_may_alias_global_p() does not
> understand SSA_NAMEs, whereas is_call_clobbered did.
>
> Richi suggested using may_be_aliased() for DECLs.
>
> The patch below abstracts an address_escapes_p() predicate for more generic
> use into the aliasing code. ?Using this instead of
> ptr_deref_may_alias_global_p() fixes all 4 TM memory optimization
> regressions. ?TM logging is now back in business.
>
> Is this what you had in mind? ?OK for trunk?
Not really - you handle both ptr and *ptr in the same predicate and
call both "address escaped". What I suggested was sth like
/* Return true, if the memory access X may alias with a global variable. */
bool
access_may_refer_to_global_p (tree x)
{
x = get_base_address (x);
if (DECL_P (x))
return is_global_var (x);
else if (TREE_CODE (x) == MEM_REF
|| TREE_CODE (x) == TARGET_MEM_REF)
return ptr_deref_may_alias_global_p (TREE_OPERAND (x, 0));
return true;
}
Richard.