[Bug tree-optimization/48189] [4.3/4.4/4.5/4.6/4.7 Regression] ICE: SIGFPE (division by zero) in in predict_loops () at predict.c:991 with --param max-predicted-iterations=0
steven at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Apr 10 13:33:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48189
Steven Bosscher <steven at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |steven at gcc dot gnu.org
--- Comment #3 from Steven Bosscher <steven at gcc dot gnu.org> 2011-04-10 13:33:30 UTC ---
I'd say probability is zero i.e. never executed, as a special case. Or if you
consider the edge always taken, then the probability should be
REG_BR_PROB_BASE.
But zero seems more consistent:
Index: predict.c
===================================================================
--- predict.c (revision 172225)
+++ predict.c (working copy)
@@ -988,7 +988,14 @@
else
continue;
- probability = ((REG_BR_PROB_BASE + nitercst / 2) / nitercst);
+ if (nitercst == 0 && predictor == PRED_LOOP_ITERATIONS)
+ /* If the prediction for number of iterations is zero, the exits
+ will never be taken. Only make this prediction if we are quite
+ sure that the loop will never roll, from analysis. */
+ probability = 0;
+ else
+ probability = ((REG_BR_PROB_BASE + nitercst / 2) / nitercst);
+
predict_edge (ex, predictor, probability);
}
VEC_free (edge, heap, exits);
Or maybe just not predict at all:
Index: predict.c
===================================================================
--- predict.c (revision 172225)
+++ predict.c (working copy)
@@ -988,6 +988,11 @@
else
continue;
+ /* If the prediction for number of iterations is zero, do not
+ predict the exit edges. */
+ if (nitercst == 0)
+ continue;
+
probability = ((REG_BR_PROB_BASE + nitercst / 2) / nitercst);
predict_edge (ex, predictor, probability);
}
More information about the Gcc-bugs
mailing list