On Wed, 19 Oct 2016, kugan wrote: > Hi Richard, > > > On 19/10/16 19:23, Richard Biener wrote: > > On Wed, 19 Oct 2016, kugan wrote: > > > > > Hi, > > > > > > While computing jump function value range for pointer, I am wondering if > > > we > > > can assume that any tree with ADDR_EXPR will be nonnull. > > > > > > That is, in cases like: > > > > > > int arr[10]; > > > foo (&arr[1]); > > > > > > OR > > > > > > struct st > > > { > > > int a; > > > int b; > > > }; > > > struct st s2; > > > foo (&s2.a); > > > > > > Attached patch tries to do this. I am not sure if this can be wrong. Any > > > thoughts? > > > > It can be wrong for weak symbols for example. > Would excluding weak symbols (I believe I can check DECL_WEAK for this) good > enough. Or looking for acceptable subset would work?
I think we should add a symtab helper to tell if address_nonzero_p (if that doesn't aleady exist). Richard. > Thanks, > Kugan > > > > > Richard. > > > > > Attached patch bootstraps and regression testing didn't introduce any new > > > regressions. > > > > > > Thanks, > > > Kugan > > > > > > > > > gcc/ChangeLog: > > > > > > 2016-10-19 Kugan Vivekanandarajah <kug...@linaro.org> > > > > > > * ipa-prop.c (ipa_compute_jump_functions_for_edge): Set > > > value range to nonull for ADDR_EXPR. > > > > > > gcc/testsuite/ChangeLog: > > > > > > 2016-10-19 Kugan Vivekanandarajah <kug...@linaro.org> > > > > > > * gcc.dg/ipa/vrp5.c: New test. > > > * gcc.dg/ipa/vrp6.c: New test. > > > > > > > -- Richard Biener <rguent...@suse.de> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)