This actually looks like a previously latent issue in predict.c For all but
estimate_num_iterations_int. It uses the funny definition of number of
iterations (i.e. 0 means that loop will exit at first invocation of the exit
condition and that is what it will be predicted with when nitercst == 1.
Index: predict.c
===================================================================
--- predict.c (revision 193062)
+++ predict.c (working copy)
@@ -1433,8 +1437,8 @@ predict_loops (void)
the loop, use it to predict this exit. */
else if (n_exits == 1)
{
- nitercst = estimated_stmt_executions_int (loop);
- if (nitercst < 0)
+ nitercst = estimated_stmt_executions_int (loop) + 1;
+ if (nitercst <= 0)
continue;
if (nitercst > max)
nitercst = max;