From: Martin Liska Date: Thu, 23 Jun 2016 11:04:35 +0000 (+0200) Subject: re PR middle-end/71619 (ICE: in predict_loops, at predict.c:1772 with --param=max... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=60fa7862a0a1ad80f587cb29bcc8613a78303f90;p=gcc.git re PR middle-end/71619 (ICE: in predict_loops, at predict.c:1772 with --param=max-predicted-iterations=0) Fix PR middle-end/71619 PR middle-end/71619 * predict.c (predict_loops): Revert the hunk that was removed in r237103. * gcc.dg/pr71619.c: New test. From-SVN: r237730 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 81f1b4d8a55..850a3caf736 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-06-23 Martin Liska + + PR middle-end/71619 + * predict.c (predict_loops): Revert the hunk that was removed + in r237103. + 2016-06-23 Jakub Sejdak * config.gcc: Add support for arm*-*-phoenix* targets. diff --git a/gcc/predict.c b/gcc/predict.c index 470de8a6e37..d505d9c4cc8 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/ChangeLog b/gcc/testsuite/ChangeLog index 54a1d4755d8..287baf6dcd8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-06-23 Martin Liska + + * gcc.dg/pr71619.c: New test. + 2016-06-23 H.J. Lu PR target/67400 diff --git a/gcc/testsuite/gcc.dg/pr71619.c b/gcc/testsuite/gcc.dg/pr71619.c new file mode 100644 index 00000000000..e1404bc9a9f --- /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++); +}