public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/redhat/heads/gcc-8-branch)] haifa-sched: handle fallthru edge to EXIT block (PR 85899)
Date: Fri, 14 May 2021 14:56:22 +0000 (GMT)	[thread overview]
Message-ID: <20210514145622.679FC3950E54@sourceware.org> (raw)

https://gcc.gnu.org/g:0e08d1c314455f5e67a9317137637c64aaf2f560

commit 0e08d1c314455f5e67a9317137637c64aaf2f560
Author: Alexander Monakov <amonakov@ispras.ru>
Date:   Fri Mar 1 19:18:04 2019 +0300

    haifa-sched: handle fallthru edge to EXIT block (PR 85899)
    
    2019-03-01  Alexander Monakov  <amonakov@ispras.ru>
    
            PR rtl-optimization/85899
            * haifa-sched.c (find_fallthru_edge_from): Relax assert to account for
            fallthru edges leading to the exit block.
    
            * gcc.dg/pr85899.c: New test.
    
    (cherry picked from commit 5055060066723e409519376c8e571e51cff1eb30)

Diff:
---
 gcc/haifa-sched.c              |  2 +-
 gcc/testsuite/gcc.dg/pr85899.c | 17 +++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 4a899b56173..ba70fc61518 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -8056,7 +8056,7 @@ find_fallthru_edge_from (basic_block pred)
 
       if (e)
 	{
-	  gcc_assert (e->dest == succ);
+	  gcc_assert (e->dest == succ || e->dest->index == EXIT_BLOCK);
 	  return e;
 	}
     }
diff --git a/gcc/testsuite/gcc.dg/pr85899.c b/gcc/testsuite/gcc.dg/pr85899.c
new file mode 100644
index 00000000000..eb2b175339c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr85899.c
@@ -0,0 +1,17 @@
+/* { dg-do compile { target powerpc*-*-* ia64-*-* i?86-*-* x86_64-*-* } } */
+/* { dg-options "-O2 -fschedule-insns -fselective-scheduling -funroll-loops -fno-gcse -fno-if-conversion -fno-ivopts" } */
+
+#define N 4096
+int cb[N];
+int cc[N];
+int cd[N];
+
+void init ()
+{
+  int i;
+  for (i = 0; i < N; ++i) {
+    cb[i] = 3 * i - 2048;
+    cc[i] = -5 * i + 93;
+    cd[i] = i % 2 ? 1 : -1;
+  }
+}


                 reply	other threads:[~2021-05-14 14:56 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=20210514145622.679FC3950E54@sourceware.org \
    --to=jakub@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).