PR tree-optimization/111054
gcc/ChangeLog:
* tree-ssa-loop-split.cc (split_loop): Check for profile being present.
gcc/testsuite/ChangeLog:
* gcc.c-torture/compile/pr111054.c: New test.
--- /dev/null
+/* { dg-additional-options "-fno-guess-branch-probability" } */
+void *p, *q;
+int i, j;
+
+void
+foo (void)
+{
+ for (i = 0; i < 20; i++)
+ if (i < j)
+ p = q;
+}
? true_edge->probability.to_sreal () : (sreal)1;
sreal scale2 = false_edge->probability.reliable_p ()
? false_edge->probability.to_sreal () : (sreal)1;
- sreal div1 = loop1_prob.to_sreal ();
+ sreal div1 = loop1_prob.initialized_p ()
+ ? loop1_prob.to_sreal () : (sreal)1/(sreal)2;
/* +1 to get header interations rather than latch iterations and then
-1 to convert back. */
if (div1 != 0)