This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
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.
-- Marc Glisse
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |