From patchwork Thu Mar 17 20:07:43 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 87427 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 77DDDB6FC1 for ; Fri, 18 Mar 2011 07:08:02 +1100 (EST) Received: (qmail 31632 invoked by alias); 17 Mar 2011 20:07:53 -0000 Received: (qmail 31610 invoked by uid 22791); 17 Mar 2011 20:07:52 -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; Thu, 17 Mar 2011 20:07:47 +0000 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 p2HK7jH4028861 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 17 Mar 2011 16:07:45 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p2HK7iSS032005 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 17 Mar 2011 16:07:45 -0400 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 p2HK7ilm032700; Thu, 17 Mar 2011 21:07:44 +0100 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id p2HK7hCK032698; Thu, 17 Mar 2011 21:07:43 +0100 Date: Thu, 17 Mar 2011 21:07:43 +0100 From: Jakub Jelinek To: Richard Henderson Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Fix hppa-* --enable-checking=release bootstrap (PR bootstrap/48161) Message-ID: <20110317200743.GX30899@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek References: <20110317184646.GW30899@tyan-ft48-01.lab.bos.redhat.com> <4D826704.8030805@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4D826704.8030805@redhat.com> 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 Thu, Mar 17, 2011 at 12:54:44PM -0700, Richard Henderson wrote: > On 03/17/2011 11:46 AM, Jakub Jelinek wrote: > > - result = gen_rtx_PLUS (tmode, result, tmp); > > + { > > + if (swap_commutative_operands_p (result, tmp)) > > + result = gen_rtx_PLUS (tmode, tmp, result); > > + else > > + result = gen_rtx_PLUS (tmode, result, tmp); > > Hum. What about simplify_gen_binary (PLUS, tmode, result, tmp) > which will also do the swap? You're right, that will magically handle even the hypothetical case when both result and tmp will be constants and handles even better this exact case (where result is (const_int 0) ). The following fixes the testcase in cross to hppa-* as well. I'll bootstrap/regtest it momentarily, ok if it passes? 2011-03-17 Richard Henderson Jakub Jelinek PR bootstrap/48161 * expr.c (expand_expr_addr_expr_1): Use simplify_gen_binary instead of gen_rtx_PLUS if EXPAND_SUM or EXPAND_INITIALIZER. * gcc.c-torture/compile/pr48161.c: New test. Jakub --- gcc/expr.c.jj 2011-03-14 14:12:15.000000000 +0100 +++ gcc/expr.c 2011-03-17 16:49:01.000000000 +0100 @@ -6971,7 +6971,7 @@ expand_expr_addr_expr_1 (tree exp, rtx t tmp = convert_memory_address_addr_space (tmode, tmp, as); if (modifier == EXPAND_SUM || modifier == EXPAND_INITIALIZER) - result = gen_rtx_PLUS (tmode, result, tmp); + result = simplify_gen_binary (PLUS, tmode, result, tmp); else { subtarget = bitpos ? NULL_RTX : target; --- gcc/testsuite/gcc.c-torture/compile/pr48161.c.jj 2011-03-09 16:32:56.855000001 +0100 +++ gcc/testsuite/gcc.c-torture/compile/pr48161.c 2011-03-17 17:20:34.000000000 +0100 @@ -0,0 +1,24 @@ +/* PR bootstrap/48161 */ + +struct T { int u; }; +struct G { int l; int t; int r; }; +struct V { struct G v[10]; }; +struct { struct V b; } *h; +void bar (void); + +struct G * +baz (struct V *x, unsigned y) +{ + return &x->v[y]; +} + +int +foo (struct T *x, struct T *y) +{ + if ((baz (&h->b, y->u)->t ? baz (&h->b, y->u)->t : 0) + - baz (h ? &h->b : 0, x->u)->r + - (baz (h ? &h->b : 0, x->u)->t > 0 ? 5 : 0)) + return 1; + bar (); + return 0; +}