aboutsummaryrefslogtreecommitdiff
path: root/move-if-change
diff options
context:
space:
mode:
authorKwok Cheung Yeung <kcyeung@baylibre.com>2026-02-12 14:48:03 +0000
committerKwok Cheung Yeung <kcyeung@baylibre.com>2026-02-12 16:47:39 +0000
commit6eec7a3687aa8195eaf6b7f6694b50ece17590c5 (patch)
treef5e16af75d376e03f78ee4042ae4efe958ef2c4b /move-if-change
parente0bbad05caa63910c012adc64f73d375e1d2a3ca (diff)
downloadgcc-master.zip
gcc-master.tar.gz
gcc-master.tar.bz2
openmp: Allocate memory for private/firstprivate clauses as directed by allocate clauses in target constructs [PR113436]HEADtrunkmaster
This patch generates calls to GOMP_alloc to allocate memory for firstprivate and private clauses on target constructs with an allocator and alignment as specified by the allocate clause. The decl values of the clause need to be adjusted to refer to the allocated memory, and the initial values of variables need to be copied into the allocated space for firstprivate variables. For variable-length arrays, the size of the array is stored in a separate variable, so the allocation and initialization need to be delayed until the size is made available on the target. gcc/ PR middle-end/113436 * omp-low.cc (is_variable_sized): Add extra is_ref argument. Check referenced type if true. (lower_omp_target): Call lower_private_allocate to generate code to allocate memory for firstprivate/private clauses with allocators, and insert code after dependent variables have been initialized. Construct calls to free allocate memory and insert after target block. Adjust decl values for clause variables. Copy value of firstprivate variables to allocated memory. gcc/testsuite/ PR middle-end/113436 * c-c++-common/gomp/pr113436-1.c: New. * c-c++-common/gomp/pr113436-2.c: New. * g++.dg/gomp/pr113436.C: New. * gfortran.dg/gomp/pr113436-1.f90: New. * gfortran.dg/gomp/pr113436-2.f90: New. * gfortran.dg/gomp/pr113436-3.f90: New. * gfortran.dg/gomp/pr113436-4.f90: New. libgomp/ PR middle-end/113436 * libgomp.texi (OpenMP 5.0): Mark allocate clause as implemented. (Memory allocation): Add documentation for use in target construct. * testsuite/libgomp.c++/firstprivate-1.C: Enable alignment check. * testsuite/libgomp.c++/pr113436-1.C: New. * testsuite/libgomp.c++/pr113436-2.C: New. * testsuite/libgomp.c++/private-1.C: Enable alignment check. * testsuite/libgomp.c-c++-common/pr113436-1.c: New. * testsuite/libgomp.c-c++-common/pr113436-2.c: New. * testsuite/libgomp.fortran/pr113436-1.f90: New. * testsuite/libgomp.fortran/pr113436-2.f90: New.
Diffstat (limited to 'move-if-change')
0 files changed, 0 insertions, 0 deletions