From patchwork Wed Nov 24 21:41:05 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 72949 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 50B7BB708B for ; Thu, 25 Nov 2010 08:41:53 +1100 (EST) Received: (qmail 10443 invoked by alias); 24 Nov 2010 21:41:37 -0000 Received: (qmail 10366 invoked by uid 22791); 24 Nov 2010 21:41:35 -0000 X-SWARE-Spam-Status: No, hits=-6.3 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, 24 Nov 2010 21:41:30 +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.13.8/8.13.8) with ESMTP id oAOLf7lo013501 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 24 Nov 2010 16:41:07 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oAOLf6Oj010980 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 24 Nov 2010 16:41:07 -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 oAOLf66P012097; Wed, 24 Nov 2010 22:41:06 +0100 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id oAOLf5mv012096; Wed, 24 Nov 2010 22:41:05 +0100 Date: Wed, 24 Nov 2010 22:41:05 +0100 From: Jakub Jelinek To: Eric Botcazou Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Another combiner 4 insn issue fix (PR middle-end/46637) Message-ID: <20101124214105.GF29412@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline 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 Hi! On this testcase (both x86_64-linux and i686-linux) i0dest_in_i0src is 1, and so is i0_feeds_i1_n and i1_feeds_i2_n, but i1dest_in_i1src is 0 and i0_feeds_i2_n is 0 as well. Nevertheless, we need to call subst with 1 as last argument when substing i2src for i2dest, otherwise we get similar sharing problems to what happens when i0dest_in_i0src i0 feeds directly i2 instead of indirectly. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2010-11-24 Jakub Jelinek PR middle-end/46637 * combine.c (try_combine): When substing i2dest for i2src, pass 1 as last argument even if i0_feeds_i1_n && i1_feeds_i2_n && i0dest_in_i0src. * gcc.c-torture/compile/pr46637.c: New test. Jakub --- gcc/combine.c.jj 2010-11-19 20:56:55.000000000 +0100 +++ gcc/combine.c 2010-11-24 14:29:39.000000000 +0100 @@ -3099,7 +3099,8 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx later. Likewise if I0 feeds into I2 and I0DEST is in I0SRC. */ newpat = subst (PATTERN (i3), i2dest, i2src, 0, (i1_feeds_i2_n && i1dest_in_i1src) - || (i0_feeds_i2_n && i0dest_in_i0src)); + || ((i0_feeds_i2_n || (i0_feeds_i1_n && i1_feeds_i2_n)) + && i0dest_in_i0src)); substed_i2 = 1; /* Record whether I2's body now appears within I3's body. */ --- gcc/testsuite/gcc.c-torture/compile/pr46637.c.jj 2010-11-24 14:38:02.000000000 +0100 +++ gcc/testsuite/gcc.c-torture/compile/pr46637.c 2010-11-24 14:37:52.000000000 +0100 @@ -0,0 +1,11 @@ +/* PR middle-end/46637 */ + +struct S { int s[5]; } *p; + +void +foo (long x) +{ + long a = x == 1 ? 4L : 1L; + asm ("" : "+m" (p->s[a])); + p->s[0]++; +}