On Tue, Aug 9, 2016 at 12:58 AM, kugan <kugan.vivekanandara...@linaro.org> wrote: > Hi Jakub, > > Thanks for the review. > > On 08/08/16 16:40, Jakub Jelinek wrote: >> >> On Mon, Aug 08, 2016 at 01:36:51PM +1000, kugan wrote: >>> >>> diff --git a/gcc/tree-ssanames.h b/gcc/tree-ssanames.h >>> index c81b1a1..6e34433 100644 >>> --- a/gcc/tree-ssanames.h >>> +++ b/gcc/tree-ssanames.h >>> @@ -43,6 +43,9 @@ struct GTY(()) ptr_info_def >>> above alignment. Access only through the same helper functions as >>> align >>> above. */ >>> unsigned int misalign; >>> + /* When this pointer is knonw to be nnonnull this would be true >>> otherwise >>> + false. */ >>> + bool nonnull_p; >>> }; >> >> >> Why do you need this? Doesn't the pt.null bit represent that already? > > > It looks like I can use this. As in gcc/tree-ssa-alias.h: > > /* Nonzero if the points-to set includes 'nothing', the points-to set > includes memory at address NULL. */ > unsigned int null : 1; > > But in gcc/tree-ssa-alias.c, ptrs_compare_unequal has the following comment > which says: > > /* ??? We'd like to handle ptr1 != NULL and ptr1 != ptr2 > but those require pt.null to be conservatively correct. */ > > Does that means it can be wrong at times? I haven't looked it in detail yet > but if it is, it would be a problem.
Yes, this bit is not correctly computed for all cases (well, it works for trivial ones but for example misses weaks and maybe some other corner-cases). Currently there are no consumers of this bit so the incorrectness doesn't matter. I suggest you simply use that bit but set it conservatively from PTA (to true) for now and adjust it from VRP only. I do have some patches for fixinig some of the .nonnull_p issues in PTA but they come at a cost of more constraints. Richard. >> Also, formatting and spelling: >> s/knonw/known/ >> s/nnon/non/ >> s/bool /bool / > > > I will change this. > > Thanks, > Kugan >> >> >> Jakub >> >