From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25622 invoked by alias); 11 Jan 2012 15:14:11 -0000 Received: (qmail 25591 invoked by uid 22791); 11 Jan 2012 15:14:09 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 Jan 2012 15:13:57 +0000 From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug other/51165] gcc.dg/tm/memopt-3.c failure Date: Wed, 11 Jan 2012 15:14:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: other X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenther at suse dot de X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: aldyh at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-01/txt/msg01271.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51165 --- Comment #6 from 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 changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > CC| |rguenth at gcc dot gnu.org, > | |rth at gcc dot gnu.org > > --- Comment #5 from Aldy Hernandez 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.