]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Only allow single exit phi for reduction in try_create_reduction_list
authorTom de Vries <tom@codesourcery.com>
Sun, 10 Jan 2016 09:12:03 +0000 (09:12 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Sun, 10 Jan 2016 09:12:03 +0000 (09:12 +0000)
2016-01-10  Tom de Vries  <tom@codesourcery.com>

PR tree-optimization/69039
* tree-parloops.c (try_create_reduction_list): Only allow single exit
phi for reduction.

* gcc.dg/autopar/pr69039.c: New test.

From-SVN: r232196

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/autopar/pr69039.c [new file with mode: 0644]
gcc/tree-parloops.c

index 609a6a3eab8971262010216bb08dd3fa5bdc6627..21b47fea57924dc7ece6a3be398327a70c3bb01d 100644 (file)
@@ -1,3 +1,9 @@
+2016-01-10  Tom de Vries  <tom@codesourcery.com>
+
+       PR tree-optimization/69039
+       * tree-parloops.c (try_create_reduction_list): Only allow single exit
+       phi for reduction.
+
 2016-01-09  John David Anglin  <danglin@gcc.gnu.org>
 
        PR middle-end/68743
index 4af4374cea6b8eb103db375fd3e74c218e99dab7..198f26c3cab4c389c8c579a0aee250fc9caf3d58 100644 (file)
@@ -1,3 +1,8 @@
+2016-01-10  Tom de Vries  <tom@codesourcery.com>
+
+       PR tree-optimization/69039
+       * gcc.dg/autopar/pr69039.c: New test.
+
 2016-01-09  Marek Polacek  <polacek@redhat.com>
 
        PR c++/69113
diff --git a/gcc/testsuite/gcc.dg/autopar/pr69039.c b/gcc/testsuite/gcc.dg/autopar/pr69039.c
new file mode 100644 (file)
index 0000000..556f700
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-parallelize-loops=2" } */
+
+unsigned int b;
+
+unsigned int
+fn1 (unsigned int d)
+{
+  int i;
+
+  for (i = 0; i < 1000; i++)
+    b |= d;
+
+  return b;
+}
index 84f18bd8f034a54c36e92c240980ac5690401317..394aba8d121f68b6afdd79bb1ba85bb412e01db9 100644 (file)
@@ -2595,6 +2595,14 @@ try_create_reduction_list (loop_p loop,
                         "  FAILED: it is not a part of reduction.\n");
              return false;
            }
+         if (red->keep_res != NULL)
+           {
+             if (dump_file && (dump_flags & TDF_DETAILS))
+               fprintf (dump_file,
+                        "  FAILED: reduction has multiple exit phis.\n");
+             return false;
+           }
+         red->keep_res = phi;
          if (dump_file && (dump_flags & TDF_DETAILS))
            {
              fprintf (dump_file, "reduction phi is  ");