From 5055060066723e409519376c8e571e51cff1eb30 Mon Sep 17 00:00:00 2001 From: Alexander Monakov Date: Fri, 1 Mar 2019 19:18:04 +0300 Subject: [PATCH] haifa-sched: handle fallthru edge to EXIT block (PR 85899) 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 | 6 ++++++ gcc/haifa-sched.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr85899.c | 17 +++++++++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr85899.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eff658d491b..7c731963a27 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-03-01 Alexander Monakov + + 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 PR target/89517 diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index 72178b68999..5025aae421d 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -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; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 398b45e2dc7..d7a54ab16db 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-03-01 Alexander Monakov + + PR rtl-optimization/85899 + * gcc.dg/pr85899.c: New test. + 2019-03-01 Marek Polacek 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 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; + } +} -- 2.30.2