[Bug tree-optimization/59058] [4.7/4.8/4.9 Regression] wrong code at -O3 on x86_64-linux-gnu (affecting gcc 4.6 to trunk)
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Nov 20 11:45:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59058
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think the issue is
(set_nb_iterations_in_loop = ~(unsigned short) pretmp_22))
t.c:12:6: note: ==> get_loop_niters:-(unsigned short) pretmp_22
that is, number_of_exit_cond_executions which returns
number_of_latch_executions + 1 but does not check for overflow.
It checks
ret = chrec_fold_plus (type, ret, build_int_cst (type, 1));
if (TREE_CODE (ret) == INTEGER_CST
&& TREE_OVERFLOW (ret))
return chrec_dont_know;
but obviously that only works for constants.
It might be best to eliminate uses of number_of_exit_cond_executions
in favor of number_of_latch_executions (while adjusting users of course,
vectorization and loop distribution). We can also use a wider
type here (within certain limits, of course).
More information about the Gcc-bugs
mailing list