public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Vladimir Makarov <vmakarov@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r11-5395] [PR97983] LRA: Use the right emit func for putting insn in the destination BB.
Date: Thu, 26 Nov 2020 00:58:10 +0000 (GMT)	[thread overview]
Message-ID: <20201126005810.B9BCD3857C4F@sourceware.org> (raw)

https://gcc.gnu.org/g:a02e304245b5181d0f56adab0756719d876b0c58

commit r11-5395-ga02e304245b5181d0f56adab0756719d876b0c58
Author: Vladimir N. Makarov <vmakarov@redhat.com>
Date:   Wed Nov 25 17:06:13 2020 -0500

    [PR97983] LRA: Use the right emit func for putting insn in the destination BB.
    
    gcc/
    
    2020-11-25  Vladimir Makarov  <vmakarov@redhat.com>
    
            PR bootstrap/97983
            * lra.c (lra_process_new_insns): Use emit_insn_before_noloc or
            emit_insn_after_noloc with the destination BB.

Diff:
---
 gcc/lra.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/gcc/lra.c b/gcc/lra.c
index 4ec0f466376..a79213e32e0 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -1908,13 +1908,9 @@ lra_process_new_insns (rtx_insn *insn, rtx_insn *before, rtx_insn *after,
 		  tmp = NEXT_INSN (tmp);
 		if (NOTE_INSN_BASIC_BLOCK_P (tmp))
 		  tmp = NEXT_INSN (tmp);
-		for (curr = tmp; curr != NULL; curr = NEXT_INSN (curr))
-		  if (INSN_P (curr))
-		    break;
 		/* Do not put reload insns if it is the last BB
-		   without actual insns.  In this case the reload insns
-		   can get null BB after emitting.  */
-		if (curr == NULL)
+		   without actual insns.  */
+		if (tmp == NULL)
 		  continue;
 		start_sequence ();
 		for (curr = after; curr != NULL_RTX; curr = NEXT_INSN (curr))
@@ -1927,7 +1923,11 @@ lra_process_new_insns (rtx_insn *insn, rtx_insn *before, rtx_insn *after,
 			     e->dest->index);
 		    dump_rtl_slim (lra_dump_file, copy, NULL, -1, 0);
 		  }
-		emit_insn_before (copy, tmp);
+		/* Use the right emit func for setting up BB_END/BB_HEAD: */
+		if (BB_END (e->dest) == PREV_INSN (tmp))
+		  emit_insn_after_noloc (copy, PREV_INSN (tmp), e->dest);
+		else
+		  emit_insn_before_noloc (copy, tmp, e->dest);
 		push_insns (last, PREV_INSN (copy));
 		setup_sp_offset (copy, last);
 		/* We can ignore BB live info here as it and reg notes


                 reply	other threads:[~2020-11-26  0:58 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=20201126005810.B9BCD3857C4F@sourceware.org \
    --to=vmakarov@gcc.gnu.org \
    --cc=gcc-cvs@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).