http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55168



--- Comment #2 from Jan Hubicka <hubicka at ucw dot cz> 2012-11-01 20:49:18 UTC 
---

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;

Reply via email to