From patchwork Mon Oct 28 23:20:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 286693 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 did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 76C852C00A8 for ; Tue, 29 Oct 2013 10:22:02 +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:subject:content-type; q= dns; s=default; b=eyLekM0ibIGyAmDjEYwXz90l61xe7hey77qeL0Sbp7Ijca 4PHDuX8uHwTLeaDFp5aTXuzA81lVuWppmZE5p/k8L0yRgC21NuSOEySz/DyMvz/T owTnAGk5wuNRqQEUVLifV8MNdYviVPzZEGxddw/0U+saqTsPschY9flN3Q48E= 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:subject:content-type; s= default; bh=w5JlxUqfGRQZOM+Hum7ywn2bxVE=; b=GTdsgLtp5kowFtzoa97k sw8bnq03xc9dasWeDkV9+4QbQkryAOrpjE3nh4VCAGqvwW3QHpNyk4uXuILX/9xL nyiJ1UKCF1qhymfd3yxIo9mKmFCwPNnC/v950sL6nlj8vBkJ7rHlf/dewP9VadQL 8y2AA5YS9XCLFryCOuUrKik= Received: (qmail 26536 invoked by alias); 28 Oct 2013 23:21:56 -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 26526 invoked by uid 89); 28 Oct 2013 23:21:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.6 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 28 Oct 2013 23:21:55 +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 r9SNLrQc026018 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 28 Oct 2013 19:21:54 -0400 Received: from Mair-2.local (vpn-48-98.rdu2.redhat.com [10.10.48.98]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r9SNLrah000625 for ; Mon, 28 Oct 2013 19:21:53 -0400 Message-ID: <526EF135.9040303@redhat.com> Date: Mon, 28 Oct 2013 19:20:21 -0400 From: Vladimir Makarov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: GCC Patches Subject: patch to fix a LRA crash on ppc X-IsSubscribed: yes The following patch is a new version of a fix for LRA crash on 32-bit ppc SPEC2006 gamess. The previous version broke mode-switching optimization on x86/x86-64. The patch was successfully bootstrapped and tested on x86/x86-64. Committed as rev. 204140. 2013-10-28 Vladimir Makarov * lra-spills.c (lra_final_code_change): Remove useless move insns originated from moves of pseudos. Index: lra-spills.c =================================================================== --- lra-spills.c (revision 204131) +++ lra-spills.c (working copy) @@ -625,7 +625,7 @@ lra_final_code_change (void) { int i, hard_regno; basic_block bb; - rtx insn, curr; + rtx insn, curr, set; int max_regno = max_reg_num (); for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++) @@ -636,6 +636,7 @@ lra_final_code_change (void) FOR_BB_INSNS_SAFE (bb, insn, curr) if (INSN_P (insn)) { + bool change_p; rtx pat = PATTERN (insn); if (GET_CODE (pat) == CLOBBER && LRA_TEMP_CLOBBER_P (pat)) @@ -648,6 +649,12 @@ lra_final_code_change (void) continue; } + set = single_set (insn); + change_p = (set != NULL + && REG_P (SET_SRC (set)) && REG_P (SET_DEST (set)) + && REGNO (SET_SRC (set)) >= FIRST_PSEUDO_REGISTER + && REGNO (SET_DEST (set)) >= FIRST_PSEUDO_REGISTER); + lra_insn_recog_data_t id = lra_get_insn_recog_data (insn); struct lra_static_insn_data *static_id = id->insn_static_data; bool insn_change_p = false; @@ -661,5 +668,20 @@ lra_final_code_change (void) } if (insn_change_p) lra_update_operator_dups (id); + + if (change_p && REGNO (SET_SRC (set)) == REGNO (SET_DEST (set))) + { + /* Remove an useless move insn but only involving + pseudos as some subsequent optimizations are based on + that move insns involving originally hard registers + are preserved. IRA can generate move insns involving + pseudos. It is better remove them earlier to speed + up compiler a bit. It is also better to do it here + as they might not pass final RTL check in LRA, + (e.g. insn moving a control register into + itself). */ + lra_invalidate_insn_data (insn); + delete_insn (insn); + } } }