This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fixing the wrapping issue
James A. Morrison wrote:
> > + tree i_plus_s = fold_build2 (PLUS_EXPR, integer_type_node, init, step);
> > + tree sign = fold_build2 (GT_EXPR, boolean_type_node, i_plus_s, init);
>
> Why not use tree_int_cst_sgn (step) == -1?
>
> > - record_estimate (loop, estimation, boolean_true_node, stmt);
> > + if (sign == boolean_true_node)
> > + estimation = fold_build2 (CEIL_DIV_EXPR, integer_type_node,
> > + fold_build2 (MINUS_EXPR, integer_type_node,
> > + data_size, init), step);
> > +
> > + /* When the step is negative, as in PR23386: (init = 3, step =
> > + 0ffffffff, data_size = 100), we have to compute the
because a step of 0ffffffff is the unsigned way to say -1.