re PR tree-optimization/86038 (ICE in to_reg_br_prob_base, at profile-count.h:242)
authorRichard Biener <rguenther@suse.de>
Mon, 4 Jun 2018 09:28:22 +0000 (09:28 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 4 Jun 2018 09:28:22 +0000 (09:28 +0000)
2018-06-04  Richard Biener  <rguenther@suse.de>

PR tree-optimization/86038
* tracer.c (find_best_successor): Check probability for
being initialized, bail out if not.

* gcc.dg/pr86038.c: New testcase.

From-SVN: r261142

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr86038.c [new file with mode: 0644]
gcc/tracer.c

index e780766e7d8987386329dc5f6eec088c43c0c90f..fde65ebae1d91560f3f4114706f41065dc35b1cf 100644 (file)
@@ -1,3 +1,9 @@
+2018-06-04  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/86038
+       * tracer.c (find_best_successor): Check probability for
+       being initialized, bail out if not.
+
 2018-06-04  Richard Earnshaw  <rearnsha@arm.com>
 
        PR target/86003
index f889ebb5cdea8465c1e83db15b06336a4a5697dc..6ec5c50b9e53f929fb902c2689a8a06c8101e81c 100644 (file)
@@ -1,3 +1,8 @@
+2018-06-04  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/86038
+       * gcc.dg/pr86038.c: New testcase.
+
 2018-06-04  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/69615
diff --git a/gcc/testsuite/gcc.dg/pr86038.c b/gcc/testsuite/gcc.dg/pr86038.c
new file mode 100644 (file)
index 0000000..427a13f
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target pthread } */
+/* { dg-options "-O2 -ftracer -ftree-parallelize-loops=2 -fno-tree-scev-cprop --param parloops-schedule=dynamic" } */
+
+int
+sd (int lw)
+{
+  while (lw < 1)
+    ++lw;
+
+  return lw;
+}
index 61815130802f9e27cbfe6b50781742b62e83985d..05300a289eacfbe3da8d61dce67c1bff58e5b695 100644 (file)
@@ -159,7 +159,8 @@ find_best_successor (basic_block bb)
     }
   if (!best || ignore_bb_p (best->dest))
     return NULL;
-  if (best->probability.to_reg_br_prob_base () <= probability_cutoff)
+  if (!best->probability.initialized_p ()
+      || best->probability.to_reg_br_prob_base () <= probability_cutoff)
     return NULL;
   return best;
 }