summaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-04 16:07:16 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-04 16:07:16 +0000
commit216b9a909552fa214d02497b678b3148bb0dce35 (patch)
tree943f45a871d217f4134ea2fc5063f979456aedb8 /libgomp
parentfe2071be0020d8e518b140353d5ce04e2820d9a4 (diff)
downloadgcc-216b9a909552fa214d02497b678b3148bb0dce35.tar.gz
* task.c (GOMP_taskgroup_end): If taskgroup->num_children
is not zero, but taskgroup->children is NULL and there are any task->children, schedule those instead of waiting. * testsuite/libgomp.c/depend-6.c: New test. * testsuite/libgomp.c/depend-7.c: New test. * testsuite/libgomp.c/depend-8.c: New test. * testsuite/libgomp.c/depend-9.c: New test. * testsuite/libgomp.c/depend-10.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch@213594 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/ChangeLog11
-rw-r--r--libgomp/task.c38
-rw-r--r--libgomp/testsuite/libgomp.c/depend-10.c3
-rw-r--r--libgomp/testsuite/libgomp.c/depend-6.c3
-rw-r--r--libgomp/testsuite/libgomp.c/depend-7.c3
-rw-r--r--libgomp/testsuite/libgomp.c/depend-8.c3
-rw-r--r--libgomp/testsuite/libgomp.c/depend-9.c3
7 files changed, 44 insertions, 20 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index acaa6a2d509..d9d5db7c3c7 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,14 @@
+2014-08-04 Jakub Jelinek <jakub@redhat.com>
+
+ * task.c (GOMP_taskgroup_end): If taskgroup->num_children
+ is not zero, but taskgroup->children is NULL and there are
+ any task->children, schedule those instead of waiting.
+ * testsuite/libgomp.c/depend-6.c: New test.
+ * testsuite/libgomp.c/depend-7.c: New test.
+ * testsuite/libgomp.c/depend-8.c: New test.
+ * testsuite/libgomp.c/depend-9.c: New test.
+ * testsuite/libgomp.c/depend-10.c: New test.
+
2014-08-01 Jakub Jelinek <jakub@redhat.com>
* libgomp.h (struct gomp_task_depend_entry): Add redundant_out field.
diff --git a/libgomp/task.c b/libgomp/task.c
index 58750eacf53..7d3233c6e1b 100644
--- a/libgomp/task.c
+++ b/libgomp/task.c
@@ -1115,18 +1115,26 @@ GOMP_taskgroup_end (void)
if (taskgroup->children == NULL)
{
if (taskgroup->num_children)
- goto do_wait;
- gomp_mutex_unlock (&team->task_lock);
- if (to_free)
{
- gomp_finish_task (to_free);
- free (to_free);
+ if (task->children == NULL)
+ goto do_wait;
+ child_task = task->children;
+ }
+ else
+ {
+ gomp_mutex_unlock (&team->task_lock);
+ if (to_free)
+ {
+ gomp_finish_task (to_free);
+ free (to_free);
+ }
+ goto finish;
}
- goto finish;
}
- if (taskgroup->children->kind == GOMP_TASK_WAITING)
+ else
+ child_task = taskgroup->children;
+ if (child_task->kind == GOMP_TASK_WAITING)
{
- child_task = taskgroup->children;
cancelled
= gomp_task_run_pre (child_task, child_task->parent, taskgroup,
team);
@@ -1143,6 +1151,7 @@ GOMP_taskgroup_end (void)
}
else
{
+ child_task = NULL;
do_wait:
/* All tasks we are waiting for are already running
in other threads. Wait for them. */
@@ -1174,20 +1183,9 @@ GOMP_taskgroup_end (void)
finish_cancelled:;
size_t new_tasks
= gomp_task_run_post_handle_depend (child_task, team);
- child_task->prev_taskgroup->next_taskgroup
- = child_task->next_taskgroup;
- child_task->next_taskgroup->prev_taskgroup
- = child_task->prev_taskgroup;
- --taskgroup->num_children;
- if (taskgroup->children == child_task)
- {
- if (child_task->next_taskgroup != child_task)
- taskgroup->children = child_task->next_taskgroup;
- else
- taskgroup->children = NULL;
- }
gomp_task_run_post_remove_parent (child_task);
gomp_clear_parent (child_task->children);
+ gomp_task_run_post_remove_taskgroup (child_task);
to_free = child_task;
child_task = NULL;
team->task_count--;
diff --git a/libgomp/testsuite/libgomp.c/depend-10.c b/libgomp/testsuite/libgomp.c/depend-10.c
new file mode 100644
index 00000000000..2137bf9471d
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/depend-10.c
@@ -0,0 +1,3 @@
+/* { dg-set-target-env-var OMP_NUM_THREADS "1" } */
+
+#include "depend-5.c"
diff --git a/libgomp/testsuite/libgomp.c/depend-6.c b/libgomp/testsuite/libgomp.c/depend-6.c
new file mode 100644
index 00000000000..d30e6e9dd90
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/depend-6.c
@@ -0,0 +1,3 @@
+/* { dg-set-target-env-var OMP_NUM_THREADS "1" } */
+
+#include "depend-1.c"
diff --git a/libgomp/testsuite/libgomp.c/depend-7.c b/libgomp/testsuite/libgomp.c/depend-7.c
new file mode 100644
index 00000000000..bd4a3f9dec0
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/depend-7.c
@@ -0,0 +1,3 @@
+/* { dg-set-target-env-var OMP_NUM_THREADS "1" } */
+
+#include "depend-2.c"
diff --git a/libgomp/testsuite/libgomp.c/depend-8.c b/libgomp/testsuite/libgomp.c/depend-8.c
new file mode 100644
index 00000000000..4dcce671c09
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/depend-8.c
@@ -0,0 +1,3 @@
+/* { dg-set-target-env-var OMP_NUM_THREADS "1" } */
+
+#include "depend-3.c"
diff --git a/libgomp/testsuite/libgomp.c/depend-9.c b/libgomp/testsuite/libgomp.c/depend-9.c
new file mode 100644
index 00000000000..a52c47ac6db
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/depend-9.c
@@ -0,0 +1,3 @@
+/* { dg-set-target-env-var OMP_NUM_THREADS "1" } */
+
+#include "depend-4.c"