@@ -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);
@@ -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);
@@ -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" } } */
deleted file mode 100644
@@ -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;
-}