haifa-sched: handle fallthru edge to EXIT block (PR 85899)
authorAlexander Monakov <amonakov@ispras.ru>
Fri, 1 Mar 2019 16:18:04 +0000 (19:18 +0300)
committerAlexander Monakov <amonakov@gcc.gnu.org>
Fri, 1 Mar 2019 16:18:04 +0000 (19:18 +0300)
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.

From-SVN: r269319

gcc/ChangeLog
gcc/haifa-sched.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr85899.c [new file with mode: 0644]

index eff658d491babf5f62882310febf307260615510..7c731963a27fa5396f15561068623239c84f5b39 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2019-03-01  Tamar Christina  <tamar.christina@arm.com>
 
        PR target/89517
index 72178b689996c480a6b6492a768a47752f3ea4bf..5025aae421d6168fda49e8998f7f909825fe663f 100644 (file)
@@ -8082,7 +8082,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;
        }
     }
index 398b45e2dc70ffac3d7a13f4c51404ff44b76ad3..d7a54ab16db7513351cf2df78b4dd9ed68786981 100644 (file)
@@ -1,3 +1,8 @@
+2019-03-01  Alexander Monakov  <amonakov@ispras.ru>
+
+       PR rtl-optimization/85899
+       * gcc.dg/pr85899.c: New test.
+
 2019-03-01  Marek Polacek  <polacek@redhat.com>
 
        PR c++/89537 - missing location for error with non-static member fn.
diff --git a/gcc/testsuite/gcc.dg/pr85899.c b/gcc/testsuite/gcc.dg/pr85899.c
new file mode 100644 (file)
index 0000000..eb2b175
--- /dev/null
@@ -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;
+  }
+}