On Mon, Jan 16, 2012 at 3:29 PM, Aldy Hernandez <al...@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.