From patchwork Mon Oct 22 19:23:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 193260 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 CE1AA2C0089 for ; Tue, 23 Oct 2012 06:23:49 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1351538630; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Subject:Message-ID:Reply-To: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=MxAqtIN659IEzqj0o3xF guvhr6w=; b=IXaq7n27Xe2aTVV1V99YbMTc28Q5hBJbJkzHn5xeqj45FbrVf7a8 PssGSUSNGadBR/l2jPZkbc0vYmYyWrKDvag7SIFQhpa3fye/oZq4YT4WHRcliaRX i8UqPeow5J7nPGvazMr+LeCyyoK0jexwULHqv8Grnw3nXl1+dgSOyLI= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Subject:Message-ID:Reply-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=NuZLqpx56m3qr77boaDGfRHFFpjZnDv5d4h222E5pDSonwvxW1xBBJsVLpbaPd QcikOgcAecLwHn+rEPxsCnroe79gj4i7cw4YBvk+d+JONQe7SNdMOUKMHfjfqLR2 6RhCcZhtoPAUJHs/NfCB9c+Kq4ayz7SuSoMWuXQdQ6dRg=; Received: (qmail 11609 invoked by alias); 22 Oct 2012 19:23:45 -0000 Received: (qmail 11597 invoked by uid 22791); 22 Oct 2012 19:23:44 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, 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; Mon, 22 Oct 2012 19:23:34 +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 q9MJNYs1011969 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 22 Oct 2012 15:23:34 -0400 Received: from zalov.redhat.com (vpn1-6-20.ams2.redhat.com [10.36.6.20]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q9MJNWch004419 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 22 Oct 2012 15:23:33 -0400 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.redhat.com (8.14.5/8.14.5) with ESMTP id q9MJNW9C029108 for ; Mon, 22 Oct 2012 21:23:32 +0200 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id q9MJNV3v029107 for gcc-patches@gcc.gnu.org; Mon, 22 Oct 2012 21:23:31 +0200 Date: Mon, 22 Oct 2012 21:23:31 +0200 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix CSE RTL sharing ICE (PR rtl-optimization/55010) Message-ID: <20121022192331.GE1752@tucnak.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 the following testcase we have IF_THEN_ELSE in insn notes, and when folding it, folded_arg1 is a subreg from earlier CC setter, as the other argument has equiv constant, simplify_relational_operation is called on it to simplify it and we end up with invalid RTL sharing of the subreg in between the CC setter insn and the insn with the REG_EQ* note. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2012-10-22 Jakub Jelinek PR rtl-optimization/55010 * cse.c (fold_rtx): Call copy_rtx on folded_arg{0,1} before passing it to simplify_relational_operation. * gcc.dg/pr55010.c: New test. Jakub --- gcc/cse.c.jj 2012-10-16 13:15:45.000000000 +0200 +++ gcc/cse.c 2012-10-22 10:44:34.100033945 +0200 @@ -3461,8 +3461,8 @@ fold_rtx (rtx x, rtx insn) } { - rtx op0 = const_arg0 ? const_arg0 : folded_arg0; - rtx op1 = const_arg1 ? const_arg1 : folded_arg1; + rtx op0 = const_arg0 ? const_arg0 : copy_rtx (folded_arg0); + rtx op1 = const_arg1 ? const_arg1 : copy_rtx (folded_arg1); new_rtx = simplify_relational_operation (code, mode, mode_arg0, op0, op1); } break; --- gcc/testsuite/gcc.dg/pr55010.c.jj 2012-10-22 10:47:47.289857369 +0200 +++ gcc/testsuite/gcc.dg/pr55010.c 2012-10-22 10:47:33.000000000 +0200 @@ -0,0 +1,13 @@ +/* PR rtl-optimization/55010 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-march=i686" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ + +long long int a; +unsigned long long int b; + +void +foo (void) +{ + a = (a < 0) / ((a -= b) ? b >= ((b = a) || 0) : 0); +}