On 3/4/25 2:10 AM, Jakub Jelinek wrote:
Hi!

On Fri, Nov 22, 2024 at 07:25:23PM -0500, Andrew MacLeod wrote:
  I will shortly be submitting , and presumable committing, this patch as
part of a series to improve VRP time for 117467..

So it may be in place by the time you need it

On 11/18/24 09:31, Andrew MacLeod wrote:
Attached is a pre-approved patch which adds a range_query to the
inferred range mechanism.

The only change you will need to make is to replace "get_range_query
(cfun)->"  with "q->" which is passed in.

This regstraps on x86 without your patch, and I got as far as a
bootstrap with your patches..

Sorry for the delay.  Only recently the remaining patches have been
committed, so I'm getting back to this.

The current state of the trunk is that it handles constant arg2 (if it is
zero or non-zero) and punts on everything else.

I've changed get_range_query (cfun)-> to q-> but unfortunately the test
FAILs with it, while it improves the if (n >= 42) case where there is a
SSA_NAME for n - 10, it doesn't improve the if (n) case, so it feels like
it is querying just the global range rather than the local one from the
statement, because on the foo (b, n); statement which is guarded by if (n)
n should be provably [1, SIZE_MAX].

The patch still bootstraps/regtests on x86_64-linux and i686-linux
and improves at least something, so I guess I could just comment out part
of the testcase.  Any thoughts why this happens though?  And is that something
that can be improved for GCC 15 or should wait for GCC 16?

2025-03-04  Jakub Jelinek  <ja...@redhat.com>
            Andrew MacLeod  <amacl...@redhat.com>

        PR c/117023
        * gimple-range-infer.cc (gimple_infer_range::gimple_infer_range):
        For nonnull_if_nonzero attribute check also arg2 range if it doesn't
        include zero and in that case call add_nonzero too.

        * gcc.dg/tree-ssa/pr78154-2.c: New test.
Feels like it should defer to gcc-16. But I'll defer (haha) to Jakub's judgment on whether or not fixing this up for gcc-15 is critical.

jeff

Reply via email to