From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12967 invoked by alias); 17 Oct 2012 21:07:10 -0000 Received: (qmail 12955 invoked by uid 22791); 17 Oct 2012 21:07:10 -0000 X-SWARE-Spam-Status: No, hits=-7.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 17 Oct 2012 21:07:05 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9HL73DF010891 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 17 Oct 2012 17:07:04 -0400 Received: from reynosa.quesejoda.com (vpn-9-56.rdu.redhat.com [10.11.9.56]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q9HL714q027432; Wed, 17 Oct 2012 17:07:02 -0400 Message-ID: <507F1DF5.6000006@redhat.com> Date: Wed, 17 Oct 2012 21:48:00 -0000 From: Aldy Hernandez User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1 MIME-Version: 1.0 To: Jeff Law CC: Richard Henderson , Ian Lance Taylor , gcc-patches , Richard Guenther , Ian Lance Taylor , Jakub Jelinek , Andrew MacLeod Subject: Re: [path] PR 54900: store data race in if-conversion pass References: <507C015F.2090508@redhat.com> <507DF364.2010208@redhat.com> <507E0F25.8010605@redhat.com> <507E2424.7070707@redhat.com> In-Reply-To: <507E2424.7070707@redhat.com> Content-Type: multipart/mixed; boundary="------------010605020607080203070105" Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2012-10/txt/msg01676.txt.bz2 This is a multi-part message in MIME format. --------------010605020607080203070105 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 644 On 10/16/12 23:21, Jeff Law wrote: > On 10/16/2012 07:51 PM, Richard Henderson wrote: >> On 2012-10-17 09:53, Aldy Hernandez wrote: >>> +/* Like memory_modified_in_insn_p, but return TRUE if INSN will >>> + *SURELY* modify the memory contents of MEM. */ >>> +bool >>> +memory_surely_modified_in_insn_p (const_rtx mem, const_rtx insn) >> >> I don't like the word "surely". Are we certain or not? >> >> It's longer, but perhaps "definitely" or "must_be"? > I'd go with "must_be" or something similar. "must" is pretty common > terminology when talking about aliasing properties. > > jeff must_be it is. Committed the patch below. Thanks. --------------010605020607080203070105 Content-Type: text/plain; charset=us-ascii; name="curr" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="curr" Content-length: 2409 PR rtl-optimization/54900 * ifcvt.c (noce_can_store_speculate_p): Call memory_must_be_modified_in_insn_p. * alias.c (memory_must_be_modified_in_insn_p): New. (set_dest_equal_p): New. * rtl.h (memory_must_be_modified_in_p): Protoize. diff --git a/gcc/alias.c b/gcc/alias.c index 244ca52..c5e6417 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -2762,6 +2762,39 @@ memory_modified_in_insn_p (const_rtx mem, const_rtx insn) return memory_modified; } +/* Return TRUE if the destination of a set is rtx identical to + ITEM. */ +static inline bool +set_dest_equal_p (const_rtx set, const_rtx item) +{ + rtx dest = SET_DEST (set); + return rtx_equal_p (dest, item); +} + +/* Like memory_modified_in_insn_p, but return TRUE if INSN will + *DEFINITELY* modify the memory contents of MEM. */ +bool +memory_must_be_modified_in_insn_p (const_rtx mem, const_rtx insn) +{ + if (!INSN_P (insn)) + return false; + insn = PATTERN (insn); + if (GET_CODE (insn) == SET) + return set_dest_equal_p (insn, mem); + else if (GET_CODE (insn) == PARALLEL) + { + int i; + for (i = 0; i < XVECLEN (insn, 0); i++) + { + rtx sub = XVECEXP (insn, 0, i); + if (GET_CODE (sub) == SET + && set_dest_equal_p (sub, mem)) + return true; + } + } + return false; +} + /* Initialize the aliasing machinery. Initialize the REG_KNOWN_VALUE array. */ diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index 2f486a2..5654c66 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -2415,7 +2415,7 @@ noce_can_store_speculate_p (basic_block top_bb, const_rtx mem) || (CALL_P (insn) && (!RTL_CONST_CALL_P (insn))))) return false; - if (memory_modified_in_insn_p (mem, insn)) + if (memory_must_be_modified_in_insn_p (mem, insn)) return true; if (modified_in_p (XEXP (mem, 0), insn)) return false; diff --git a/gcc/rtl.h b/gcc/rtl.h index eeeb6ba..09f1e77 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -2616,6 +2616,7 @@ extern void init_alias_analysis (void); extern void end_alias_analysis (void); extern void vt_equate_reg_base_value (const_rtx, const_rtx); extern bool memory_modified_in_insn_p (const_rtx, const_rtx); +extern bool memory_must_be_modified_in_insn_p (const_rtx, const_rtx); extern bool may_be_sp_based_p (rtx); extern rtx gen_hard_reg_clobber (enum machine_mode, unsigned int); extern rtx get_reg_known_value (unsigned int); --------------010605020607080203070105--