From patchwork Thu Jul 28 19:12:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 107373 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 183B5B6F64 for ; Fri, 29 Jul 2011 21:54:39 +1000 (EST) Received: (qmail 743 invoked by alias); 29 Jul 2011 11:54:37 -0000 Received: (qmail 735 invoked by uid 22791); 29 Jul 2011 11:54:37 -0000 X-SWARE-Spam-Status: No, hits=-3.8 required=5.0 tests=AWL,BAYES_00,SPF_FAIL X-Spam-Check-By: sourceware.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (140.186.70.92) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 29 Jul 2011 11:54:22 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QmW0j-0004Ab-7X for gcc-patches@gcc.gnu.org; Thu, 28 Jul 2011 15:12:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49005) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QmW0i-0004A9-WF for gcc-patches@gcc.gnu.org; Thu, 28 Jul 2011 15:12:45 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6SJCSCU003379 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 28 Jul 2011 15:12:28 -0400 Received: from houston.quesejoda.com (vpn-227-112.phx2.redhat.com [10.3.227.112]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p6SJCRwr029746; Thu, 28 Jul 2011 15:12:27 -0400 Message-ID: <4E31B49B.9010704@redhat.com> Date: Thu, 28 Jul 2011 14:12:27 -0500 From: Aldy Hernandez User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110707 Thunderbird/5.0 MIME-Version: 1.0 To: Richard Guenther CC: Jason Merrill , Jeff Law , gcc-patches , Jakub Jelinek Subject: Re: [C++0x] contiguous bitfields race implementation References: <4DC8155A.3040401@redhat.com> <4DC82136.6030802@redhat.com> <4DC83549.8010709@redhat.com> <4DC83F49.5020101@redhat.com> <4DCD8412.9020005@redhat.com> <4DD440EA.2080500@redhat.com> <4DD5AA47.4000902@redhat.com> <4DDE8CE6.40203@redhat.com> <4DDE9040.8000807@redhat.com> <4DDE99D2.4020502@redhat.com> <4DDE9DED.6040801@redhat.com> <4DDFF90E.7070408@redhat.com> <4E2420E6.8090809@redhat.com> <4E29C502.8020100@redhat.com> <4E2DA2BA.1010003@redhat.com> <4E2E0264.30909@redhat.com> <4E2EED10.5030901@redhat.com> <4E2EF1E7.4020606@redhat.com> <4E2EFA1C.10803@redhat.com> <4E2EFB89.7060503@redhat.com> <4E304C87.9090609@redhat.com> In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org > Yes. Together with the above it looks then optimal. Attached patch tested on x86-64 Linux. OK for mainline? * expr.c (get_bit_range): Handle *MEM_REF's. Index: expr.c =================================================================== --- expr.c (revision 176824) +++ expr.c (working copy) @@ -4158,7 +4158,10 @@ get_bit_range (unsigned HOST_WIDE_INT *b /* If other threads can't see this value, no need to restrict stores. */ if (ALLOW_STORE_DATA_RACES - || (!ptr_deref_may_alias_global_p (innerdecl) + || ((TREE_CODE (innerdecl) == MEM_REF || + TREE_CODE (innerdecl) == TARGET_MEM_REF) + && !ptr_deref_may_alias_global_p (TREE_OPERAND (innerdecl, 0))) + || (DECL_P (innerdecl) && (DECL_THREAD_LOCAL_P (innerdecl) || !TREE_STATIC (innerdecl)))) {