From patchwork Wed Mar 9 09:58:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 86095 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 357601007EF for ; Wed, 9 Mar 2011 20:59:00 +1100 (EST) Received: (qmail 15036 invoked by alias); 9 Mar 2011 09:58:58 -0000 Received: (qmail 15024 invoked by uid 22791); 9 Mar 2011 09:58:57 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD 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, 09 Mar 2011 09:58:48 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p299wPjQ002071 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 9 Mar 2011 04:58:25 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p299wO4J021716 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 9 Mar 2011 04:58:25 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (localhost.localdomain [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id p299wOY0023497; Wed, 9 Mar 2011 10:58:24 +0100 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id p299wMpi023495; Wed, 9 Mar 2011 10:58:22 +0100 Date: Wed, 9 Mar 2011 10:58:22 +0100 From: Jakub Jelinek To: Richard Guenther Cc: Eric Botcazou , gcc-patches@gcc.gnu.org, Jeff Law , Mark Mitchell Subject: Re: [PATCH] Fix MEM_IN_STRUCT_P/MEM_SCALAR_P during expansion (PR rtl-optimization/47866) Message-ID: <20110309095822.GM30899@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek References: <20110308221606.GL30899@tyan-ft48-01.lab.bos.redhat.com> <201103090940.14542.ebotcazou@adacore.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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 On Wed, Mar 09, 2011 at 10:55:39AM +0100, Richard Guenther wrote: > On Wed, Mar 9, 2011 at 9:40 AM, Eric Botcazou wrote: > >> and as t isn't AGGREGATE_TYPE nor COMPLEX_TYPE and is a decl, > >> it is marked MEM_SCALAR_P and e.g. set_mem_attributes_minus_bitpos > >> once MEM_SCALAR_P is set doesn't change it to MEM_IN_STRUCT_P > >> because of BIT_FIELD_REF etc.  The BIT_FIELD_REF = 1 > >> stores are done through store_field though, and for some reason > >> the code sets MEM_IN_STRUCT_P in that codepath unconditionally. > > > > The irony of marking something scalar when its type is VECTOR_TYPE... > > > >> Changing this fixes the testcase, bootstrapped/regtested on x86_64-linux > >> and i686-linux.  I'll try to test this on ia64-linux tomorrow. > >> > >> 2011-03-08  Jakub Jelinek   > >> > >>       PR rtl-optimization/47866 > >>       * expr.c (store_field): If MEM_SCALAR_P (target), don't use > >>       MEM_SET_IN_STRUCT_P (to_rtx, 1), just set MEM_IN_STRUCT_P (to_rtx) > >>       if target wasn't scalar. > > > > I cannot formally approve, but I think it's the way to go. > > Yes, this is ok. In the posted form or in the proposed. ia64-linux base regtest is still pending, once it finishes will bootstrap/regtest whatever patch you prefer. 2011-03-09 Jakub Jelinek PR rtl-optimization/47866 * expr.c (store_field): If MEM_SCALAR_P (target), don't use MEM_SET_IN_STRUCT_P (to_rtx, 1), just set MEM_IN_STRUCT_P (to_rtx) if target wasn't scalar. * function.c (assign_stack_temp_for_type): Assert that neither MEM_SCALAR_P nor MEM_IN_STRUCT_P is set previously, set either MEM_IN_STRUCT_P or MEM_SCALAR_P instead of using MEM_SET_IN_STRUCT_P macro. * rtl.h (MEM_SET_IN_STRUCT_P): Removed. Jakub --- gcc/expr.c.jj 2011-02-04 16:45:02.000000000 +0100 +++ gcc/expr.c 2011-03-08 20:49:19.531545778 +0100 @@ -5924,7 +5924,8 @@ store_field (rtx target, HOST_WIDE_INT b if (to_rtx == target) to_rtx = copy_rtx (to_rtx); - MEM_SET_IN_STRUCT_P (to_rtx, 1); + if (!MEM_SCALAR_P (to_rtx)) + MEM_IN_STRUCT_P (to_rtx) = 1; if (!MEM_KEEP_ALIAS_SET_P (to_rtx) && MEM_ALIAS_SET (to_rtx) != 0) set_mem_alias_set (to_rtx, alias_set); --- gcc/function.c.jj 2011-03-04 19:39:17.000000000 +0100 +++ gcc/function.c 2011-03-09 09:52:47.428670935 +0100 @@ -942,8 +942,11 @@ assign_stack_temp_for_type (enum machine if (type != 0) { MEM_VOLATILE_P (slot) = TYPE_VOLATILE (type); - MEM_SET_IN_STRUCT_P (slot, (AGGREGATE_TYPE_P (type) - || TREE_CODE (type) == COMPLEX_TYPE)); + gcc_checking_assert (!MEM_SCALAR_P (slot) && !MEM_IN_STRUCT_P (slot)); + if (AGGREGATE_TYPE_P (type) || TREE_CODE (type) == COMPLEX_TYPE) + MEM_IN_STRUCT_P (slot) = 1; + else + MEM_SCALAR_P (slot) = 1; } MEM_NOTRAP_P (slot) = 1; --- gcc/rtl.h.jj 2011-02-28 18:02:20.000000000 +0100 +++ gcc/rtl.h 2011-03-09 09:48:58.858400436 +0100 @@ -1279,24 +1279,6 @@ do { \ #define MEM_NOTRAP_P(RTX) \ (RTL_FLAG_CHECK1("MEM_NOTRAP_P", (RTX), MEM)->call) -/* If VAL is nonzero, set MEM_IN_STRUCT_P and clear MEM_SCALAR_P in - RTX. Otherwise, vice versa. Use this macro only when you are - *sure* that you know that the MEM is in a structure, or is a - scalar. VAL is evaluated only once. */ -#define MEM_SET_IN_STRUCT_P(RTX, VAL) \ -do { \ - if (VAL) \ - { \ - MEM_IN_STRUCT_P (RTX) = 1; \ - MEM_SCALAR_P (RTX) = 0; \ - } \ - else \ - { \ - MEM_IN_STRUCT_P (RTX) = 0; \ - MEM_SCALAR_P (RTX) = 1; \ - } \ -} while (0) - /* The memory attribute block. We provide access macros for each value in the block and provide defaults if none specified. */ #define MEM_ATTRS(RTX) X0MEMATTR (RTX, 1)