From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47768 invoked by alias); 16 Nov 2018 16:27:56 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 47656 invoked by uid 89); 16 Nov 2018 16:27:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=3002 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 16 Nov 2018 16:27:54 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-03.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1gNgyG-0001Dm-Ri from Andrew_Stubbs@mentor.com for gcc-patches@gcc.gnu.org; Fri, 16 Nov 2018 08:27:52 -0800 Received: from build6-trusty-cs.sje.mentorg.com (137.202.0.90) by SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Fri, 16 Nov 2018 16:27:48 +0000 From: Andrew Stubbs To: Subject: [PATCH 01/10] Fix IRA ICE. Date: Fri, 16 Nov 2018 16:27:00 -0000 Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------2.8.1" X-SW-Source: 2018-11/txt/msg01497.txt.bz2 --------------2.8.1 Content-Type: text/plain; charset="UTF-8"; format=fixed Content-Transfer-Encoding: 8bit Content-length: 1276 This patch is unchanged from that which was posted before. Discussion fizzled out there and I was too busy with other patches to restart it then. This issue needs to be resolved before libgfortran can be compiled for GCN. The IRA pass makes an assumption that any pseudos created after the pass begins were created explicitly by the pass itself and therefore will have corresponding entries in its other tables. The GCN back-end, however, often creates additional pseudos, in expand patterns, to represent the necessary EXEC value, and these break IRA's assumption and cause ICEs: ..../libgfortran/generated/matmul_r8.c: In function 'matmul_r8': ..../libgfortran/generated/matmul_r8.c:3002:1: internal compiler error: in setup_preferred_alternate_classes_for_new_pseudos, at ira.c:2772 This patch simply has IRA skip unknown pseudos, and the problem goes away. Presumably, it's not ideal that these registers have not been processed by IRA, but it does not appear to do any real harm. 2018-11-16 Andrew Stubbs gcc/ * ira.c (setup_preferred_alternate_classes_for_new_pseudos): Skip pseudos not created by this pass. (move_unallocated_pseudos): Likewise. --- gcc/ira.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) --------------2.8.1 Content-Type: text/x-patch; name="0001-Fix-IRA-ICE.patch" Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="0001-Fix-IRA-ICE.patch" Content-length: 1128 diff --git a/gcc/ira.c b/gcc/ira.c index def194a..e0c293c 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -2769,7 +2769,12 @@ setup_preferred_alternate_classes_for_new_pseudos (int start) for (i = start; i < max_regno; i++) { old_regno = ORIGINAL_REGNO (regno_reg_rtx[i]); - ira_assert (i != old_regno); + + /* Skip any new pseudos not created directly by this pass. + gen_move_insn can do this on AMD GCN, for example. */ + if (i == old_regno) + continue; + setup_reg_classes (i, reg_preferred_class (old_regno), reg_alternate_class (old_regno), reg_allocno_class (old_regno)); @@ -5054,6 +5059,12 @@ move_unallocated_pseudos (void) { int idx = i - first_moveable_pseudo; rtx other_reg = pseudo_replaced_reg[idx]; + + /* Skip any new pseudos not created directly by find_moveable_pseudos. + gen_move_insn can do this on AMD GCN, for example. */ + if (!other_reg) + continue; + rtx_insn *def_insn = DF_REF_INSN (DF_REG_DEF_CHAIN (i)); /* The use must follow all definitions of OTHER_REG, so we can insert the new definition immediately after any of them. */ --------------2.8.1--