From patchwork Thu Apr 4 15:46:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramana Radhakrishnan X-Patchwork-Id: 233865 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id E27B02C009E for ; Fri, 5 Apr 2013 02:47:18 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=ACCJ4J3d8UfzSuTQn F8abl2dpi8sTxr5z+1RKTFTQHsZ+k/KTu0K0jpC8XiLBdhqBS3+vZ/zhSqguBURF MJ08hfDnra1XLbLj9rCAAn0PhzkvDCeiW6DhfdelUPhkWfZYrHqHeXhYC4wTeDGX z9KkkVW08o92Oc2phHVd3g7EmA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=90SRZBUIKVQIZBG8OWydyxP Ry5s=; b=FbEqDzO8RBNdzvWzqxeCseb4S0QEoI/3rKjiKyYbA09KRcVVtFO0FA4 eoOQ8+olDzQaBQNQZ98xIctY8ZBIJOUyAemuzFzKT5rq5+Ewg1QN+R5D5sn/WPrT FiEte+hOTTdUWBqfM/wDCgSgyT1PECMFyzeolLrzlCN4iLFqL9GE= Received: (qmail 13903 invoked by alias); 4 Apr 2013 15:46:40 -0000 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 Received: (qmail 13875 invoked by uid 89); 4 Apr 2013 15:46:39 -0000 X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 04 Apr 2013 15:46:36 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Thu, 04 Apr 2013 16:46:34 +0100 Received: from [10.1.69.70] ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.0); Thu, 4 Apr 2013 16:46:31 +0100 Message-ID: <515DA057.7070108@arm.com> Date: Thu, 04 Apr 2013 16:46:31 +0100 From: Ramana Radhakrishnan User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Jakub Jelinek CC: gcc-patches@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: [Patch 4.6 only] Fix PR48308. References: <515D7C0B.8040504@arm.com> <20130404131637.GO4201@tucnak.redhat.com> In-Reply-To: <20130404131637.GO4201@tucnak.redhat.com> X-MC-Unique: 113040416463408401 X-Virus-Found: No On 04/04/13 14:16, Jakub Jelinek wrote: > On Thu, Apr 04, 2013 at 02:11:39PM +0100, Ramana Radhakrishnan wrote: >> >> This backports the fix for PR48308 something that's slipped through >> the cracks. I wrote the backport and then noticed that Mikael had a >> similar solution - the only difference being around this guarded for >> HAVE_cc0 targets. >> >> Tested cross arm-none-linux-gnueabi - no regressions. >> >> Bootstrapped with i686-pc-linux-gnu , regression tests running. >> >> Ok to commit if no regressions ? > > Ok. > > Jakub > Thanks - this is what I will commit once testing completes. Ramana Index: combine.c =================================================================== --- combine.c (revision 197476) +++ combine.c (working copy) @@ -341,14 +341,14 @@ /* Record one modification to rtl structure to be undone by storing old_contents into *where. */ -enum undo_kind { UNDO_RTX, UNDO_INT, UNDO_MODE }; +enum undo_kind { UNDO_RTX, UNDO_INT, UNDO_MODE, UNDO_LINKS }; struct undo { struct undo *next; enum undo_kind kind; union { rtx r; int i; enum machine_mode m; } old_contents; - union { rtx *r; int *i; } where; + union { rtx *r; int *i; } where; }; /* Record a bunch of changes to be undone, up to MAX_UNDO of them. @@ -671,7 +671,8 @@ that are perfectly valid, so we'd waste too much effort for little gain doing the checks here. Focus on catching invalid transformations involving integer constants. */ - if (GET_MODE_CLASS (GET_MODE (oldval)) == MODE_INT + if (oldval + && GET_MODE_CLASS (GET_MODE (oldval)) == MODE_INT && CONST_INT_P (newval)) { /* Sanity check that we're replacing oldval with a CONST_INT @@ -762,6 +763,34 @@ } #define SUBST_MODE(INTO, NEWVAL) do_SUBST_MODE(&(INTO), (NEWVAL)) + +#ifndef HAVE_cc0 + +/* Similar to SUBST, but NEWVAL is a LOG_LINKS expression. */ + +static void +do_SUBST_LINK (rtx *into, rtx newval) +{ + struct undo *buf; + rtx oldval = *into; + if (oldval == newval) + return; + + if (undobuf.frees) + buf = undobuf.frees, undobuf.frees = buf->next; + else + buf = XNEW (struct undo); + + buf->kind = UNDO_LINKS; + buf->where.r = into; + buf->old_contents.r = oldval; + *into = newval; + + buf->next = undobuf.undos, undobuf.undos = buf; +} + +#define SUBST_LINK(oldval, newval) do_SUBST_LINK (&oldval, newval) +#endif /* Subroutine of try_combine. Determine whether the combine replacement patterns NEWPAT, NEWI2PAT and NEWOTHERPAT are cheaper according to @@ -2871,6 +2900,7 @@ SUBST (PATTERN (i2), XVECEXP (PATTERN (i2), 0, 0)); SUBST (XEXP (SET_SRC (PATTERN (i2)), 0), SET_DEST (PATTERN (i1))); + SUBST_LINK (LOG_LINKS (i2), alloc_INSN_LIST (i1, LOG_LINKS (i2))); } } #endif @@ -4474,6 +4504,11 @@ case UNDO_MODE: adjust_reg_mode (*undo->where.r, undo->old_contents.m); break; + + case UNDO_LINKS: + *undo->where.r = undo->old_contents.r; + break; + default: gcc_unreachable (); }