https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96697

--- Comment #4 from Andrew Macleod <amacleod at redhat dot com> ---
(In reply to Jakub Jelinek from comment #2)
> Shall we do that as a specific matcher or e.g. in the ranger once it gets
> code for symbolic comparisons?  I mean, for signed t = x % y note that t is
> in [-y + 1, y + 1] and on the division use that information to determine the
> division result range to be [0, 0] ?
> It could then handle even e.g. ((unsigned) x % y) / (y + 32) for signed y
> etc.

IN theory the ranger should handle this when relations are available.

    <bb 2> :
    _1 = x_2(D) % y_3(D);       // Establish relation _1 < y_3
    _4 = _1 / y_3(D);
    return _4;

IT should recognize the relation _1 < y_3 from the first statement and when we
calculate _1 / y_3, it again ought to then apply the relation and determine
that _4 = [0,0]

Reply via email to