public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Stubbs <ams@codesourcery.com>
To: <gcc-patches@gcc.gnu.org>
Subject: [PATCH 01/10] Fix IRA ICE.
Date: Fri, 16 Nov 2018 16:27:00 -0000	[thread overview]
Message-ID: <f59df31d485d71c8e4c68c74ef1ca1dc4a9dd8d4.1542381960.git.ams@codesourcery.com> (raw)
In-Reply-To: <cover.1542381960.git.ams@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 1276 bytes --]


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  <ams@codesourcery.com>

	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(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-IRA-ICE.patch --]
[-- Type: text/x-patch; name="0001-Fix-IRA-ICE.patch", Size: 1128 bytes --]

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.  */

  reply	other threads:[~2018-11-16 16:27 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-16 16:27 [PATCH 00/10] AMD GCN Port v2 Andrew Stubbs
2018-11-16 16:27 ` Andrew Stubbs [this message]
2018-11-21  0:47   ` [PATCH 01/10] Fix IRA ICE Jeff Law
2018-11-21 11:35     ` Andrew Stubbs
2018-12-08 12:15       ` Richard Sandiford
2018-12-08 16:23         ` Jeff Law
2018-12-10 15:22           ` Andrew Stubbs
2018-11-16 16:28 ` [PATCH 03/10] GCN libgcc Andrew Stubbs
2018-11-21  0:49   ` Jeff Law
2018-11-16 16:28 ` [PATCH 04/10] GCN machine description Andrew Stubbs
2018-11-16 16:28 ` [PATCH 02/10] GCN libgfortran Andrew Stubbs
2018-11-16 16:28 ` [PATCH 07/10] Add dg-require-effective-target exceptions Andrew Stubbs
2018-11-26 22:08   ` Mike Stump
2018-11-27  9:29     ` Andrew Stubbs
2018-11-16 16:28 ` [PATCH 09/10] Ignore LLVM's blank lines Andrew Stubbs
2018-11-16 16:28 ` [PATCH 05/10] GCN back-end code Andrew Stubbs
2018-11-16 16:28 ` [PATCH 08/10] Testsuite: GCN is always PIE Andrew Stubbs
2018-11-16 16:29 ` [PATCH 06/10] GCN back-end config Andrew Stubbs
2018-11-16 17:44   ` Joseph Myers
2018-11-20 11:44     ` Andrew Stubbs
2018-11-21  2:32   ` Jeff Law
2018-11-16 16:29 ` [PATCH 10/10] Port testsuite to GCN Andrew Stubbs
2018-11-21  1:01   ` Jeff Law
2018-11-26 20:04     ` Mike Stump
2018-11-26 21:13       ` Mike Stump
2018-11-27  9:27         ` Andrew Stubbs
2018-12-06 16:10         ` Andrew Stubbs
2018-12-06 15:27     ` Andrew Stubbs
2018-12-08 12:05       ` Richard Sandiford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f59df31d485d71c8e4c68c74ef1ca1dc4a9dd8d4.1542381960.git.ams@codesourcery.com \
    --to=ams@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).