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).

Reply via email to