openmp: Fix handling of allocate clause on taskloop
authorJakub Jelinek <jakub@redhat.com>
Fri, 30 Oct 2020 08:18:36 +0000 (09:18 +0100)
committerJakub Jelinek <jakub@redhat.com>
Fri, 30 Oct 2020 08:18:36 +0000 (09:18 +0100)
commit71e713209adcb3b7f65d14906eb200317cc1c2ae
tree8de62c1db565afb998d7f751f3abf12c1b6fd813
parent5a6b1d8ef4218a1a2ed6d43c6ee058db9c417bc8
openmp: Fix handling of allocate clause on taskloop

This patch fixes gimplification of allocate clause on taskloop - puts
allocate on inner taskloop only if there is allocate clause, because otherwise
the data sharing clauses are only on the task construct in the construct sandwich.

2020-10-30  Jakub Jelinek  <jakub@redhat.com>

* gimplify.c (gimplify_scan_omp_clauses): Force
OMP_CLAUSE_ALLOCATE_ALLOCATOR into a temporary if it is non-NULL and
non-constant.
(gimplify_omp_for): Only put allocate on inner taskloop if lastprivate
for the same variable is going to be put there, and in that case
if the OMP_CLAUSE_ALLOCATE_ALLOCATOR is non-NULL non-constant, make
the allocator firstprivate on task.

* c-c++-common/gomp/allocate-3.c: New test.
gcc/gimplify.c
gcc/testsuite/c-c++-common/gomp/allocate-3.c [new file with mode: 0644]