--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-1.c.jj	2018-11-09 13:53:25.626769600 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-1.c	2018-11-09 13:39:37.933450741 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 0, 0, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_maybe_nonmonotonic_runtime_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (runtime)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-2.c.jj	2018-11-09 13:53:25.648769236 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-2.c	2018-11-09 13:39:37.936450691 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483648|-2147483648), 0, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_runtime_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (monotonic: runtime)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-3.c.jj	2018-11-09 13:53:25.670768872 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-3.c	2018-11-09 13:39:37.938450658 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 4, 0, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_runtime_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (nonmonotonic: runtime)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-4.c.jj	2018-11-09 13:53:25.693768492 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-4.c	2018-11-09 13:39:37.939450641 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-5.c.jj	2018-11-09 13:53:25.714768145 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-5.c	2018-11-09 13:39:37.940450625 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (static)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-6.c.jj	2018-11-09 13:53:25.716768112 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-6.c	2018-11-09 13:39:37.940450625 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (monotonic: static)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-7.c.jj	2018-11-09 13:53:25.718768079 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-7.c	2018-11-09 13:39:37.940450625 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (nonmonotonic: static)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-8.c.jj	2018-11-09 13:53:25.720768046 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-8.c	2018-11-09 13:39:37.940450625 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (static, 2)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-9.c.jj	2018-11-09 13:53:25.722768013 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-9.c	2018-11-09 13:39:37.940450625 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (monotonic: static, 2)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-10.c.jj	2018-11-09 13:53:25.605769948 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-10.c	2018-11-09 13:39:37.930450791 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (nonmonotonic: static, 2)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-11.c.jj	2018-11-09 13:53:25.608769899 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-11.c	2018-11-09 13:39:37.931450774 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 2, 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_dynamic_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (dynamic)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-12.c.jj	2018-11-09 13:53:25.610769865 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-12.c	2018-11-09 13:39:37.931450774 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483650|-2147483646), 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_dynamic_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (monotonic: dynamic)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-13.c.jj	2018-11-09 13:53:25.612769832 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-13.c	2018-11-09 13:39:37.931450774 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 2, 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_dynamic_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (nonmonotonic: dynamic)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-14.c.jj	2018-11-09 13:53:25.615769782 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-14.c	2018-11-09 13:39:37.931450774 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 2, 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_dynamic_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (dynamic, 3)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-15.c.jj	2018-11-09 13:53:25.616769766 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-15.c	2018-11-09 13:39:37.932450757 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483650|-2147483646), 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_dynamic_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (monotonic: dynamic, 3)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-16.c.jj	2018-11-09 13:53:25.618769733 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-16.c	2018-11-09 13:39:37.932450757 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 2, 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_dynamic_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (nonmonotonic: dynamic, 3)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-17.c.jj	2018-11-09 13:53:25.620769699 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-17.c	2018-11-09 13:39:37.932450757 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 3, 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_guided_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (guided)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-18.c.jj	2018-11-09 13:53:25.622769666 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-18.c	2018-11-09 13:39:37.932450757 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483651|-2147483645), 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_guided_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (monotonic: guided)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-19.c.jj	2018-11-09 13:53:25.624769633 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-19.c	2018-11-09 13:39:37.933450741 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 3, 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_guided_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (nonmonotonic: guided)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-20.c.jj	2018-11-09 13:53:25.628769567 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-20.c	2018-11-09 13:39:37.933450741 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 3, 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_guided_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (guided, 3)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-21.c.jj	2018-11-09 13:53:25.630769533 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-21.c	2018-11-09 13:39:37.933450741 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483651|-2147483645), 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_guided_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (monotonic: guided, 3)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-22.c.jj	2018-11-09 13:53:25.632769500 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-22.c	2018-11-09 13:39:37.934450724 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 3, 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_guided_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (nonmonotonic: guided, 3)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-23.c.jj	2018-11-09 13:53:25.634769467 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-23.c	2018-11-09 13:39:37.934450724 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (auto)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-24.c.jj	2018-11-09 13:53:25.636769434 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-24.c	2018-11-09 13:39:37.934450724 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (monotonic: auto)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-25.c.jj	2018-11-09 13:53:25.638769401 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-25.c	2018-11-09 13:39:37.935450708 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (nonmonotonic: auto)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-26.c.jj	2018-11-09 13:53:25.640769368 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-26.c	2018-11-09 13:39:37.935450708 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, 0, 0, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_maybe_nonmonotonic_runtime_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (runtime)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-27.c.jj	2018-11-09 13:53:25.642769335 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-27.c	2018-11-09 13:39:37.935450708 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, (?:2147483648|-2147483648), 0, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_runtime_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (monotonic: runtime)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-28.c.jj	2018-11-09 13:53:25.644769302 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-28.c	2018-11-09 13:39:37.935450708 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, 4, 0, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_nonmonotonic_runtime_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (nonmonotonic: runtime)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-29.c.jj	2018-11-09 13:53:25.646769269 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-29.c	2018-11-09 13:39:37.936450691 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-30.c.jj	2018-11-09 13:53:25.650769203 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-30.c	2018-11-09 13:39:37.936450691 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (static)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-31.c.jj	2018-11-09 13:53:25.652769170 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-31.c	2018-11-09 13:39:37.936450691 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (monotonic: static)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-32.c.jj	2018-11-09 13:53:25.654769137 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-32.c	2018-11-09 13:39:37.937450674 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (nonmonotonic: static)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-33.c.jj	2018-11-09 13:53:25.656769103 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-33.c	2018-11-09 13:39:37.937450674 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (static, 2)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-34.c.jj	2018-11-09 13:53:25.658769070 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-34.c	2018-11-09 13:39:37.937450674 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (monotonic: static, 2)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-35.c.jj	2018-11-09 13:53:25.660769037 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-35.c	2018-11-09 13:39:37.938450658 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (nonmonotonic: static, 2)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-36.c.jj	2018-11-09 13:53:25.662769004 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-36.c	2018-11-09 13:39:37.938450658 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, 2, 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_nonmonotonic_dynamic_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (dynamic)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-37.c.jj	2018-11-09 13:53:25.664768971 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-37.c	2018-11-09 13:39:37.938450658 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, (?:2147483650|-2147483646), 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_dynamic_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (monotonic: dynamic)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-38.c.jj	2018-11-09 13:53:25.666768938 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-38.c	2018-11-09 13:39:37.938450658 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, 2, 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_nonmonotonic_dynamic_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (nonmonotonic: dynamic)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-39.c.jj	2018-11-09 13:53:25.668768905 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-39.c	2018-11-09 13:39:37.938450658 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, 2, 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_nonmonotonic_dynamic_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (dynamic, 3)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-40.c.jj	2018-11-09 13:53:25.672768839 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-40.c	2018-11-09 13:39:37.938450658 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, (?:2147483650|-2147483646), 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_dynamic_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (monotonic: dynamic, 3)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-41.c.jj	2018-11-09 13:53:25.674768806 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-41.c	2018-11-09 13:39:37.938450658 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, 2, 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_nonmonotonic_dynamic_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (nonmonotonic: dynamic, 3)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-42.c.jj	2018-11-09 13:53:25.676768773 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-42.c	2018-11-09 13:39:37.938450658 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, 3, 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_nonmonotonic_guided_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (guided)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-43.c.jj	2018-11-09 13:53:25.678768740 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-43.c	2018-11-09 13:39:37.938450658 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, (?:2147483651|-2147483645), 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_guided_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (monotonic: guided)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-44.c.jj	2018-11-09 13:53:25.680768707 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-44.c	2018-11-09 13:39:37.939450641 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, 3, 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_nonmonotonic_guided_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (nonmonotonic: guided)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-45.c.jj	2018-11-09 13:53:25.682768674 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-45.c	2018-11-09 13:39:37.939450641 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, 3, 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_nonmonotonic_guided_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (guided, 3)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-46.c.jj	2018-11-09 13:53:25.684768641 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-46.c	2018-11-09 13:39:37.939450641 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, (?:2147483651|-2147483645), 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_guided_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (monotonic: guided, 3)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-47.c.jj	2018-11-09 13:53:25.687768591 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-47.c	2018-11-09 13:39:37.939450641 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, 3, 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_nonmonotonic_guided_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (nonmonotonic: guided, 3)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-48.c.jj	2018-11-09 13:53:25.689768558 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-48.c	2018-11-09 13:39:37.939450641 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (auto)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-49.c.jj	2018-11-09 13:53:25.691768525 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-49.c	2018-11-09 13:39:37.939450641 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (monotonic: auto)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-50.c.jj	2018-11-09 13:53:25.695768459 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-50.c	2018-11-09 13:39:37.939450641 +0100
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for reduction (task, *: j) schedule (nonmonotonic: auto)
+  for (i = a; i < b; i += c)
+    {
+      j++;
+      bar (&j);
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-51.c.jj	2018-11-09 13:53:25.697768426 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-51.c	2018-11-09 13:39:37.939450641 +0100
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ordered_start \[^\n\r]*, (?:2147483648|-2147483648), 0, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_ordered_start " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_ordered_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ordered_runtime_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for ordered reduction (task, *: j) schedule (runtime)
+  for (i = a; i < b; i += c)
+    {
+      bar (&j);
+      #pragma omp ordered
+      j++;
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-52.c.jj	2018-11-09 13:53:25.699768393 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-52.c	2018-11-09 13:39:37.939450641 +0100
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ordered_start \[^\n\r]*, (?:2147483649|-2147483647), 0, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_ordered_start " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_ordered_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ordered_static_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for ordered reduction (task, *: j)
+  for (i = a; i < b; i += c)
+    {
+      bar (&j);
+      #pragma omp ordered
+      j++;
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-53.c.jj	2018-11-09 13:53:25.701768360 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-53.c	2018-11-09 13:39:37.939450641 +0100
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ordered_start \[^\n\r]*, (?:2147483650|-2147483646), 4, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_ordered_start " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_ordered_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ordered_dynamic_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for ordered reduction (task, *: j) schedule (dynamic, 4)
+  for (i = a; i < b; i += c)
+    {
+      bar (&j);
+      #pragma omp ordered
+      j++;
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-54.c.jj	2018-11-09 13:53:25.703768327 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-54.c	2018-11-09 13:39:37.940450625 +0100
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_ordered_start \[^\n\r]*, (?:2147483651|-2147483645), 6, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_ordered_start " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_ordered_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_ordered_guided_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for ordered reduction (task, *: j) schedule (guided, 6)
+  for (i = a; i < b; i += c)
+    {
+      bar (&j);
+      #pragma omp ordered
+      j++;
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-55.c.jj	2018-11-09 13:53:25.705768294 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-55.c	2018-11-09 13:43:02.831063465 +0100
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_doacross_start \[^\n\r]*, (?:2147483648|-2147483648), 0, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_post " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_wait " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_runtime_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for ordered(1) reduction (task, *: j) schedule (runtime)
+  for (i = a; i < b; i += c)
+    {
+      bar (&j);
+      #pragma omp ordered depend(sink: i - 1)
+      j++;
+      #pragma omp ordered depend(source)
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-56.c.jj	2018-11-09 13:53:25.707768261 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-56.c	2018-11-09 13:51:59.124199322 +0100
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_doacross_start \[^\n\r]*, (?:2147483649|-2147483647), 0, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_ull_post " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_ull_wait " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_static_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for ordered(1) reduction (task, *: j)
+  for (i = a; i < b; i += c)
+    {
+      bar (&j);
+      #pragma omp ordered depend(sink: i - 1)
+      j++;
+      #pragma omp ordered depend(source)
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-57.c.jj	2018-11-09 13:53:25.709768228 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-57.c	2018-11-09 13:52:10.375013368 +0100
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_doacross_start \[^\n\r]*, (?:2147483650|-2147483646), 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_ull_post " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_ull_wait " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_dynamic_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+  unsigned long long int i;
+  #pragma omp parallel
+  #pragma omp for ordered(1) reduction (task, *: j) schedule (dynamic)
+  for (i = a; i < b; i += c)
+    {
+      bar (&j);
+      #pragma omp ordered depend(sink: i - 1)
+      j++;
+      #pragma omp ordered depend(source)
+    }
+}
--- gcc/testsuite/gcc.dg/gomp/workshare-reduction-58.c.jj	2018-11-09 13:53:25.712768178 +0100
+++ gcc/testsuite/gcc.dg/gomp/workshare-reduction-58.c	2018-11-09 13:47:04.341071509 +0100
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_doacross_start \[^\n\r]*, (?:2147483651|-2147483645), 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_post " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_wait " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_guided_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+  int i;
+  #pragma omp parallel
+  #pragma omp for ordered(1) reduction (task, *: j) schedule (guided)
+  for (i = a; i < b; i += c)
+    {
+      bar (&j);
+      #pragma omp ordered depend(sink: i - 1)
+      j++;
+      #pragma omp ordered depend(source)
+    }
+}
--- libgomp/testsuite/libgomp.c-c++-common/task-reduction-13.c.jj	2018-11-09 11:12:06.562877812 +0100
+++ libgomp/testsuite/libgomp.c-c++-common/task-reduction-13.c	2018-11-09 11:08:59.131970289 +0100
@@ -0,0 +1,50 @@
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void abort (void);
+#pragma omp declare reduction (foo: int: omp_out += omp_in - 1) initializer (omp_priv = 1)
+
+int
+main ()
+{
+  int i, v = 0;
+  unsigned long long j;
+  volatile unsigned long long sixtyfour = 64;
+  int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0;
+  #pragma omp parallel
+  {
+#define P(str) _Pragma (#str)
+#define ONE_ORDERED_LOOP(var, i, max, n, clauses...) \
+    P (omp for ordered reduction (task, foo: var) clauses)		  \
+    for (i = 0; i < max; i++)						  \
+      {									  \
+        var++;								  \
+        P (omp task in_reduction (foo: var))				  \
+	var++;								  \
+	_Pragma ("omp ordered")						  \
+	if (v++ != i + n)						  \
+	  abort ();							  \
+      }									  \
+    if (var != 128 || v != 64 + n)					  \
+      abort ();								  \
+    _Pragma ("omp barrier")
+    ONE_ORDERED_LOOP (a, i, 64, 0, )
+    ONE_ORDERED_LOOP (b, i, 64, 64, schedule (monotonic: static))
+    ONE_ORDERED_LOOP (c, i, 64, 128, schedule (static, 1))
+    ONE_ORDERED_LOOP (d, i, 64, 192, schedule (monotonic: runtime))
+    ONE_ORDERED_LOOP (e, i, 64, 256, schedule (dynamic, 2))
+    ONE_ORDERED_LOOP (f, i, 64, 320, schedule (monotonic: guided, 3))
+    ONE_ORDERED_LOOP (g, i, 64, 384, schedule (auto))
+    #pragma omp single
+    { v = 0; a = 0; b = 0; c = 0; d = 0; e = 0; f = 0; g = 0; }
+    ONE_ORDERED_LOOP (a, j, sixtyfour, 0, )
+    ONE_ORDERED_LOOP (b, j, sixtyfour, 64, schedule (static))
+    ONE_ORDERED_LOOP (c, j, sixtyfour, 128, schedule (monotonic: static, 1))
+    ONE_ORDERED_LOOP (d, j, sixtyfour, 192, schedule (runtime))
+    ONE_ORDERED_LOOP (e, j, sixtyfour, 256, schedule (monotonic: dynamic, 2))
+    ONE_ORDERED_LOOP (f, j, sixtyfour, 320, schedule (guided, 3))
+    ONE_ORDERED_LOOP (g, j, sixtyfour, 384, schedule (monotonic: auto))
+  }
+  return 0;
+}
--- libgomp/testsuite/libgomp.c-c++-common/task-reduction-14.c.jj	2018-11-09 11:22:51.646233263 +0100
+++ libgomp/testsuite/libgomp.c-c++-common/task-reduction-14.c	2018-11-09 11:22:10.366914416 +0100
@@ -0,0 +1,51 @@
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void abort (void);
+#pragma omp declare reduction (foo: int: omp_out += omp_in - 1) initializer (omp_priv = 1)
+
+int
+main ()
+{
+  int i, v = 0;
+  unsigned long long j;
+  volatile unsigned long long sixtyfour = 64;
+  int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0;
+  #pragma omp parallel
+  {
+#define P(str) _Pragma (#str)
+#define ONE_ORDERED_LOOP(var, i, max, n, clauses...) \
+    P (omp for ordered(1) reduction (task, foo: var) clauses)		  \
+    for (i = 1; i <= max; i++)						  \
+      {									  \
+        P (omp task in_reduction (foo: var))				  \
+	var++;								  \
+	P (omp ordered depend(sink: i - 1))				  \
+	if (v++ != i + n - 1)						  \
+	  abort ();							  \
+        _Pragma ("omp ordered depend(source)")				  \
+        var++;								  \
+      }									  \
+    if (var != 128 || v != 64 + n)					  \
+      abort ();								  \
+    _Pragma ("omp barrier")
+    ONE_ORDERED_LOOP (a, i, 64, 0, )
+    ONE_ORDERED_LOOP (b, i, 64, 64, schedule (monotonic: static))
+    ONE_ORDERED_LOOP (c, i, 64, 128, schedule (static, 1))
+    ONE_ORDERED_LOOP (d, i, 64, 192, schedule (monotonic: runtime))
+    ONE_ORDERED_LOOP (e, i, 64, 256, schedule (dynamic, 2))
+    ONE_ORDERED_LOOP (f, i, 64, 320, schedule (monotonic: guided, 3))
+    ONE_ORDERED_LOOP (g, i, 64, 384, schedule (auto))
+    #pragma omp single
+    { v = 0; a = 0; b = 0; c = 0; d = 0; e = 0; f = 0; g = 0; }
+    ONE_ORDERED_LOOP (a, j, sixtyfour, 0, )
+    ONE_ORDERED_LOOP (b, j, sixtyfour, 64, schedule (static))
+    ONE_ORDERED_LOOP (c, j, sixtyfour, 128, schedule (monotonic: static, 1))
+    ONE_ORDERED_LOOP (d, j, sixtyfour, 192, schedule (runtime))
+    ONE_ORDERED_LOOP (e, j, sixtyfour, 256, schedule (monotonic: dynamic, 2))
+    ONE_ORDERED_LOOP (f, j, sixtyfour, 320, schedule (guided, 3))
+    ONE_ORDERED_LOOP (g, j, sixtyfour, 384, schedule (monotonic: auto))
+  }
+  return 0;
+}
