On 1/19/23 09:41, Jakub Jelinek wrote:

+         range_query *q = get_range_query (cfun);
+         if (q == get_global_range_query ())
+           q = enable_ranger (cfun);

Oh, neat.  Clever.  I hadn't thought about that.

+         if (!q->range_of_expr (r, rotcnt, check_range_stmt))
+           {
+             if (check_range > 0)
+               return false;
+             r.set_varying (TREE_TYPE (rotcnt));
+           }
          int prec = TYPE_PRECISION (TREE_TYPE (rotcnt));
          signop sign = TYPE_SIGN (TREE_TYPE (rotcnt));
          wide_int min = wide_int::from (TYPE_PRECISION (rtype), prec, sign);
          wide_int max = wide_int::from (wider_prec - 1, prec, sign);
-         int_range<2> r2 (TREE_TYPE (rotcnt), min, max);
+         if (check_range < 0)
+           max = min;
+         int_range<1> r2 (TREE_TYPE (rotcnt), min, max);
>      r.intersect (r2);

Currently int_range<1> is a legacy range (anti ranges and such internally). It's better to use <2> as the use of r2 will have to be converted to a multi-range before intersecting. FYI, <2> is the smallest multi-range.

This is really an implementation detail, so don't bother changing it, even though it's slightly slower. In the next release we'll nuke legacy, and <1> will mean what you think it means...the smallest range with one sub-range (and none of that anti range business internally).

Thanks.
Aldy

Reply via email to