]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
openacc: Revert erroneous gang reduction changes
authorMarcel Vollweiler <marcel@codesourcery.com>
Thu, 27 Oct 2022 12:43:00 +0000 (12:43 +0000)
committerMarcel Vollweiler <marcel@codesourcery.com>
Thu, 27 Oct 2022 13:49:28 +0000 (06:49 -0700)
This patch reverts some changes related to "gang reduction on an orphan loop"
of commit 3a5e525489f2f808093ae1f12b5d2b406f571ec7 "Various OpenACC reduction
enhancements - FE change" similar to the mainline commit
77d24d43644909852998043335b5a0e09d1e8f02.

gcc/c/ChangeLog:

* c-typeck.cc (c_finish_omp_clauses): Remove "gang reduction on an
orphan loop" checking.

gcc/cp/ChangeLog:

* semantics.cc (finish_omp_clauses): Remove "gang reduction on an
orphan loop" checking.

gcc/fortran/ChangeLog:

* openmp.cc (oacc_is_parallel): Remove.
(resolve_oacc_loop_blocks): Remove "gang reduction on an orphan loop"
checking.

gcc/c/ChangeLog.omp
gcc/c/c-typeck.cc
gcc/cp/ChangeLog.omp
gcc/cp/semantics.cc
gcc/fortran/ChangeLog.omp
gcc/fortran/openmp.cc

index 33fec8465939a26f86ad986bcae1ea65e599f91d..1deeb6bb5b344c9b7a7274a6bc2a11975767bfb3 100644 (file)
@@ -1,3 +1,8 @@
+2022-10-27  Marcel Vollweiler  <marcel@codesourcery.com>
+
+       * c-typeck.cc (c_finish_omp_clauses): Remove "gang reduction on an
+       orphan loop" checking.
+
 2022-10-04  Tobias Burnus  <tobias@codesourcery.com>
 
        Backport from mainline:
index 0dd3a444bb04d0c93b1268a7a7319ff6cbec0729..87bc97f943393a8adcce9b02a10fd56a98d36a05 100644 (file)
@@ -14204,7 +14204,6 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
   bool allocate_seen = false;
   bool implicit_moved = false;
   bool target_in_reduction_seen = false;
-  bool oacc_gang_seen = false;
 
   bitmap_obstack_initialize (NULL);
   bitmap_initialize (&generic_head, &bitmap_default_obstack);
@@ -14222,15 +14221,10 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
 
   if (ort & C_ORT_ACC)
     for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c))
-      switch (OMP_CLAUSE_CODE (c))
-        {
-       case OMP_CLAUSE_ASYNC:
+      if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_ASYNC)
+       {
          oacc_async = true;
          break;
-       case OMP_CLAUSE_GANG:
-         oacc_gang_seen = true;
-         break;
-       default:;
        }
 
   for (pc = &clauses, c = clauses; c ; c = *pc)
@@ -14251,13 +14245,6 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
          goto check_dup_generic;
 
        case OMP_CLAUSE_REDUCTION:
-         if (oacc_gang_seen && oacc_get_fn_attrib (current_function_decl))
-           {
-             error_at (OMP_CLAUSE_LOCATION (c),
-                       "gang reduction on an orphan loop");
-             remove = true;
-             break;
-           }
          if (reduction_seen == 0)
            reduction_seen = OMP_CLAUSE_REDUCTION_INSCAN (c) ? -1 : 1;
          else if (reduction_seen != -2
index f0668ab30639734f7398aa0b66369439ad2a6825..7c1fde00075947b59d9f1bd3395d771df874e022 100644 (file)
@@ -1,3 +1,8 @@
+2022-10-27  Marcel Vollweiler  <marcel@codesourcery.com>
+
+       * semantics.cc (finish_omp_clauses): Remove "gang reduction on an orphan
+        loop" checking.
+
 2022-10-04  Tobias Burnus  <tobias@codesourcery.com>
 
        Backport from mainline:
index 81368b4faaadc4051c1045badbd6434fbffe1a8d..d423f3d9659093066b96b24c25d505186f1fb605 100644 (file)
@@ -6794,7 +6794,6 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
   bool mergeable_seen = false;
   bool implicit_moved = false;
   bool target_in_reduction_seen = false;
-  bool oacc_gang_seen = false;
 
   bitmap_obstack_initialize (NULL);
   bitmap_initialize (&generic_head, &bitmap_default_obstack);
@@ -6812,15 +6811,10 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
 
   if (ort & C_ORT_ACC)
     for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c))
-      switch (OMP_CLAUSE_CODE (c))
+      if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_ASYNC)
         {
-       case OMP_CLAUSE_ASYNC:
          oacc_async = true;
          break;
-       case OMP_CLAUSE_GANG:
-         oacc_gang_seen = true;
-         break;
-       default:;
        }
 
   for (pc = &clauses, c = clauses; c ; c = *pc)
@@ -6837,13 +6831,6 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
          field_ok = ((ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP);
          goto check_dup_generic;
        case OMP_CLAUSE_REDUCTION:
-         if (oacc_gang_seen && oacc_get_fn_attrib (current_function_decl))
-           {
-             error_at (OMP_CLAUSE_LOCATION (c),
-                       "gang reduction on an orphan loop");
-             remove = true;
-             break;
-           }
          if (reduction_seen == 0)
            reduction_seen = OMP_CLAUSE_REDUCTION_INSCAN (c) ? -1 : 1;
          else if (reduction_seen != -2
index 189431df4ebe4c5e96e3e193c5a843aa38890b77..7504a837265d00e37cc08b7c23d615f13acc641a 100644 (file)
@@ -1,3 +1,9 @@
+2022-10-27  Marcel Vollweiler  <marcel@codesourcery.com>
+
+       * openmp.cc (oacc_is_parallel): Remove.
+       (resolve_oacc_loop_blocks): Remove "gang reduction on an orphan loop"
+       checking.
+
 2022-10-19  Tobias Burnus  <tobias@codesourcery.com>
 
        * trans-array.cc (non_negative_strides_array_p): Fix handling
index ab9db4e3a65206fcad0e2f00b31c7c77bcb8f3cd..ed21f52bdb267f9951173a3043f08ee9ce4ead28 100644 (file)
@@ -10248,11 +10248,6 @@ resolve_omp_do (gfc_code *code)
     }
 }
 
-static bool
-oacc_is_parallel (gfc_code *code)
-{
-  return code->op == EXEC_OACC_PARALLEL || code->op == EXEC_OACC_PARALLEL_LOOP;
-}
 
 static gfc_statement
 omp_code_to_statement (gfc_code *code)
@@ -10573,18 +10568,6 @@ resolve_oacc_loop_blocks (gfc_code *code)
   if (!oacc_is_loop (code))
     return;
 
-  if (code->op == EXEC_OACC_LOOP
-      && code->ext.omp_clauses->lists[OMP_LIST_REDUCTION]
-      && code->ext.omp_clauses->gang)
-    {
-      fortran_omp_context *c;
-      for (c = omp_current_ctx; c; c = c->previous)
-       if (!oacc_is_loop (c->code))
-         break;
-      if (c == NULL || !oacc_is_parallel (c->code))
-       gfc_error ("gang reduction on an orphan loop at %L", &code->loc);
-    }
-
   if (code->ext.omp_clauses->tile_list && code->ext.omp_clauses->gang
       && code->ext.omp_clauses->worker && code->ext.omp_clauses->vector)
     gfc_error ("Tiled loop cannot be parallelized across gangs, workers and "