public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Kewen.Lin" <linkw@linux.ibm.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Vladimir Makarov <vmakarov@redhat.com>,
	Segher Boessenkool <segher@kernel.crashing.org>,
	Bill Schmidt <wschmidt@linux.ibm.com>
Subject: [PATCH] ira: Skip some pseudos in move_unallocated_pseudos
Date: Tue, 22 Dec 2020 16:05:39 +0800	[thread overview]
Message-ID: <6e1b52f1-a038-9725-38af-5e3007023718@linux.ibm.com> (raw)

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

Hi,

This patch is to make move_unallocated_pseudos consistent
to what we have in function find_moveable_pseudos, where we
record the original pseudo into pseudo_replaced_reg only if
validate_change succeeds with newreg.  To ensure every
unallocated pseudo in move_unallocated_pseudos has expected
information, it's better to add a check and skip it if it's
unexpected.  This avoids possible ICEs in future.

btw, I happened to found this in the bootstrapping for one
experimental local patch, which is considered as impractical.

Bootstrapped/regtested on powerpc64le-linux-gnu P9.

BR,
Kewen

gcc/ChangeLog:

	* ira.c (move_unallocated_pseudos): Check other_reg and skip if
	it isn't set.

[-- Attachment #2: ira.diff --]
[-- Type: text/plain, Size: 656 bytes --]

diff --git a/gcc/ira.c b/gcc/ira.c
index 89b5df4003d..472fcf52aad 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -5111,6 +5111,11 @@ move_unallocated_pseudos (void)
       {
 	int idx = i - first_moveable_pseudo;
 	rtx other_reg = pseudo_replaced_reg[idx];
+	/* If there is no appropriate pseudo in pseudo_replaced_reg, it
+	   means validate_change fails for this new pseudo in function
+	   find_moveable_pseudos, then bypass it here.*/
+	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:[~2020-12-22  8:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-22  8:05 Kewen.Lin [this message]
2020-12-22 13:55 ` Segher Boessenkool
2020-12-23  6:40   ` Kewen.Lin
2021-01-04 23:13     ` Jeff Law
2021-01-05  2:36       ` Kewen.Lin
2021-01-05 18:19         ` Jeff Law
2021-01-06  3:12           ` Kewen.Lin
2021-01-08 20:37             ` Jeff Law

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=6e1b52f1-a038-9725-38af-5e3007023718@linux.ibm.com \
    --to=linkw@linux.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=segher@kernel.crashing.org \
    --cc=vmakarov@redhat.com \
    --cc=wschmidt@linux.ibm.com \
    /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).