public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-13] Revert "openmp: Handle C/C++ array reference base-pointers in array sections"
@ 2023-06-19 22:17 Julian Brown
0 siblings, 0 replies; only message in thread
From: Julian Brown @ 2023-06-19 22:17 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:aa88ebfa4d25d0ad025e750f0e8b1d612b28cab4
commit aa88ebfa4d25d0ad025e750f0e8b1d612b28cab4
Author: Julian Brown <julian@codesourcery.com>
Date: Thu May 18 16:43:18 2023 +0000
Revert "openmp: Handle C/C++ array reference base-pointers in array sections"
This reverts commit 3385743fd2fa15a2a750a29daf6d4f97f5aad0ae.
2023-06-16 Julian Brown <julian@codesourcery.com>
Revert:
2022-02-24 Chung-Lin Tang <cltang@codesourcery.com>
gcc/c/ChangeLog:
* c-typeck.cc (handle_omp_array_sections): Add handling for
creating array-reference base-pointer attachment clause.
gcc/cp/ChangeLog:
* semantics.cc (handle_omp_array_sections): Add handling for
creating array-reference base-pointer attachment clause.
gcc/testsuite/ChangeLog:
* c-c++-common/gomp/target-enter-data-1.c: Adjust testcase.
libgomp/ChangeLog:
* testsuite/libgomp.c-c++-common/ptr-attach-2.c: New test.
Diff:
---
gcc/c/ChangeLog.omp | 8 +++
gcc/c/c-typeck.cc | 27 +---------
gcc/cp/ChangeLog.omp | 8 +++
gcc/cp/semantics.cc | 28 +---------
gcc/testsuite/ChangeLog.omp | 7 +++
.../c-c++-common/gomp/target-enter-data-1.c | 3 +-
libgomp/ChangeLog.omp | 7 +++
.../testsuite/libgomp.c-c++-common/ptr-attach-2.c | 60 ----------------------
8 files changed, 33 insertions(+), 115 deletions(-)
diff --git a/gcc/c/ChangeLog.omp b/gcc/c/ChangeLog.omp
index 48cf1edd443..b7caed6f931 100644
--- a/gcc/c/ChangeLog.omp
+++ b/gcc/c/ChangeLog.omp
@@ -1,3 +1,11 @@
+2023-06-19 Julian Brown <julian@codesourcery.com>
+
+ Revert:
+ 2022-02-24 Chung-Lin Tang <cltang@codesourcery.com>
+
+ * c-typeck.cc (handle_omp_array_sections): Add handling for
+ creating array-reference base-pointer attachment clause.
+
2023-06-13 Sandra Loosemore <sandra@codesourcery.com>
* c-parser.cc (struct c_parser): Add omp_for_parse_state field.
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
index 450214556f9..9591d67251e 100644
--- a/gcc/c/c-typeck.cc
+++ b/gcc/c/c-typeck.cc
@@ -14113,10 +14113,6 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort)
if (int_size_in_bytes (TREE_TYPE (first)) <= 0)
maybe_zero_len = true;
- struct dim { tree low_bound, length; };
- auto_vec<dim> dims (num);
- dims.safe_grow (num);
-
for (i = num, t = OMP_CLAUSE_DECL (c); i > 0;
t = TREE_CHAIN (t))
{
@@ -14238,9 +14234,6 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort)
else
size = size_binop (MULT_EXPR, size, l);
}
-
- dim d = { low_bound, length };
- dims[i] = d;
}
if (non_contiguous)
{
@@ -14288,23 +14281,6 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort)
OMP_CLAUSE_DECL (c) = t;
return false;
}
-
- tree aref = t;
- for (i = 0; i < dims.length (); i++)
- {
- if (dims[i].length && integer_onep (dims[i].length))
- {
- tree lb = dims[i].low_bound;
- aref = build_array_ref (OMP_CLAUSE_LOCATION (c), aref, lb);
- }
- else
- {
- if (TREE_CODE (TREE_TYPE (aref)) == POINTER_TYPE)
- t = aref;
- break;
- }
- }
-
first = c_fully_fold (first, false, NULL);
OMP_CLAUSE_DECL (c) = first;
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_HAS_DEVICE_ADDR)
@@ -14339,8 +14315,7 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort)
break;
}
tree c2 = build_omp_clause (OMP_CLAUSE_LOCATION (c), OMP_CLAUSE_MAP);
- if (TREE_CODE (t) == COMPONENT_REF || TREE_CODE (t) == ARRAY_REF
- || TREE_CODE (t) == INDIRECT_REF)
+ if (TREE_CODE (t) == COMPONENT_REF)
OMP_CLAUSE_SET_MAP_KIND (c2, GOMP_MAP_ATTACH_DETACH);
else
OMP_CLAUSE_SET_MAP_KIND (c2, GOMP_MAP_FIRSTPRIVATE_POINTER);
diff --git a/gcc/cp/ChangeLog.omp b/gcc/cp/ChangeLog.omp
index 5f126c0c6c6..b6ed9b94fd5 100644
--- a/gcc/cp/ChangeLog.omp
+++ b/gcc/cp/ChangeLog.omp
@@ -1,3 +1,11 @@
+2023-06-19 Julian Brown <julian@codesourcery.com>
+
+ Revert:
+ 2022-02-24 Chung-Lin Tang <cltang@codesourcery.com>
+
+ * semantics.cc (handle_omp_array_sections): Add handling for
+ creating array-reference base-pointer attachment clause.
+
2023-06-13 Sandra Loosemore <sandra@codesourcery.com>
* cp-tree.h (cp_convert_omp_range_for): Adjust declaration.
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index e7bda6fa060..93ff7cf5e1b 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -5605,10 +5605,6 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort)
if (processing_template_decl && maybe_zero_len)
return false;
- struct dim { tree low_bound, length; };
- auto_vec<dim> dims (num);
- dims.safe_grow (num);
-
for (i = num, t = OMP_CLAUSE_DECL (c); i > 0;
t = TREE_CHAIN (t))
{
@@ -5728,9 +5724,6 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort)
else
size = size_binop (MULT_EXPR, size, l);
}
-
- dim d = { low_bound, length };
- dims[i] = d;
}
if (!processing_template_decl)
{
@@ -5782,24 +5775,6 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort)
OMP_CLAUSE_DECL (c) = t;
return false;
}
-
- tree aref = t;
- for (i = 0; i < dims.length (); i++)
- {
- if (dims[i].length && integer_onep (dims[i].length))
- {
- tree lb = dims[i].low_bound;
- aref = convert_from_reference (aref);
- aref = build_array_ref (OMP_CLAUSE_LOCATION (c), aref, lb);
- }
- else
- {
- if (TREE_CODE (TREE_TYPE (aref)) == POINTER_TYPE)
- t = aref;
- break;
- }
- }
-
OMP_CLAUSE_DECL (c) = first;
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_HAS_DEVICE_ADDR)
return false;
@@ -5841,8 +5816,7 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort)
bool reference_always_pointer = true;
tree c2 = build_omp_clause (OMP_CLAUSE_LOCATION (c),
OMP_CLAUSE_MAP);
- if (TREE_CODE (t) == COMPONENT_REF || TREE_CODE (t) == ARRAY_REF
- || (TREE_CODE (t) == INDIRECT_REF && !REFERENCE_REF_P (t)))
+ if (TREE_CODE (t) == COMPONENT_REF)
{
OMP_CLAUSE_SET_MAP_KIND (c2, GOMP_MAP_ATTACH_DETACH);
diff --git a/gcc/testsuite/ChangeLog.omp b/gcc/testsuite/ChangeLog.omp
index 887995991af..bbaede9b363 100644
--- a/gcc/testsuite/ChangeLog.omp
+++ b/gcc/testsuite/ChangeLog.omp
@@ -1,3 +1,10 @@
+2023-06-19 Julian Brown <julian@codesourcery.com>
+
+ Revert:
+ 2022-02-24 Chung-Lin Tang <cltang@codesourcery.com>
+
+ * c-c++-common/gomp/target-enter-data-1.c: Adjust testcase.
+
2023-06-19 Julian Brown <julian@codesourcery.com>
* c-c++-common/goacc/acc-data-chain.c: Partly disable test.
diff --git a/gcc/testsuite/c-c++-common/gomp/target-enter-data-1.c b/gcc/testsuite/c-c++-common/gomp/target-enter-data-1.c
index 3a1b488fa1f..ce766d29e2d 100644
--- a/gcc/testsuite/c-c++-common/gomp/target-enter-data-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/target-enter-data-1.c
@@ -21,5 +21,4 @@ void func (struct foo *f, int n, int m)
#pragma omp target enter data map (to: f->bars[n].vectors[:f->bars[n].num_vectors])
}
-/* { dg-final { scan-tree-dump-times "map\\(to:\\*_\[0-9\]+ \\\[len: _\[0-9\]+\\\]\\) map\\(attach:\\*_\[0-9\]+ \\\[bias: \[^\]\]+\\\]\\)" 1 "gimple" } } */
-/* { dg-final { scan-tree-dump-times "map\\(to:\\*_\[0-9\]+ \\\[len: _\[0-9\]+\\\]\\) map\\(attach:\[^-\]+->vectors \\\[bias: \[^\]\]+\\\]\\)" 2 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "map\\(to:\\*_\[0-9\]+ \\\[len: _\[0-9\]+\\\]\\) map\\(attach:\[^-\]+->vectors \\\[bias: \[^\]\]+\\\]\\)" 3 "gimple" } } */
diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index 0d84fe89497..13e7cbcbff9 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,3 +1,10 @@
+2023-06-19 Julian Brown <julian@codesourcery.com>
+
+ Revert:
+ 2022-02-24 Chung-Lin Tang <cltang@codesourcery.com>
+
+ * testsuite/libgomp.c-c++-common/ptr-attach-2.c: New test.
+
2023-06-19 Julian Brown <julian@codesourcery.com>
* testsuite/libgomp.oacc-c-c++-common/pr70828.c: XFAIL test.
diff --git a/libgomp/testsuite/libgomp.c-c++-common/ptr-attach-2.c b/libgomp/testsuite/libgomp.c-c++-common/ptr-attach-2.c
deleted file mode 100644
index 889a4a253ae..00000000000
--- a/libgomp/testsuite/libgomp.c-c++-common/ptr-attach-2.c
+++ /dev/null
@@ -1,60 +0,0 @@
-#include <stdlib.h>
-
-struct blk { int x, y; };
-struct L
-{
- #define N 10
- struct {
- int num_blocks[N];
- struct blk * blocks[N];
- } m;
-};
-
-void foo (struct L *l)
-{
- for (int i = 0; i < N; i++)
- {
- l->m.blocks[i] = (struct blk *) malloc (sizeof (struct blk) * N);
- l->m.num_blocks[i] = N;
- }
-
- #pragma omp target enter data map(to:l[:1])
- for (int i = 0; i < N; i++)
- {
- #pragma omp target enter data map(to:l->m.blocks[i][:l->m.num_blocks[i]])
- }
-
- #pragma omp target
- {
- for (int i = 0; i < N; i++)
- for (int j = 0; j < N; j++)
- {
- l->m.blocks[i][j].x = i + j;
- l->m.blocks[i][j].y = i * j;
- }
- }
-
- for (int i = 0; i < N; i++)
- {
- #pragma omp target exit data map(from:l->m.blocks[i][:l->m.num_blocks[i]])
- }
- #pragma omp target exit data map(from:l[:1])
-
-
- for (int i = 0; i < N; i++)
- for (int j = 0; j < N; j++)
- {
- if (l->m.blocks[i][j].x != i + j)
- abort ();
- if (l->m.blocks[i][j].y != i * j)
- abort ();
- }
-
-}
-
-int main (void)
-{
- struct L l;
- foo (&l);
- return 0;
-}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-06-19 22:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-19 22:17 [gcc/devel/omp/gcc-13] Revert "openmp: Handle C/C++ array reference base-pointers in array sections" Julian Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).