From f75036994f9d6945265d02cb29de502d6d7d538d Mon Sep 17 00:00:00 2001 From: Kugan Vivekanandarajah Date: Fri, 21 Oct 2016 20:13:55 +0000 Subject: ADDR_EXPR and nonnull ADDR_EXPR and nonnull gcc/ChangeLog: 2016-10-21 Kugan Vivekanandarajah * ipa-prop.c (ipa_compute_jump_functions_for_edge): Create nonzero value range for pointers in more cases. gcc/testsuite/ChangeLog: 2016-10-21 Kugan Vivekanandarajah * gcc.dg/ipa/vrp5.c: New test. * gcc.dg/ipa/vrp6.c: New test. From-SVN: r241428 --- gcc/ipa-prop.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gcc/ipa-prop.c') diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 353b638..1629870 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -1670,9 +1670,17 @@ ipa_compute_jump_functions_for_edge (struct ipa_func_body_info *fbi, if (POINTER_TYPE_P (TREE_TYPE (arg))) { + bool addr_nonzero = false; + bool strict_overflow = false; + if (TREE_CODE (arg) == SSA_NAME && param_type && get_ptr_nonnull (arg)) + addr_nonzero = true; + else if (tree_single_nonzero_warnv_p (arg, &strict_overflow)) + addr_nonzero = true; + + if (addr_nonzero) { jfunc->vr_known = true; jfunc->m_vr.type = VR_ANTI_RANGE; -- cgit v1.1