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

--- Comment #10 from Andrew Macleod <amacleod at redhat dot com> ---
Created attachment 49597
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49597&action=edit
op2_range implementation

I think this does what you want for op2_range.

I tried it with:

void f1 (int i, int j)
{
  if ((i % j) == 3)
    {
      xx = ((j <= 3) && (j >= -3));
      if (xx)
        kill ();
    }
}

and it eliminates the call. the listing shows:
    if (_1 == 3)
      goto <bb 3>; [INV]
    else
      goto <bb 5>; [INV]

_1 : int [-2147483647, +INF]
2->3  (T) _1 :  int [3, 3]
2->3  (T) i_8(D) :      int [3, +INF]
2->3  (T) j_9(D) :      int [-INF, -4][4, +INF]
2->5  (F) _1 :  int [-2147483647, 2][4, +INF]

so its got int [-INF, -4][4, +INF] for the range which I think is correct?

I got a headache trying to write a testcase for the different cases, and I'd
probably get it wrong like I did with the initial implementation..  So I leave
this with you to do what you will :-) 

I get all tangled up with the negatives.

Reply via email to