From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id 679FC3950E54; Fri, 14 May 2021 14:56:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 679FC3950E54 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Jakub Jelinek 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) X-Act-Checkin: gcc X-Git-Author: Alexander Monakov X-Git-Refname: refs/vendors/redhat/heads/gcc-8-branch X-Git-Oldrev: fd2e3c2029cf9cf74e2eac3791128cf664f47c33 X-Git-Newrev: 0e08d1c314455f5e67a9317137637c64aaf2f560 Message-Id: <20210514145622.679FC3950E54@sourceware.org> Date: Fri, 14 May 2021 14:56:22 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 14:56:22 -0000 https://gcc.gnu.org/g:0e08d1c314455f5e67a9317137637c64aaf2f560 commit 0e08d1c314455f5e67a9317137637c64aaf2f560 Author: Alexander Monakov Date: Fri Mar 1 19:18:04 2019 +0300 haifa-sched: handle fallthru edge to EXIT block (PR 85899) 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. * 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; + } +}