]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Revert "Arrow operator handling for C front-end in OpenMP map clauses"
authorChung-Lin Tang <cltang@codesourcery.com>
Wed, 26 May 2021 11:11:56 +0000 (19:11 +0800)
committerChung-Lin Tang <cltang@codesourcery.com>
Sat, 29 May 2021 20:55:24 +0000 (04:55 +0800)
This reverts commit 60040dfff937acf02e44eb17902ea2d162f4d2ea.

gcc/c/c-parser.c
gcc/c/c-typeck.c
gcc/gimplify.c
gcc/testsuite/gcc.dg/gomp/target-3.c [deleted file]

index 0fc4ddb61e08a7687fd5eeee2021aa4f7e95e3e3..12d5c028850867fa6b033f3cb6a8ea5d70fdeacf 100644 (file)
@@ -15831,8 +15831,7 @@ c_parser_omp_clause_map (c_parser *parser, tree list)
       c_parser_consume_token (parser);
     }
 
-  nl = c_parser_omp_variable_list (parser, clause_loc, OMP_CLAUSE_MAP, list,
-                                  C_ORT_OMP, true);
+  nl = c_parser_omp_variable_list (parser, clause_loc, OMP_CLAUSE_MAP, list);
 
   for (c = nl; c != list; c = OMP_CLAUSE_CHAIN (c))
     OMP_CLAUSE_SET_MAP_KIND (c, kind);
index f5aa8af21bdd096a6808c31bffc5c2bf149c2054..98b10e27167a49fcb051cfc0cb07dfd990d64b57 100644 (file)
@@ -13094,12 +13094,6 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
                  return error_mark_node;
                }
              t = TREE_OPERAND (t, 0);
