From 7fd4f180b4cca4766001ad06dd21cd3c82181eaa Mon Sep 17 00:00:00 2001 From: Kugan Vivekanandarajah Date: Mon, 17 Oct 2016 23:39:55 +0000 Subject: [PATCH] Use get_ptr_nonnull in tree-vrp Use get_ptr_nonnull in tree-vrp gcc/testsuite/ChangeLog: 2016-10-18 Kugan Vivekanandarajah * gcc.dg/ipa/vrp4.c: Adjust testcase. gcc/ChangeLog: 2016-10-18 Kugan Vivekanandarajah * tree-vrp.c (get_value_range): Check get_ptr_nonnull. From-SVN: r241289 --- gcc/ChangeLog | 4 ++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/ipa/vrp4.c | 3 ++- gcc/tree-vrp.c | 3 ++- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1c603468525..0d3bd896aac 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2016-10-18 Kugan Vivekanandarajah + + * tree-vrp.c (get_value_range): Check get_ptr_nonnull. + 2016-10-18 Kugan Vivekanandarajah * ipa-prop.c (ipa_compute_jump_functions_for_edge): Set value range diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 94048db18e5..b962485a50a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-10-18 Kugan Vivekanandarajah + + * gcc.dg/ipa/vrp4.c: Adjust testcase. + 2016-10-18 Kugan Vivekanandarajah * gcc.dg/ipa/vrp4.c: New test. diff --git a/gcc/testsuite/gcc.dg/ipa/vrp4.c b/gcc/testsuite/gcc.dg/ipa/vrp4.c index d7e1f26d23b..941f80e00b2 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 b11fc64dd8d..eb3eebd44d5 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.30.2