[PATCH 1/2] Implement generic expression evaluator for range_query.

Aldy Hernandez aldyh@redhat.com
Thu Jun 3 15:39:30 GMT 2021


Andrew had some minor suggestions and cleanups after I posted this.

Andrew, is this what you had in mind?

Aldy

On Sat, May 29, 2021 at 6:06 AM Jeff Law <jeffreyalaw@gmail.com> wrote:
>
>
>
> On 5/27/2021 2:55 AM, Aldy Hernandez via Gcc-patches wrote:
> > Right now, range_of_expr only works with constants, SSA names, and
> > pointers.  Anything else gets returned as VARYING.  This patch adds the
> > capability to deal with arbitrary expressions, inasmuch as these
> > tree codes are implemented in range-ops.cc.
> >
> > This will give us the ability to ask for the range of any tree expression,
> > not just constants and SSA names, with range_of_expr().
> >
> > This is a more generic implementation of determine_value_range in VRP.
> > A follow-up patch will remove all uses of it in favor of the
> > range_query API.
> >
> > Tested on x86-64 Linux.
> >
> > OK?
> >
> > gcc/ChangeLog:
> >
> >       * function-tests.c (test_ranges): Call gimple_range_tests.
> >       * gimple-range-gori.cc (gori_compute::expr_range_at_stmt): Use
> >       get_global_range_query instead of get_tree_range.
> >       * gimple-range.cc (fur_source::get_operand): Add argument to
> >       get_tree_range.
> >       (get_arith_expr_range): New.
> >       (get_tree_range): Add gimple and range_query arguments.
> >       Call get_arith_expr_range.
> >       (gimple_ranger::range_of_expr): Add argument to get_tree_range.
> >       Include gimple-range-tests.cc.
> >       * gimple-range.h (get_tree_range): Add argument.
> >       * selftest.h (gimple_range_tests): New.
> >       * value-query.cc (global_range_query::range_of_expr): Add
> >       argument to get_tree_range.
> >       * vr-values.c (vr_values::range_of_expr): Same.
> >       * gimple-range-tests.cc: New file.
> Both patches in this series are fine.
>
> Thanks,
> Jeff
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Implement-generic-expression-evaluator-for-range_que.patch
Type: text/x-patch
Size: 12077 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210603/f171b35e/attachment.bin>


More information about the Gcc-patches mailing list