On Wed, Jul 27, 2011 at 7:36 PM, Aldy Hernandez <al...@redhat.com> wrote: > >> Oh, and >> >> INNERDECL is the actual object being referenced. >> >> || (!ptr_deref_may_alias_global_p (innerdecl) >> >> is surely not what you want. That asks if *innerdecl is global memory. >> I suppose you want is_global_var (innerdecl)? But with >> >> && (DECL_THREAD_LOCAL_P (innerdecl) >> || !TREE_STATIC (innerdecl)))) >> >> you can simply skip this test. Or what was it supposed to do? > > The test was there because neither DECL_THREAD_LOCAL_P nor is_global_var can > handle MEM_REF's.
Ok, in that case you want (TREE_CODE (innerdecl) == MEM_REF || TREE_CODE (innerdecl) == TARGET_MEM_REF) && !ptr_deref_may_alias_global_p (TREE_OPERAND (innerdecl, 0))) which gets you at the actual pointer. > Would you prefer an explicit check for a *_DECL? > > if (ALLOW_STORE_DATA_RACES > - || (!ptr_deref_may_alias_global_p (innerdecl) > + || (DECL_P (innerdecl) > && (DECL_THREAD_LOCAL_P (innerdecl) > || !TREE_STATIC (innerdecl)))) Yes. Together with the above it looks then optimal. Richard.