]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: [multiple changes]
authorRichard Biener <rguenther@suse.de>
Tue, 24 Feb 2015 14:05:46 +0000 (14:05 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 24 Feb 2015 14:05:46 +0000 (14:05 +0000)
2015-02-24  Richard Biener  <rguenther@suse.de>

Backport from mainline
2014-12-09  Richard Biener  <rguenther@suse.de>

PR middle-end/64199
* fold-const.c (fold_binary_loc): Use TREE_OVERFLOW_P.

* gcc.dg/torture/pr64199.c: New testcase.

2015-01-14  Richard Biener  <rguenther@suse.de>

PR tree-optimization/64493
PR tree-optimization/64495
* tree-vect-loop.c (vect_finalize_reduction): For double-reductions
assign the proper vectorized PHI to the inner loop exit PHIs.

* gcc.dg/vect/pr64493.c: New testcase.
* gcc.dg/vect/pr64495.c: Likewise.

From-SVN: r220940

gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr64199.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/vect/pr64493.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/vect/pr64495.c [new file with mode: 0644]
gcc/tree-vect-loop.c

index a3ebfc56fdfe0dccd6f1504f1e8ed7b0f8da3854..2231c35aef85aaf457303184494de43047271013 100644 (file)
@@ -1,3 +1,18 @@
+2015-02-24  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2014-12-09  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/64199
+       * fold-const.c (fold_binary_loc): Use TREE_OVERFLOW_P.
+
+       2015-01-14  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/64493
+       PR tree-optimization/64495
+       * tree-vect-loop.c (vect_finalize_reduction): For double-reductions
+       assign the proper vectorized PHI to the inner loop exit PHIs.
+
 2015-02-24  Richard Biener  <rguenther@suse.de>
 
        Backport from mainline
index 9e7536a7b213d6d17f96eb4cc5d6ff99d1c07214..30d50ce696fe487ed16706583906c3a9272a269f 100644 (file)
@@ -10601,8 +10601,8 @@ fold_binary_loc (location_t loc,
 
              /* Don't introduce overflows through reassociation.  */
              if (!any_overflows
-                 && ((lit0 && TREE_OVERFLOW (lit0))
-                     || (minus_lit0 && TREE_OVERFLOW (minus_lit0))))
+                 && ((lit0 && TREE_OVERFLOW_P (lit0))
+                     || (minus_lit0 && TREE_OVERFLOW_P (minus_lit0))))
                return NULL_TREE;
 
              if (minus_lit0)
index 68bc4f604ec659d72110bfb4152dd45d85f5b39f..2dfe1002ea52151553e1aed7fe855b0e23784aed 100644 (file)
@@ -1,3 +1,18 @@
+2015-02-24  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2014-12-09  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/64199
+       * gcc.dg/torture/pr64199.c: New testcase.
+
+       2015-01-14  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/64493
+       PR tree-optimization/64495
+       * gcc.dg/vect/pr64493.c: New testcase.
+       * gcc.dg/vect/pr64495.c: Likewise.
+
 2015-02-24  Richard Biener  <rguenther@suse.de>
 
        Backport from mainline
diff --git a/gcc/testsuite/gcc.dg/torture/pr64199.c b/gcc/testsuite/gcc.dg/torture/pr64199.c
new file mode 100644 (file)
index 0000000..e3f1002
--- /dev/null
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-ffast-math -frounding-math" } */
+
+float
+foo (void)
+{
+  return 1.1f + 2.2f + 2.2f;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr64493.c b/gcc/testsuite/gcc.dg/vect/pr64493.c
new file mode 100644 (file)
index 0000000..a7dee4d
--- /dev/null
@@ -0,0 +1,31 @@
+/* { dg-do run } */
+
+#include "tree-vect.h"
+
+int a, b, c, d, e, f, g, h;
+
+int
+main ()
+{
+  check_vect ();
+
+  for (; a; a--)
+    for (d = 1; d <= 0; d++)
+      for (; d;)
+       if (h)
+         {
+           if (!g) __builtin_abort ();
+           if (!0) __builtin_abort ();
+         }
+
+  for (f = 4; f; f--)
+    {
+      for (b = 0; b < 2; b++)
+       c |= 1;
+      e |= c;
+    }
+
+  return 0;
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr64495.c b/gcc/testsuite/gcc.dg/vect/pr64495.c
new file mode 100644 (file)
index 0000000..aad8752
--- /dev/null
@@ -0,0 +1,35 @@
+/* { dg-do run } */
+
+#include <assert.h>
+#include "tree-vect.h"
+
+int a, b, c, d, e, f, g, i, j;
+static int *h = &e;
+
+int
+main ()
+{
+  check_vect ();
+
+  for (; a;)
+    for (; g; g++)
+      for (; f; f++)
+       if (j)
+         {
+           assert(b); 
+           assert(0);
+         }
+  for (i = 24; i; i--)
+    {
+      for (c = 0; c < 6; c++)
+       d |= 1;
+      *h |= d;
+    }
+
+  if (e != 1) 
+    __builtin_abort (); 
+
+  return 0;
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
index dd10d87ffcb727a8f8f36623f001fbb108017d75..1d51a4e66a9d812a20850913e21a265273ea7655 100644 (file)
@@ -4362,7 +4362,10 @@ vect_finalize_reduction:
                            && !STMT_VINFO_LIVE_P (exit_phi_vinfo))
                           || double_reduc);
 
-              STMT_VINFO_VEC_STMT (exit_phi_vinfo) = epilog_stmt;
+             if (double_reduc)
+               STMT_VINFO_VEC_STMT (exit_phi_vinfo) = inner_phi;
+             else
+               STMT_VINFO_VEC_STMT (exit_phi_vinfo) = epilog_stmt;
               if (!double_reduc
                   || STMT_VINFO_DEF_TYPE (exit_phi_vinfo)
                       != vect_double_reduction_def)