public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Peter Bergner <bergner@linux.ibm.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Vladimir N Makarov <vmakarov@redhat.com>,
	Jakub Jelinek <jakub@redhat.com>
Subject: [committed] lra: Ignore debug insns and notes in combine_reload_insn [PR109179]
Date: Fri, 17 Mar 2023 19:12:24 -0500	[thread overview]
Message-ID: <b7ea52e2-ba72-aa92-3969-ab52f7d112d6@linux.ibm.com> (raw)

We ICE in combine_reload_insn if we've deleted the TO insn operand during
processing, because lra_get_insn_recog_data doesn't expect to see the note
that replaces the deleted insn.  The solution here is to exit early if TO
is a debug insn or note.

This caused a bootstrap issue on powerpc64le-linux.  The fix was approved
by Vlad.  Committed and pushed after bootstrap testing and checking there
were no testsuite regressions when compared to the commit before the
commit that caused the ICE.

Peter


gcc/
	PR rtl-optimization/109179
	* lra-constraints.cc (combine_reload_insn): Enforce TO is not a debug
	insn or note.  Move the tests earlier to guard lra_get_insn_recog_data.

diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc
index 95b534e1a70..405b8b92f5e 100644
--- a/gcc/lra-constraints.cc
+++ b/gcc/lra-constraints.cc
@@ -5014,14 +5014,19 @@ combine_reload_insn (rtx_insn *from, rtx_insn *to)
   enum reg_class to_class, from_class;
   int n, nop;
   signed char changed_nops[MAX_RECOG_OPERANDS + 1];
-  lra_insn_recog_data_t id = lra_get_insn_recog_data (to);
-  struct lra_static_insn_data *static_id = id->insn_static_data;
   
   /* Check conditions for second memory reload and original insn:  */
   if ((targetm.secondary_memory_needed
        == hook_bool_mode_reg_class_t_reg_class_t_false)
-      || NEXT_INSN (from) != to || CALL_P (to)
-      || id->used_insn_alternative == LRA_UNKNOWN_ALT
+      || NEXT_INSN (from) != to
+      || !NONDEBUG_INSN_P (to)
+      || CALL_P (to))
+    return false;
+
+  lra_insn_recog_data_t id = lra_get_insn_recog_data (to);
+  struct lra_static_insn_data *static_id = id->insn_static_data;
+  
+  if (id->used_insn_alternative == LRA_UNKNOWN_ALT
       || (set = single_set (from)) == NULL_RTX)
     return false;
   from_reg = SET_DEST (set);

                 reply	other threads:[~2023-03-18  0:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=b7ea52e2-ba72-aa92-3969-ab52f7d112d6@linux.ibm.com \
    --to=bergner@linux.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=vmakarov@redhat.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).