From patchwork Thu Apr 4 13:11:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramana Radhakrishnan X-Patchwork-Id: 233766 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 A9CB92C00AB for ; Fri, 5 Apr 2013 00:12:00 +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:content-type; q=dns; s=default; b=LuKIHsjzQBfwO+7mns+YTLb+Knrx/2tyFNLygyvWXVv GL/TONlPnS5UuUt9KVBw7uNwG7OudFnqsC5WT9ZRSWxC/wXrRAqgPekw8Hau1cLb O782/oWinwukoNhS+SCly7+zLL1bANzMTTsDMOJLs9RmBvph48De+zrwyFrp1ZJU = 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:content-type; s=default; bh=CAEdS+5rCvqoO0I+U0am7tfFJZ4=; b=H4ozwfUpWkeKJwi/B 2HCE02phVNvNSzFAUz7ax4r76qCzZhyM83N6lIk4FPPYEl0kNfbRdShSSmoVCUPd Eq/RallN3jdjUqdT+000zTb1DKDJDrwSEau7/9F2ypstKK2CYFrytrluQJROK6jE xx2l5VTbKaSCp9qXfkC84Si18w= Received: (qmail 27267 invoked by alias); 4 Apr 2013 13:11:47 -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 27254 invoked by uid 89); 4 Apr 2013 13:11:46 -0000 X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, 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 13:11:44 +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 14:11:40 +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 14:11:40 +0100 Message-ID: <515D7C0B.8040504@arm.com> Date: Thu, 04 Apr 2013 14:11:39 +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: "gcc-patches@gcc.gnu.org ;" CC: Jakub Jelinek Subject: [Patch 4.6 only] Fix PR48308. X-MC-Unique: 113040414114100101 X-Virus-Found: No Hi, 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 ? Ramana PR rtl-optimization/48308 * combine.c (enum undo_kind): Add UNDO_LINKS. (do_SUBST): Check for oldval. (do_SUBST_LINK): Define. (SUBST_LINK): Define. (try_combine): Use SUBST_LINK. (undo_all): Handle UNDO_LINKS. Index: gcc/combine.c =================================================================== --- gcc/combine.c (revision 196903) +++ gcc/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; enum machine_mode m; rtx l;} old_contents; + union { rtx *r; int *i; rtx *l; } 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,32 @@ } #define SUBST_MODE(INTO, NEWVAL) do_SUBST_MODE(&(INTO), (NEWVAL)) + + +/* 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.l = into; + buf->old_contents.l = oldval; + *into = newval; + + buf->next = undobuf.undos, undobuf.undos = buf; +} + +#define SUBST_LINK(oldval, newval) do_SUBST_LINK (&oldval, newval) /* Subroutine of try_combine. Determine whether the combine replacement patterns NEWPAT, NEWI2PAT and NEWOTHERPAT are cheaper according to @@ -2871,6 +2898,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 +4502,11 @@ case UNDO_MODE: adjust_reg_mode (*undo->where.r, undo->old_contents.m); break; + + case UNDO_LINKS: + *undo->where.l = undo->old_contents.l; + break; + default: gcc_unreachable (); }