aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorKwok Cheung Yeung <kcyeung@baylibre.com>2024-09-12 21:33:58 +0100
committerSandra Loosemore <sloosemore@baylibre.com>2025-05-15 20:25:53 +0000
commit90a497c233380b43e36dafaa6688ca45b2ba4f35 (patch)
treea388f0b5c65a52a824ab90d2ad9871d1ecf84755 /gcc/c
parent5418d2ad283c7cadb35fa920bc18353c1821739d (diff)
downloadgcc-90a497c233380b43e36dafaa6688ca45b2ba4f35.zip
gcc-90a497c233380b43e36dafaa6688ca45b2ba4f35.tar.gz
gcc-90a497c233380b43e36dafaa6688ca45b2ba4f35.tar.bz2
openmp: Disable strided target updates when iterators are used
Non-contiguous target updates result in the new strided target updates code being used, resulting in new clauses such as GOMP_MAP_GRID_DIM, GOMP_MAP_GRID_STRIDE etc. These are not currently supported in conjunction with iterators, so this code-path is disabled when used together with iterators. The older target updates supports non-contiguous updates as long as a stride is not applied. gcc/c/ * c-typeck.cc (handle_omp_array_sections): Add extra argument. Set argument to true if array section has a stride that is not one. (c_finish_omp_clauses): Disable strided updates when iterators are used in the clause. Emit sorry if strided. gcc/cp/ * semantics.cc (handle_omp_array_sections): Add extra argument. Set argument to true if array section has a stride that is not one. (finish_omp_clauses): Disable strided updates when iterators are used in the clause. Emit sorry if strided. gcc/fortran/ * trans-openmp.cc (gfc_trans_omp_clauses): Disable strided updates when iterators are used in the clause.
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/c-typeck.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
index d8471e9..cefff5b 100644
--- a/gcc/c/c-typeck.cc
+++ b/gcc/c/c-typeck.cc
@@ -15675,7 +15675,7 @@ omp_array_section_low_bound (location_t loc, tree node)
static bool
handle_omp_array_sections (tree *pc, tree **pnext, enum c_omp_region_type ort,
- int *discontiguous)
+ int *discontiguous, bool *strided = NULL)
{
tree c = *pc;
bool maybe_zero_len = false;
@@ -15764,6 +15764,8 @@ handle_omp_array_sections (tree *pc, tree **pnext, enum c_omp_region_type ort,
if (stride == NULL_TREE)
stride = size_one_node;
+ if (strided && !integer_onep (stride))
+ *strided = true;
if (discontiguous && *discontiguous)
{
/* This condition is similar to the error check below, but
@@ -17292,13 +17294,22 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
grp_sentinel = OMP_CLAUSE_CHAIN (c);
tree *pnext = NULL;
+ /* FIXME: Strided target updates not supported together with
+ iterators yet. */
int discontiguous
= (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_TO
- || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FROM);
- if (handle_omp_array_sections (pc, &pnext, ort, &discontiguous))
+ || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FROM)
+ && !OMP_CLAUSE_ITERATORS (c);
+ bool strided = false;
+ if (handle_omp_array_sections (pc, &pnext, ort, &discontiguous,
+ &strided))
remove = true;
else
{
+ if ((OMP_CLAUSE_CODE (c) == OMP_CLAUSE_TO
+ || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FROM)
+ && OMP_CLAUSE_ITERATORS (c) && strided)
+ sorry ("strided target updates with iterators");
c = *pc;
t = OMP_CLAUSE_DECL (c);
if (!omp_mappable_type (TREE_TYPE (t)))