From patchwork Wed Nov 21 22:22:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 200867 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 0A9CE2C0082 for ; Thu, 22 Nov 2012 09:23:07 +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=1354141388; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=Lgj/CSE H/oOD5TxRJ3+3FNRbDAo=; b=VzDvJfCcz9pFBJLC2Cv2/kqqvBZ5Lb3oyILTosw bivgq6pD5OAjHau5Tlz9y+USFhx/6fpPrzF1TEImK/NphTkKmMEQRLzPE6bo/1Jb 9aOAmlZ60rQdeoIOT91pOUgd1eX5PqE/FR/2igEyYTB7g9u/QB4S8laT/K8OTWIO 8DZs= 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:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=ePFtbKL1HF57h6uRJagO4s+i4dztcBqurog2eIoSaDpFYHOH4VXSsS3UQmLokq Y8MCq5xPNgmqYFQoh8zmJHO9DMEQR0tHF7VZlk1UPSd9Lv4c2SK1JWybNltZkSoa 06ucCT1Iz4nNAPNGJQqLEs2R9ZfcNaRPg34cKUvF/m1sY=; Received: (qmail 30141 invoked by alias); 21 Nov 2012 22:22:51 -0000 Received: (qmail 30133 invoked by uid 22791); 21 Nov 2012 22:22:50 -0000 X-SWARE-Spam-Status: No, hits=-6.6 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; Wed, 21 Nov 2012 22:22:42 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qALMMgGu022557 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 21 Nov 2012 17:22:42 -0500 Received: from Mair.local (vpn-8-146.rdu.redhat.com [10.11.8.146]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qALMMe9l024617 for ; Wed, 21 Nov 2012 17:22:41 -0500 Message-ID: <50AD5430.5070204@redhat.com> Date: Wed, 21 Nov 2012 17:22:40 -0500 From: Vladimir Makarov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: GCC Patches Subject: patch to fix PR55414 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 The following patch fixes http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55414 The patch was successfully bootstrapped on x86/x86-64. Committed as rev. 193712. 2012-11-21 Vladimir Makarov PR rtl-optimization/55414 * lra-constraints.c (Index): New function. (lra_constraints): Check dead equiv init insns. Index: lra-constraints.c =================================================================== --- lra-constraints.c (revision 193702) +++ lra-constraints.c (working copy) @@ -3215,6 +3215,17 @@ multi_block_pseudo_p (int regno) return false; } +/* Return true if LIST contains a deleted insn. */ +static bool +contains_deleted_insn_p (rtx list) +{ + for (; list != NULL_RTX; list = XEXP (list, 1)) + if (NOTE_P (XEXP (list, 0)) + && NOTE_KIND (XEXP (list, 0)) == NOTE_INSN_DELETED) + return true; + return false; +} + /* Return true if X contains a pseudo dying in INSN. */ static bool dead_pseudo_p (rtx x, rtx insn) @@ -3317,10 +3328,29 @@ lra_constraints (bool first_p) bool pseudo_p = contains_reg_p (x, false, false); rtx set, insn; - /* We don't use DF for compilation speed sake. So it is - problematic to update live info when we use an - equivalence containing pseudos in more than one BB. */ - if ((pseudo_p && multi_block_pseudo_p (i)) + /* After RTL transformation, we can not guarantee that + pseudo in the substitution was not reloaded which might + make equivalence invalid. For example, in reverse + equiv of p0 + + p0 <- ... + ... + equiv_mem <- p0 + + the memory address register was reloaded before the 2nd + insn. */ + if ((! first_p && pseudo_p) + /* We don't use DF for compilation speed sake. So it + is problematic to update live info when we use an + equivalence containing pseudos in more than one + BB. */ + || (pseudo_p && multi_block_pseudo_p (i)) + /* If an init insn was deleted for some reason, cancel + the equiv. We could update the equiv insns after + transformations including an equiv insn deletion + but it is not worthy as such cases are extremely + rare. */ + || contains_deleted_insn_p (ira_reg_equiv[i].init_insns) /* If it is not a reverse equivalence, we check that a pseudo in rhs of the init insn is not dying in the insn. Otherwise, the live info at the beginning of @@ -3335,19 +3365,6 @@ lra_constraints (bool first_p) && (int) REGNO (SET_DEST (set)) == i) && init_insn_rhs_dead_pseudo_p (i))) ira_reg_equiv[i].defined_p = false; - else if (! first_p && pseudo_p) - /* After RTL transformation, we can not guarantee that - pseudo in the substitution was not reloaded which - might make equivalence invalid. For example, in - reverse equiv of p0 - - p0 <- ... - ... - equiv_mem <- p0 - - the memory address register was reloaded before the - 2nd insn. */ - ira_reg_equiv[i].defined_p = false; if (contains_reg_p (x, false, true)) ira_reg_equiv[i].profitable_p = false; if (get_equiv_substitution (reg) != reg)