Drop TREE_OVERFLOW
authorKugan Vivekanandarajah <kuganv@linaro.org>
Fri, 23 Sep 2016 10:25:09 +0000 (10:25 +0000)
committerKugan Vivekanandarajah <kugan@gcc.gnu.org>
Fri, 23 Sep 2016 10:25:09 +0000 (10:25 +0000)
gcc/ChangeLog:

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

PR ipa/77677
* ipa-cp.c (propagate_vr_accross_jump_function): Drop TREE_OVERFLOW
from constant while creating value range.

gcc/testsuite/ChangeLog:

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

PR ipa/77677
* gcc.dg/torture/pr77677.c: New test.

From-SVN: r240420

gcc/ChangeLog
gcc/ipa-cp.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr77677.c [new file with mode: 0644]

index 210d7f9be2924e9063099e9d61526e62e7e87ea2..d1226159df0a3e2963e1ef8ce5cc1f9464d55f43 100644 (file)
@@ -1,3 +1,9 @@
+2016-09-23  Kugan Vivekanandarajah  <kuganv@linaro.org>
+
+       PR ipa/77677
+       * ipa-cp.c (propagate_vr_accross_jump_function): Drop TREE_OVERFLOW
+       from constant while creating value range.
+
 2016-09-23  Renlin Li  <renlin.li@arm.com>
 
        * ira.c (ira): Move ira_use_lra_p initialization code to ...
index fdcce16f412eebe5f8dbcd4a3219f1604376e968..95a2a1e4b3aab39f593ed6e9f53f8f3ef461225d 100644 (file)
@@ -2065,6 +2065,8 @@ propagate_vr_accross_jump_function (cgraph_edge *cs,
       tree val = ipa_get_jf_constant (jfunc);
       if (TREE_CODE (val) == INTEGER_CST)
        {
+         if (TREE_OVERFLOW_P (val))
+           val = drop_tree_overflow (val);
          jfunc->vr_known = true;
          jfunc->m_vr.type = VR_RANGE;
          jfunc->m_vr.min = val;
index 488e5db5f50d26e65c5654102307bfd7d5d266f0..150aff91eadca99afd4165f0e75cc33c71afbad3 100644 (file)
@@ -1,3 +1,8 @@
+2016-09-23  Kugan Vivekanandarajah  <kuganv@linaro.org>
+
+       PR ipa/77677
+       * gcc.dg/torture/pr77677.c: New test.
+
 2016-09-23  Andre Vehreschild  <vehre@gcc.gnu.org>
 
        * gfortran.dg/coarray_lib_comm_1.f90: Using the old caf-interface
diff --git a/gcc/testsuite/gcc.dg/torture/pr77677.c b/gcc/testsuite/gcc.dg/torture/pr77677.c
new file mode 100644 (file)
index 0000000..af3f0b0
--- /dev/null
@@ -0,0 +1,18 @@
+/* PR ipa/77677 */
+/* { dg-do compile } */
+
+int a, b;
+
+static void fn1 (short p1)
+{
+  a = -p1;
+  if (a || b)
+    __builtin_printf ("%d\n", b);
+}
+
+int main ()
+{
+  int c[] = { 40000 };
+  fn1 (c[0]);
+  return 0;
+}