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

--- Comment #2 from Andrew Macleod <amacleod at redhat dot com> ---
I see
=========== BB 2 ============
    <bb 2> :
    if (j_3(D) > i_4(D))
      goto <bb 3>; [INV]
    else
      goto <bb 4>; [INV]
=========== BB 3 ============
    <bb 3> :
    __builtin_unreachable ();
=========== BB 4 ============
j_3(D)  unsigned int VARYING
i_4(D)  unsigned int VARYING
    <bb 4> :
    _5 = .SUB_OVERFLOW (i_4(D), j_3(D));
    _1 = IMAGPART_EXPR <_5>;
    _2 = (_Bool) _1;
    _8 = _1;
    return _8;

gimple_range_adjustment currently recognizes the SUB_OVERFLOW/IMAGPART_EXPR
pattern and marks _1 as having range [0,1].

Once we can query if i_4 >= j_3, it should be pretty straightforward to change
the range of _1 to [0,0] or [1,1] as appropriate, which should then propagate
to the return.

Reply via email to