Message ID | 2cfe50b8-1841-2b1a-9baa-1464cebd953b@linaro.org |
---|---|
State | Superseded |
Headers | show |
Hi Richard, On 12/10/16 23:24, Richard Biener wrote: > On Wed, Oct 12, 2016 at 8:56 AM, kugan > <kugan.vivekanandarajah@linaro.org> wrote: >> Hi, >> >> This patch uses get_ptr_nonnull in tree-vrp. >> >> Bootstrapped and regression tested this with other patched without any >> new regressions on x86_64-linux-gnu. >> >> Is this OK for trunk? > > Um. Doesn't make much sense given nothing provides this info before EVRP? > And if it makes sense then it makes sense not only for PARM_DECL SSA names. Not before EVRP. But when in TREE-VRP, EVRP + IPA-VRP should provide this. I am not sure if this is the question? Thanks, Kugan > > Richard. > >> Thanks, >> Kugan >> >> gcc/testsuite/ChangeLog: >> >> 2016-10-12 Kugan Vivekanandarajah <kugan.vivekanandarajah@linaro.org> >> >> * gcc.dg/ipa/vrp4.c: Adjust testcase. >> >> gcc/ChangeLog: >> >> 2016-10-12 Kugan Vivekanandarajah <kugan.vivekanandarajah@linaro.org> >> >> * tree-vrp.c (get_value_range): Check get_ptr_nonnull.
From 56e57ed72e44f22285d1f9de204ff8f98f6c08d2 Mon Sep 17 00:00:00 2001 From: Kugan Vivekanandarajah <kugan.vivekanandarajah@linaro.org> Date: Wed, 12 Oct 2016 13:54:58 +1100 Subject: [PATCH 3/3] Teach-vrp-to-use-ptr-nonnull --- gcc/testsuite/gcc.dg/ipa/vrp4.c | 3 ++- gcc/tree-vrp.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/gcc.dg/ipa/vrp4.c b/gcc/testsuite/gcc.dg/ipa/vrp4.c index d7e1f26..941f80e 100644 --- a/gcc/testsuite/gcc.dg/ipa/vrp4.c +++ b/gcc/testsuite/gcc.dg/ipa/vrp4.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-ipa-cp-details" } */ +/* { dg-options "-O2 -fdump-ipa-cp-details -fdump-tree-vrp1" } */ static __attribute__((noinline, noclone)) int foo (int *p) @@ -25,3 +25,4 @@ int bar (struct st *s) } /* { dg-final { scan-ipa-dump "Setting nonnull for 0" "cp" } } */ +/* { dg-final { scan-tree-dump-times "if" 1 "vrp1" } } */ diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 7e4f947..f9e5936 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -685,7 +685,8 @@ get_value_range (const_tree var) anti-ranges for pointers. Note that this is only valid with default definitions of PARM_DECLs. */ if (POINTER_TYPE_P (TREE_TYPE (sym)) - && nonnull_arg_p (sym)) + && (nonnull_arg_p (sym) + || get_ptr_nonnull (var))) set_value_range_to_nonnull (vr, TREE_TYPE (sym)); else if (INTEGRAL_TYPE_P (TREE_TYPE (sym))) { -- 2.7.4