Use ipa-vrp result in tree-vrp
authorKugan Vivekanandarajah <kuganv@linaro.org>
Tue, 20 Sep 2016 23:41:01 +0000 (23:41 +0000)
committerKugan Vivekanandarajah <kugan@gcc.gnu.org>
Tue, 20 Sep 2016 23:41:01 +0000 (23:41 +0000)
gcc/ChangeLog:

2016-09-21  Kugan Vivekanandarajah  <kuganv@linaro.org>

 * tree-vrp.c (get_value_range): Teach PARM_DECL to use ipa-vrp
 results.

gcc/testsuite/ChangeLog:

2016-09-21  Kugan Vivekanandarajah  <kuganv@linaro.org>

* 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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/guality/pr54519-1.c
gcc/testsuite/gcc.dg/torture/ftrapv-1.c
gcc/tree-vrp.c

index a3118fc504291a1594cd9f147f8511b2b92afa13..4f2f973c1d3413f791a18801f57859a52e0321be 100644 (file)
@@ -1,3 +1,8 @@
+2016-09-21  Kugan Vivekanandarajah  <kuganv@linaro.org>
+
+        * tree-vrp.c (get_value_range): Teach PARM_DECL to use ipa-vrp
+        results.
+
 2016-09-21  Kugan Vivekanandarajah  <kuganv@linaro.org>
 
        * common.opt: New option -fipa-vrp.
index 936c48c21c4149c5fb59fd99764bd90c262f5ccc..006607b19ab6e33516112ec90716aa7742a7b0a3 100644 (file)
@@ -1,3 +1,9 @@
+2016-09-21  Kugan Vivekanandarajah  <kuganv@linaro.org>
+
+       * 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  <kuganv@linaro.org>
 
        * g++.dg/ipa/pure-const-3.C: Add -fno-ipa-vrp. Else constant arguments
index 98afd45c18f8ddb0f6604ff4983db03a8a6ca3f6..e98dcb91107d412b2fdccf1acb8a383c417001a4 100644 (file)
@@ -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)
index c74535fc238fee902f22c47691fb4cbb8d1b3e2b..66fa33f1568563c053ec7204b59537c810b468ce 100644 (file)
@@ -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 "" } */
 
index e779759d3816b8f0cfffcd097d20163ab969a542..3c75a0d98852854a80cef104be02e9a888450842 100644 (file)
@@ -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);
        }