From patchwork Thu Sep 22 12:20:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bingfeng Mei X-Patchwork-Id: 115940 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 9E0C5B6F7B for ; Thu, 22 Sep 2011 22:20:45 +1000 (EST) Received: (qmail 17010 invoked by alias); 22 Sep 2011 12:20:41 -0000 Received: (qmail 17002 invoked by uid 22791); 22 Sep 2011 12:20:38 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mms2.broadcom.com (HELO mms2.broadcom.com) (216.31.210.18) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 22 Sep 2011 12:20:24 +0000 Received: from [10.16.192.224] by mms2.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.3.2)); Thu, 22 Sep 2011 05:26:23 -0700 X-Server-Uuid: D3C04415-6FA8-4F2C-93C1-920E106A2031 Received: from SJEXCHCCR02.corp.ad.broadcom.com ([10.16.192.130]) by SJEXCHHUB01.corp.ad.broadcom.com ([10.16.192.224]) with mapi; Thu, 22 Sep 2011 05:20:07 -0700 From: "Bingfeng Mei" To: "Richard Henderson" cc: "gcc-patches@gcc.gnu.org" , "Ulrich Weigand" Date: Thu, 22 Sep 2011 05:20:03 -0700 Subject: RE: [PATCH] derive alias information from named address spaces. Message-ID: <7FB04A5C213E9943A72EE127DB74F0ADD15FD2F4A6@SJEXCHCCR02.corp.ad.broadcom.com> References: <7FB04A5C213E9943A72EE127DB74F0ADD15FCB0658@SJEXCHCCR02.corp.ad.broadcom.com> <4E78BC03.4080103@redhat.com> In-Reply-To: <4E78BC03.4080103@redhat.com> MIME-Version: 1.0 X-IsSubscribed: yes 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 Hello, Here is the updated patch. OK now? Thanks, Bingfeng 2011-09-22 Bingfeng Mei * alias.c (mems_in_disjoint_address_spaces_p) New function. (nonoverlapping_memrefs_p): Use mems_in_disjoint_address_sapces_p to derive alias information. (nonoverlapping_memrefs_p): ditto. (write_dependence_p): ditto. (write_dependence_p): ditto. > -----Original Message----- > From: Richard Henderson [mailto:rth@redhat.com] > Sent: 20 September 2011 17:15 > To: Bingfeng Mei > Cc: gcc-patches@gcc.gnu.org; Ulrich Weigand > Subject: Re: [PATCH] derive alias information from named address spaces. > > On 09/20/2011 01:46 AM, Bingfeng Mei wrote: > > if (MEM_P (rtlx) && MEM_P (rtly) > > && MEM_ADDR_SPACE (rtlx) != MEM_ADDR_SPACE (rtly)) > > - return 0; > > + { > > + if (!targetm.addr_space.subset_p (MEM_ADDR_SPACE (rtlx), > > + MEM_ADDR_SPACE (rtly)) > > + && !targetm.addr_space.subset_p (MEM_ADDR_SPACE (rtly), > > + MEM_ADDR_SPACE (rtlx))) > > + return 1; > > + else > > + return 0; > > + } > > You have 4 copies of this. Please pull it out into > a new predicate function. > > > r~ Index: alias.c =================================================================== --- alias.c (revision 178972) +++ alias.c (working copy) @@ -155,6 +155,7 @@ static int base_alias_check (rtx, rtx, e enum machine_mode); static rtx find_base_value (rtx); static int mems_in_disjoint_alias_sets_p (const_rtx, const_rtx); +static int mems_in_disjoint_address_spaces_p (const_rtx, const_rtx); static int insert_subset_children (splay_tree_node, void*); static alias_set_entry get_alias_set_entry (alias_set_type); static const_rtx fixed_scalar_and_varying_struct_p (const_rtx, const_rtx, rtx, rtx, @@ -400,6 +401,17 @@ mems_in_disjoint_alias_sets_p (const_rtx return ! alias_sets_conflict_p (MEM_ALIAS_SET (mem1), MEM_ALIAS_SET (mem2)); } +/* Return nonzero if the address spaces for MEM1 and MEM2 are disjoint */ +static inline int +mems_in_disjoint_address_spaces_p (const_rtx mem1, const_rtx mem2) +{ + + return (!targetm.addr_space.subset_p (MEM_ADDR_SPACE (mem1), + MEM_ADDR_SPACE (mem2)) + && !targetm.addr_space.subset_p (MEM_ADDR_SPACE (mem2), + MEM_ADDR_SPACE (mem1))); +} + /* Insert the NODE into the splay tree given by DATA. Used by record_alias_subset via splay_tree_foreach. */ @@ -2306,11 +2318,11 @@ nonoverlapping_memrefs_p (const_rtx x, c return 1; /* If we have MEMs refering to different address spaces (which can - potentially overlap), we cannot easily tell from the addresses - whether the references overlap. */ + potentially overlap), they are not aliased if neither is subset + of the other one. */ if (MEM_P (rtlx) && MEM_P (rtly) && MEM_ADDR_SPACE (rtlx) != MEM_ADDR_SPACE (rtly)) - return 0; + return mems_in_disjoint_address_spaces_p (rtlx, rtly); /* Get the base and offsets of both decls. If either is a register, we know both are and are the same, so use that as the base. The only @@ -2417,10 +2429,10 @@ true_dependence_1 (const_rtx mem, enum m return 0; /* If we have MEMs refering to different address spaces (which can - potentially overlap), we cannot easily tell from the addresses - whether the references overlap. */ + potentially overlap), they are not aliased if neither is subset + of the other one. */ if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x)) - return 1; + return (!mems_in_disjoint_address_spaces_p (mem, x)); if (! mem_addr) { @@ -2542,10 +2554,10 @@ write_dependence_p (const_rtx mem, const return 0; /* If we have MEMs refering to different address spaces (which can - potentially overlap), we cannot easily tell from the addresses - whether the references overlap. */ + potentially overlap), they are not aliased if neither is subset + of the other one. */ if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x)) - return 1; + return (!mems_in_disjoint_address_spaces_p (mem, x)); x_addr = XEXP (x, 0); mem_addr = XEXP (mem, 0); @@ -2637,10 +2649,10 @@ may_alias_p (const_rtx mem, const_rtx x) return 0; /* If we have MEMs refering to different address spaces (which can - potentially overlap), we cannot easily tell from the addresses - whether the references overlap. */ + potentially overlap), they are not aliased if neither is subset + of the other one. */ if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x)) - return 1; + return (!mems_in_disjoint_address_spaces_p (mem, x)); x_addr = XEXP (x, 0); mem_addr = XEXP (mem, 0);