public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Eric Botcazou <botcazou@adacore.com>
To: gcc-patches@gcc.gnu.org
Subject: [patch] Fix PR rtl-optimization/100411
Date: Wed, 05 May 2021 13:00:35 +0200	[thread overview]
Message-ID: <3286823.QJadu78ljV@fomalhaut> (raw)

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

Hi,

this is the bootstrap failure of GCC 11 on MinGW64 configured with --enable-
tune=nocona.  The bottom line is that SEH does not support CFI for epilogues 
but the x86 back-end nevertheless attaches it to instructions, so we have to 
filter it out and this is done by detecting the end of the prologue by means 
of the NOTE_INSN_PROLOGUE_END note.

But the compiler manages to generate a second epilogue before this note in the 
RTL stream and this fools the above logic.  The root cause is cross-jumping, 
which inserts a jump before the end of the prologue (in fact just before the 
note); the rest (CFG cleanup, BB reordering) is downhill from there.

Tested on x86-64/Linux and x86-64/Windows, OK for mainline and 11 branch?


2021-05-05  Eric Botcazou  <ebotcazou@adacore.com>

	PR rtl-optimization/100411
	* cfgcleanup.c (try_crossjump_to_edge): Also skip end of prologue
	and beginning of function markers.

-- 
Eric Botcazou

[-- Attachment #2: pr100411.diff --]
[-- Type: text/x-patch, Size: 845 bytes --]

diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index f05cb6136c7..64279cc8c20 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -2148,6 +2148,20 @@ try_crossjump_to_edge (int mode, edge e1, edge e2,
   while (DEBUG_INSN_P (newpos1))
     newpos1 = NEXT_INSN (newpos1);
 
+  /* And end of prologue marker.  */
+  if (NOTE_P (newpos1) && NOTE_KIND (newpos1) == NOTE_INSN_PROLOGUE_END)
+    newpos1 = NEXT_INSN (newpos1);
+
+  while (DEBUG_INSN_P (newpos1))
+    newpos1 = NEXT_INSN (newpos1);
+
+  /* And also beginning of function marker.  */
+  if (NOTE_P (newpos1) && NOTE_KIND (newpos1) == NOTE_INSN_FUNCTION_BEG)
+    newpos1 = NEXT_INSN (newpos1);
+
+  while (DEBUG_INSN_P (newpos1))
+    newpos1 = NEXT_INSN (newpos1);
+
   redirect_from = split_block (src1, PREV_INSN (newpos1))->src;
   to_remove = single_succ (redirect_from);
 

             reply	other threads:[~2021-05-05 11:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-05 11:00 Eric Botcazou [this message]
2021-05-05 11:10 ` Jakub Jelinek
2021-05-05 11:21   ` Eric Botcazou
2021-05-05 11:37     ` Jakub Jelinek
2021-05-05 12:19       ` Eric Botcazou
2021-05-05 12:33         ` Jakub Jelinek

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=3286823.QJadu78ljV@fomalhaut \
    --to=botcazou@adacore.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).