This is the mail archive of the
mailing list for the GCC project.
Re: [RFC] Isolate & simplify paths with undefined behaviour
- From: Marc Glisse <marc dot glisse at inria dot fr>
- To: Jeff Law <law at redhat dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 18 Oct 2013 22:31:41 +0200 (CEST)
- Subject: Re: [RFC] Isolate & simplify paths with undefined behaviour
- Authentication-results: sourceware.org; auth=none
- References: <52616BFC dot 6010205 at redhat dot com> <alpine dot DEB dot 2 dot 10 dot 1310182019300 dot 4203 at laptop-mg dot saclay dot inria dot fr> <52618D60 dot 9090101 at redhat dot com>
- Reply-to: gcc-patches at gcc dot gnu dot org
On Fri, 18 Oct 2013, Jeff Law wrote:
On 10/18/13 12:47, Marc Glisse wrote:
I'm not sure what can really be shared here -- this patch searches for PHIs
where one or more of the args is a NULL pointer. The NULL pointer will be
explicit in the PHI arg.
* tree-vrp has a function infer_nonnull_range, do you think we could
share it? We now store the VRP ranges for integers, but not for
pointers. If we did (or maybe just a non-null bit), the pass could just
test that bit on the variable found in the PHI.
But once you have that pointer defined by a PHI containing a zero, you
look at all its uses, trying to find one that proves the pointer is
non-zero (only dereferences for now, but you have a comment about the
non-null attribute). And infer_nonnull_range precisely says whether a
statement proves that a pointer is non-zero (well, there may be a few
subtle differences, and some tests might need to move between
infer_value_range and infer_nonnull_range). I am just talking of replacing
20 lines of code with a function call, not a huge sharing I agree...
Storing the VRP info might not actually help, since you need to know
starting from which statement the pointer is non-zero.