From: Kugan Vivekanandarajah Date: Tue, 20 Sep 2016 23:41:01 +0000 (+0000) Subject: Use ipa-vrp result in tree-vrp X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a03df1d582cef758fb03089a2c0b33cb8b1df6b6;p=gcc.git Use ipa-vrp result in tree-vrp gcc/ChangeLog: 2016-09-21 Kugan Vivekanandarajah * tree-vrp.c (get_value_range): Teach PARM_DECL to use ipa-vrp results. gcc/testsuite/ChangeLog: 2016-09-21 Kugan Vivekanandarajah * gcc.dg/guality/pr54519-1.c: Add -fno-ipa-vrp. Else constant arguments/compare will be optimized away. * gcc.dg/torture/ftrapv-1.c: Likewise. From-SVN: r240293 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a3118fc5042..4f2f973c1d3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-09-21 Kugan Vivekanandarajah + + * tree-vrp.c (get_value_range): Teach PARM_DECL to use ipa-vrp + results. + 2016-09-21 Kugan Vivekanandarajah * common.opt: New option -fipa-vrp. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 936c48c21c4..006607b19ab 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-09-21 Kugan Vivekanandarajah + + * gcc.dg/guality/pr54519-1.c: Add -fno-ipa-vrp. Else constant + arguments/compare will be optimized away. + * gcc.dg/torture/ftrapv-1.c: Likewise. + 2016-09-21 Kugan Vivekanandarajah * g++.dg/ipa/pure-const-3.C: Add -fno-ipa-vrp. Else constant arguments diff --git a/gcc/testsuite/gcc.dg/guality/pr54519-1.c b/gcc/testsuite/gcc.dg/guality/pr54519-1.c index 98afd45c18f..e98dcb91107 100644 --- a/gcc/testsuite/gcc.dg/guality/pr54519-1.c +++ b/gcc/testsuite/gcc.dg/guality/pr54519-1.c @@ -1,6 +1,6 @@ /* PR debug/54519 */ /* { dg-do run } */ -/* { dg-options "-g" } */ +/* { dg-options "-g -fno-ipa-vrp" } */ __attribute__((noinline, noclone)) void fn1 (int x) diff --git a/gcc/testsuite/gcc.dg/torture/ftrapv-1.c b/gcc/testsuite/gcc.dg/torture/ftrapv-1.c index c74535fc238..66fa33f1568 100644 --- a/gcc/testsuite/gcc.dg/torture/ftrapv-1.c +++ b/gcc/testsuite/gcc.dg/torture/ftrapv-1.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-additional-options "-ftrapv" } */ +/* { dg-additional-options "-ftrapv -fno-ipa-vrp" } */ /* { dg-require-effective-target trapping } */ /* { dg-require-fork "" } */ diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index e779759d381..3c75a0d9885 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -687,6 +687,18 @@ get_value_range (const_tree var) if (POINTER_TYPE_P (TREE_TYPE (sym)) && nonnull_arg_p (sym)) set_value_range_to_nonnull (vr, TREE_TYPE (sym)); + else if (INTEGRAL_TYPE_P (TREE_TYPE (sym))) + { + wide_int min, max; + value_range_type rtype = get_range_info (var, &min, &max); + if (rtype == VR_RANGE || rtype == VR_ANTI_RANGE) + set_value_range (vr, rtype, + wide_int_to_tree (TREE_TYPE (var), min), + wide_int_to_tree (TREE_TYPE (var), max), + NULL); + else + set_value_range_to_varying (vr); + } else set_value_range_to_varying (vr); }