]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/71619 (ICE: in predict_loops, at predict.c:1772 with --param=max...
authorMartin Liska <mliska@suse.cz>
Thu, 23 Jun 2016 11:04:35 +0000 (13:04 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Thu, 23 Jun 2016 11:04:35 +0000 (11:04 +0000)
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

gcc/ChangeLog
gcc/predict.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr71619.c [new file with mode: 0644]

index 81f1b4d8a55b9891442e1cb09457fbedf1ed9298..850a3caf7365716b5732552133477858d6b70024 100644 (file)
@@ -1,3 +1,9 @@
+2016-06-23  Martin Liska  <mliska@suse.cz>
+
+       PR middle-end/71619
+       * predict.c (predict_loops): Revert the hunk that was removed
+       in r237103.
+
 2016-06-23  Jakub Sejdak  <jakub.sejdak@phoesys.com>
 
        * config.gcc: Add support for arm*-*-phoenix* targets.
index 470de8a6e373a00e686664790b745e76d7c94042..d505d9c4cc80356563ead2a845c515f62998ec41 100644 (file)
@@ -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);
        }
index 54a1d4755d87b50fcf4b07d3ba99bfa607c764d1..287baf6dcd8ba3998a0f7cb5a9d50f9d7a519d4e 100644 (file)
@@ -1,3 +1,7 @@
+2016-06-23  Martin Liska  <mliska@suse.cz>
+
+       * gcc.dg/pr71619.c: New test.
+
 2016-06-23  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/67400
diff --git a/gcc/testsuite/gcc.dg/pr71619.c b/gcc/testsuite/gcc.dg/pr71619.c
new file mode 100644 (file)
index 0000000..e1404bc
--- /dev/null
@@ -0,0 +1,11 @@
+/* PR 71619 */
+
+/* { dg-do compile } */
+/* { dg-options "-O --param=max-predicted-iterations=0" } */
+
+void
+foo ()
+{
+  int count = -10;
+  while (count++);
+}