Hi. Following patch reverts the hunk that was removed in r237103.
Patch can bootstrap & passes regression tests on x86_64-linux-gnu. Patch is approved by Honza. Thanks, Martin
>From e31bef9738193edd46fae118074bd7f241f366c2 Mon Sep 17 00:00:00 2001 From: marxin <mli...@suse.cz> Date: Thu, 23 Jun 2016 11:03:27 +0200 Subject: [PATCH] Fix PR middle-end/71619 gcc/ChangeLog: 2016-06-23 Martin Liska <mli...@suse.cz> PR middle-end/71619 * predict.c (predict_loops): Revert the hunk that was removed in r237103. gcc/testsuite/ChangeLog: 2016-06-23 Martin Liska <mli...@suse.cz> * gcc.dg/pr71619.c: New test. --- gcc/predict.c | 6 +++++- gcc/testsuite/gcc.dg/pr71619.c | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr71619.c diff --git a/gcc/predict.c b/gcc/predict.c index 470de8a..d505d9c 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -1769,7 +1769,11 @@ predict_loops (void) else continue; - gcc_checking_assert (nitercst); + /* If the prediction for number of iterations is zero, do not + predict the exit edges. */ + if (nitercst == 0) + continue; + probability = RDIV (REG_BR_PROB_BASE, nitercst); predict_edge (ex, predictor, probability); } diff --git a/gcc/testsuite/gcc.dg/pr71619.c b/gcc/testsuite/gcc.dg/pr71619.c new file mode 100644 index 0000000..e1404bc --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr71619.c @@ -0,0 +1,11 @@ +/* PR 71619 */ + +/* { dg-do compile } */ +/* { dg-options "-O --param=max-predicted-iterations=0" } */ + +void +foo () +{ + int count = -10; + while (count++); +} -- 2.8.4