-             if ((ort == C_ORT_ACC || ort == C_ORT_OMP)
-                 && TREE_CODE (t) == MEM_REF)
-               {
-                 t = TREE_OPERAND (t, 0);
-                 STRIP_NOPS (t);
-               }
              if (ort == C_ORT_ACC && TREE_CODE (t) == MEM_REF)
                {
                  if (maybe_ne (mem_ref_offset (t), 0))
@@ -13973,7 +13967,6 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
   tree ordered_clause = NULL_TREE;
   tree schedule_clause = NULL_TREE;
   bool oacc_async = false;
-  bool indir_component_ref_p = false;
   tree last_iterators = NULL_TREE;
   bool last_iterators_remove = false;
   tree *nogroup_seen = NULL;
@@ -14773,11 +14766,6 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
                    {
                      while (TREE_CODE (t) == COMPONENT_REF)
                        t = TREE_OPERAND (t, 0);
-                     if (TREE_CODE (t) == MEM_REF)
-                       {
-                         t = TREE_OPERAND (t, 0);
-                         STRIP_NOPS (t);
-                       }
                      if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
                          && OMP_CLAUSE_MAP_IMPLICIT (c)
                          && (bitmap_bit_p (&map_head, DECL_UID (t))
@@ -14844,15 +14832,6 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
               bias) to zero here, so it is not set erroneously to the pointer
               size later on in gimplify.c.  */
            OMP_CLAUSE_SIZE (c) = size_zero_node;
-         indir_component_ref_p = false;
-         if ((ort == C_ORT_ACC || ort == C_ORT_OMP)
-             && TREE_CODE (t) == COMPONENT_REF
-             && TREE_CODE (TREE_OPERAND (t, 0)) == MEM_REF)
-           {
-             t = TREE_OPERAND (TREE_OPERAND (t, 0), 0);
-             indir_component_ref_p = true;
-             STRIP_NOPS (t);
-           }
          if (TREE_CODE (t) == COMPONENT_REF
              && OMP_CLAUSE_CODE (c) != OMP_CLAUSE__CACHE_)
            {
@@ -14925,7 +14904,6 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
          else if ((OMP_CLAUSE_CODE (c) != OMP_CLAUSE_MAP
                    || (OMP_CLAUSE_MAP_KIND (c)
                        != GOMP_MAP_FIRSTPRIVATE_POINTER))
-                  && !indir_component_ref_p
                   && !c_mark_addressable (t))
            remove = true;
          else if (!(OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
index e233db2bd552d007ac668864898056c87d7de992..c4d02446e38f9990f89f3bcc78164d27d85bda5f 100644 (file)
@@ -9407,9 +9407,7 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
                  && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ATTACH_DETACH)
                OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_ALWAYS_POINTER);
              if ((DECL_P (decl)
-                  || (component_ref_p
-                      && (INDIRECT_REF_P (decl)
-                          || TREE_CODE (decl) == MEM_REF)))
+                  || (component_ref_p && INDIRECT_REF_P (decl)))
                  && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_TO_PSET
                  && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_ATTACH
                  && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_DETACH
@@ -9510,18 +9508,7 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
                      if (base_ref)
                        OMP_CLAUSE_DECL (l) = unshare_expr (base_ref);
                      else
-                       {
-                         OMP_CLAUSE_DECL (l) = unshare_expr (decl);
-                         if (!DECL_P (OMP_CLAUSE_DECL (l))
-                             && (gimplify_expr (&OMP_CLAUSE_DECL (l),
-                                                pre_p, NULL, is_gimple_lvalue,
-                                                fb_lvalue)
-                                 == GS_ERROR))
-                           {
-                             remove = true;
-                             break;
-                           }
-                       }
+                       OMP_CLAUSE_DECL (l) = decl;
                      OMP_CLAUSE_SIZE (l)
                        = (!attach
                           ? size_int (1)
@@ -9564,30 +9551,6 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
                        flags |= GOVD_SEEN;
                      if (has_attachments)
                        flags |= GOVD_MAP_HAS_ATTACHMENTS;
-
-                     /* If this is a *pointer-to-struct expression, make sure a
-                        firstprivate map of the base-pointer exists.  */
-                     if (component_ref_p
-                         && ((TREE_CODE (decl) == MEM_REF
-                              && integer_zerop (TREE_OPERAND (decl, 1)))
-                             || INDIRECT_REF_P (decl))
-                         && DECL_P (TREE_OPERAND (decl, 0))
-                         && !splay_tree_lookup (ctx->variables,
-                                                ((splay_tree_key)
-                                                 TREE_OPERAND (decl, 0))))
-                       {
-                         decl = TREE_OPERAND (decl, 0);
-                         tree c2 = build_omp_clause (OMP_CLAUSE_LOCATION (c),
-                                                     OMP_CLAUSE_MAP);
-                         enum gomp_map_kind mkind
-                           = GOMP_MAP_FIRSTPRIVATE_POINTER;
-                         OMP_CLAUSE_SET_MAP_KIND (c2, mkind);
-                         OMP_CLAUSE_DECL (c2) = decl;
-                         OMP_CLAUSE_SIZE (c2) = size_zero_node;
-                         OMP_CLAUSE_CHAIN (c2) = OMP_CLAUSE_CHAIN (c);
-                         OMP_CLAUSE_CHAIN (c) = c2;
-                       }
-
                      if (DECL_P (decl))
                        goto do_add_decl;
                    }
diff --git a/gcc/testsuite/gcc.dg/gomp/target-3.c b/gcc/testsuite/gcc.dg/gomp/target-3.c
deleted file mode 100644 (file)
index 3e79212..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-fopenmp -fdump-tree-gimple" } */
-
-struct S
-{
-  int a, b;
-};
-
-void foo (struct S *s)
-{
-  #pragma omp target map (alloc: s->a, s->b)
-    ;
-  #pragma omp target enter data map (alloc: s->a, s->b)
-}
-
-/* { dg-final { scan-tree-dump-times "map\\(struct:\\*s \\\[len: 2\\\]\\) map\\(alloc:s->a \\\[len: \[0-9\]+\\\]\\) map\\(alloc:s->b \\\[len: \[0-9\]+\\\]\\)" 2 "gimple" } } */