bb-reorder.c (better_edge_p): Fix handling of uninitialized probability.
authorJan Hubicka <hubicka@ucw.cz>
Tue, 4 Jul 2017 13:41:21 +0000 (15:41 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Tue, 4 Jul 2017 13:41:21 +0000 (13:41 +0000)
* bb-reorder.c (better_edge_p): Fix handling of uninitialized
probability.

From-SVN: r249966

gcc/ChangeLog
gcc/bb-reorder.c

index 27df4b86c0c670e0cad04e2f3b7960a3ff23b25e..5a1659d01c0fa07e86036f706270c219dad8c137 100644 (file)
@@ -1,3 +1,8 @@
+2017-07-04  Jan Hubicka  <hubicka@ucw.cz>
+
+       * bb-reorder.c (better_edge_p): Fix handling of uninitialized
+       probability.
+
 2017-07-04  Richard Sandiford  <richard.sandiford@linaro.org>
 
        PR tree-optimization/81292
index ebd8b481a9215766ccc16dcf991dda9f6d6b4598..1994c1f7a5f29241c4a4ac076ac334bba60c02b3 100644 (file)
@@ -957,7 +957,7 @@ better_edge_p (const_basic_block bb, const_edge e, profile_probability prob,
     return !cur_best_edge
           || cur_best_edge->dest->index > e->dest->index;
 
-  if (prob > best_prob + diff_prob)
+  if (prob > best_prob + diff_prob || !best_prob.initialized_p ())
     /* The edge has higher probability than the temporary best edge.  */
     is_better_edge = true;
   else if (prob < best_prob - diff_prob)