]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
openmp: Fix up firstprivate+lastprivate clause handling [PR99928]
authorJakub Jelinek <jakub@redhat.com>
Sun, 23 May 2021 11:18:10 +0000 (13:18 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Sun, 23 May 2021 11:18:10 +0000 (13:18 +0200)
The C/C++ clause splitting happens very early during construct parsing,
but only the FEs later on handle possible instantiations, non-static
member handling and array section lowering.
In the OpenMP 5.0/5.1 rules, whether firstprivate is added to combined
target depends on whether it isn't also mentioned in lastprivate or map
clauses, but unfortunately I think such checks are much better done only
when the FEs perform all the above mentioned changes.
So, this patch arranges for the firstprivate clause to be copied or moved
to combined target construct (as before), but sets flags on that clause,
which tell the FE *finish_omp_clauses and the gimplifier it has been added
only conditionally and let the FEs and gimplifier DTRT for these.

2021-05-21  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/99928
gcc/
* tree.h (OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET): Define.
* gimplify.c (enum gimplify_omp_var_data): Fix up
GOVD_MAP_HAS_ATTACHMENTS value, add GOVD_FIRSTPRIVATE_IMPLICIT.
(omp_lastprivate_for_combined_outer_constructs): If combined target
has GOVD_FIRSTPRIVATE_IMPLICIT set for the decl, change it to
GOVD_MAP | GOVD_SEEN.
(gimplify_scan_omp_clauses): Set GOVD_FIRSTPRIVATE_IMPLICIT for
firstprivate clauses with OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT.
(gimplify_adjust_omp_clauses): For firstprivate clauses with
OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT either clear that bit and
OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET too, or remove it and
let it be replaced by implicit map clause.
gcc/c-family/
* c-omp.c (c_omp_split_clauses): Set OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT
on firstprivate clause copy going to target construct, and for
target simd set also OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET bit.
gcc/c/
* c-typeck.c (c_finish_omp_clauses): Move firstprivate clauses with
OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT to the end of the chain.  Don't error
if a decl is mentioned both in map clause and in such firstprivate
clause unless OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET is also set.
gcc/cp/
* semantics.c (finish_omp_clauses): Move firstprivate clauses with
OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT to the end of the chain.  Don't error
if a decl is mentioned both in map clause and in such firstprivate
clause unless OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET is also set.
gcc/testsuite/
* c-c++-common/gomp/pr99928-3.c: Remove all xfails.
* c-c++-common/gomp/pr99928-15.c: New test.

(cherry picked from commit b5c1c7a96bc8d7062d2c35675f48131667498182)

12 files changed:
gcc/ChangeLog.omp
gcc/c-family/ChangeLog.omp
gcc/c-family/c-omp.c
gcc/c/ChangeLog.omp
gcc/c/c-typeck.c
gcc/cp/ChangeLog.omp
gcc/cp/semantics.c
gcc/gimplify.c
gcc/testsuite/ChangeLog.omp
gcc/testsuite/c-c++-common/gomp/pr99928-15.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/gomp/pr99928-3.c
gcc/tree.h

index 42dff45f1cee71f2f409c7da5ad55cea2b21a570..dbe8e898dc8b0cc471800df1988ab0ad8d71ddc7 100644 (file)
@@ -1,3 +1,22 @@
+2021-05-23  Tobias Burnus  <tobias@codesourcery.com>
+
+       Backported from master:
+       2021-05-21  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/99928
+       * tree.h (OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET): Define.
+       * gimplify.c (enum gimplify_omp_var_data): Fix up
+       GOVD_MAP_HAS_ATTACHMENTS value, add GOVD_FIRSTPRIVATE_IMPLICIT.
+       (omp_lastprivate_for_combined_outer_constructs): If combined target
+       has GOVD_FIRSTPRIVATE_IMPLICIT set for the decl, change it to
+       GOVD_MAP | GOVD_SEEN.
+       (gimplify_scan_omp_clauses): Set GOVD_FIRSTPRIVATE_IMPLICIT for
+       firstprivate clauses with OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT.
+       (gimplify_adjust_omp_clauses): For firstprivate clauses with
+       OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT either clear that bit and
+       OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET too, or remove it and
+       let it be replaced by implicit map clause.
+
 2021-05-23  Tobias Burnus  <tobias@codesourcery.com>
 
        Backported from master:
index b5be331200cdb9bc6c43245bc2d4001208b3e164..8b1221aa6a5ff5ed85be3e5220182146313a18f9 100644 (file)
@@ -1,3 +1,17 @@
+2021-05-23  Tobias Burnus  <tobias@codesourcery.com>
+
+       Backported from master:
+       2021-05-21  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/99928
+       * c-omp.c (c_omp_split_clauses): Set OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT
+       on firstprivate clause copy going to target construct, and for
+       target simd set also OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET bit.
+
+2021-05-23  Tobias Burnus  <tobias@codesourcery.com>
+
+       Backported from master:
+       2021-05-21  Jakub Jelinek  <jakub@redhat.com>
 2021-04-30  Kwok Cheung Yeung  <kcy@codesourcery.com>
 
        Backport from mainline
@@ -12,7 +26,7 @@
        (check_and_annotate_for_loop): Use the new helper function.
 
 2020-08-30  Sandra Loosemore  <sandra@codesourcery.com>
-    
+
        * c-omp.c (annotate_for_loop): Move initializer processing...
        (check_and_annotate_for_loop): ... to here.  Allow the loop
        variable as either operand to the condition.
index 2460b2af5a2dbc3444bdda9bfb37e14121f0d4a4..fbe829cc9dd7857a81f1588634585e502331f852 100644 (file)
@@ -1877,10 +1877,21 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
                {
                  /* This must be #pragma omp target simd.  */
                  s = C_OMP_CLAUSE_SPLIT_TARGET;
+                 OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (clauses) = 1;
+                 OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET (clauses) = 1;
                  break;
                }
              c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses),
                                    OMP_CLAUSE_FIRSTPRIVATE);
+             /* firstprivate should not be applied to target if it is
+                also lastprivate or on the combined/composite construct,
+                or if it is mentioned in map clause.  OMP_CLAUSE_DECLs
+                may need to go through FE handling though (instantiation,
+                C++ non-static data members, array section lowering), so
+                add the clause with OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT and
+                let *finish_omp_clauses and the gimplifier handle it
+                right.  */
+             OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c) = 1;
              OMP_CLAUSE_DECL (c) = OMP_CLAUSE_DECL (clauses);
              OMP_CLAUSE_CHAIN (c) = cclauses[C_OMP_CLAUSE_SPLIT_TARGET];
              cclauses[C_OMP_CLAUSE_SPLIT_TARGET] = c;
index f3035a1ab8328192c596f525182fb9974c960beb..65c40dc34cc5297ac18179950240b69c7a22b3cf 100644 (file)
@@ -1,3 +1,14 @@
+2021-05-23  Tobias Burnus  <tobias@codesourcery.com>
+
+       Backported from master:
+       2021-05-21  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/99928
+       * c-typeck.c (c_finish_omp_clauses): Move firstprivate clauses with
+       OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT to the end of the chain.  Don't error
+       if a decl is mentioned both in map clause and in such firstprivate
+       clause unless OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET is also set.
+
 2021-05-19  Tobias Burnus  <tobias@codesourcery.com>
 
        Backported from master:
index e09f24ac5a48de2cacf0ef43a5531b3bffcd9906..b7f96826e61f1620ad8e3bd559ef239f90c88034 100644 (file)
@@ -13969,6 +13969,7 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
      has been seen, -2 if mixed inscan/normal reduction diagnosed.  */
   int reduction_seen = 0;
   bool allocate_seen = false;
+  bool firstprivate_implicit_moved = false;
   bool oacc_gang_seen = false;
 
   bitmap_obstack_initialize (NULL);
@@ -14426,6 +14427,29 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
          break;
 
        case OMP_CLAUSE_FIRSTPRIVATE:
+         if (OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c)
+             && !firstprivate_implicit_moved)
+           {
+             firstprivate_implicit_moved = true;
+             /* Move firstprivate clauses with
+                OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT set to the end of
+                clauses chain.  */
+             tree cl = NULL, *pc1 = pc, *pc2 = &cl;
+             while (*pc1)
+               if (OMP_CLAUSE_CODE (*pc1) == OMP_CLAUSE_FIRSTPRIVATE
+                   && OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (*pc1))
+                 {
+                   *pc2 = *pc1;
+                   pc2 = &OMP_CLAUSE_CHAIN (*pc2);
+                   *pc1 = OMP_CLAUSE_CHAIN (*pc1);
+                 }
+               else
+                 pc1 = &OMP_CLAUSE_CHAIN (*pc1);
+             *pc2 = NULL;
+             *pc1 = cl;
+             if (pc1 != pc)
+               continue;
+           }
          t = OMP_CLAUSE_DECL (c);
          need_complete = true;
          need_implicitly_determined = true;
@@ -14447,6 +14471,9 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
              if (ort == C_ORT_ACC)
                error_at (OMP_CLAUSE_LOCATION (c),
                          "%qD appears more than once in data clauses", t);
+             else if (OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c)
+                      && !OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET (c))
+               /* Silently drop the clause.  */;
              else
                error_at (OMP_CLAUSE_LOCATION (c),
                          "%qD appears both in data and map clauses", t);
index 45910c66d72a3e46096944a5e2ba61412fc3db4d..0d347006af8f6f2f8c03ca44b3ba9486abb457d6 100644 (file)
@@ -1,3 +1,14 @@
+2021-05-23  Tobias Burnus  <tobias@codesourcery.com>
+
+       Backported from master:
+       2021-05-21  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/99928
+       * semantics.c (finish_omp_clauses): Move firstprivate clauses with
+       OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT to the end of the chain.  Don't error
+       if a decl is mentioned both in map clause and in such firstprivate
+       clause unless OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET is also set.
+
 2021-05-19  Tobias Burnus  <tobias@codesourcery.com>
 
        Backported from master:
index db4edba3803819869f1f72e1de71fa7bbf7cc274..4709066bb22ef266b45ebd6b8371d593226ec49f 100644 (file)
@@ -6571,6 +6571,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
   bool allocate_seen = false;
   tree detach_seen = NULL_TREE;
   bool mergeable_seen = false;
+  bool firstprivate_implicit_moved = false;
   bool oacc_gang_seen = false;
 
   bitmap_obstack_initialize (NULL);
@@ -6908,6 +6909,29 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
          break;
 
        case OMP_CLAUSE_FIRSTPRIVATE:
+         if (OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c)
+             && !firstprivate_implicit_moved)
+           {
+             firstprivate_implicit_moved = true;
+             /* Move firstprivate clauses with
+                OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT set to the end of
+                clauses chain.  */
+             tree cl = NULL, *pc1 = pc, *pc2 = &cl;
+             while (*pc1)
+               if (OMP_CLAUSE_CODE (*pc1) == OMP_CLAUSE_FIRSTPRIVATE
+                   && OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (*pc1))
+                 {
+                   *pc2 = *pc1;
+                   pc2 = &OMP_CLAUSE_CHAIN (*pc2);
+                   *pc1 = OMP_CLAUSE_CHAIN (*pc1);
+                 }
+               else
+                 pc1 = &OMP_CLAUSE_CHAIN (*pc1);
+             *pc2 = NULL;
+             *pc1 = cl;
+             if (pc1 != pc)
+               continue;
+           }
          t = omp_clause_decl_field (OMP_CLAUSE_DECL (c));
          if (t)
            omp_note_field_privatization (t, OMP_CLAUSE_DECL (c));
@@ -6949,6 +6973,9 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
              if (ort == C_ORT_ACC)
                error_at (OMP_CLAUSE_LOCATION (c),
                          "%qD appears more than once in data clauses", t);
+             else if (OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c)
+                      && !OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET (c))
+               /* Silently drop the clause.  */;
              else
                error_at (OMP_CLAUSE_LOCATION (c),
                          "%qD appears both in data and map clauses", t);
index 927d5097599a2a001c92da0f5976617ccd5be9e4..93389962baf92ec47927d127bb25d65b3cce7517 100644 (file)
@@ -127,7 +127,10 @@ enum gimplify_omp_var_data
 
   /* Flag for GOVD_MAP: (struct) vars that have pointer attachments for
      fields.  */
-  GOVD_MAP_HAS_ATTACHMENTS = 8388608,
+  GOVD_MAP_HAS_ATTACHMENTS = 0x4000000,
+
+  /* Flag for GOVD_FIRSTPRIVATE: OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT.  */
+  GOVD_FIRSTPRIVATE_IMPLICIT = 0x8000000,
 
   /* Flag for OpenACC deviceptrs.  */
   GOVD_DEVICEPTR = (1<<24),
@@ -8617,13 +8620,24 @@ omp_lastprivate_for_combined_outer_constructs (struct gimplify_omp_ctx *octx,
          omp_add_variable (octx, decl, GOVD_LASTPRIVATE | GOVD_SEEN);
          continue;
        }
-      if (octx->region_type == ORT_COMBINED_TARGET
-         && splay_tree_lookup (octx->variables,
-                               (splay_tree_key) decl) == NULL)
+      if (octx->region_type == ORT_COMBINED_TARGET)
        {
-         omp_add_variable (octx, decl, GOVD_MAP | GOVD_SEEN);
-         octx = octx->outer_context;
-         break;
+         splay_tree_node n = splay_tree_lookup (octx->variables,
+                                                (splay_tree_key) decl);
+         if (n == NULL)
+           {
+             omp_add_variable (octx, decl, GOVD_MAP | GOVD_SEEN);
+             octx = octx->outer_context;
+           }
+         else if (!implicit_p
+                  && (n->value & GOVD_FIRSTPRIVATE_IMPLICIT))
+           {
+             n->value &= ~(GOVD_FIRSTPRIVATE
+                           | GOVD_FIRSTPRIVATE_IMPLICIT
+                           | GOVD_EXPLICIT);
+             omp_add_variable (octx, decl, GOVD_MAP | GOVD_SEEN);
+             octx = octx->outer_context;
+           }
        }
       break;
     }
@@ -8704,6 +8718,11 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
        case OMP_CLAUSE_FIRSTPRIVATE:
          flags = GOVD_FIRSTPRIVATE | GOVD_EXPLICIT;
          check_non_private = "firstprivate";
+         if (OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c))
+           {
+             gcc_assert (code == OMP_TARGET);
+             flags |= GOVD_FIRSTPRIVATE_IMPLICIT;
+           }
          goto do_add;
        case OMP_CLAUSE_LASTPRIVATE:
          if (OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (c))
@@ -10843,6 +10862,18 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, gimple_seq body, tree *list_p,
              remove = true;
              break;
            }
+         if (OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c))
+           {
+             decl = OMP_CLAUSE_DECL (c);
+             n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl);
+             if ((n->value & GOVD_MAP) != 0)
+               {
+                 remove = true;
+                 break;
+               }
+             OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET (c) = 0;
+             OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c) = 0;
+           }
          /* FALLTHRU */
        case OMP_CLAUSE_PRIVATE:
        case OMP_CLAUSE_SHARED:
index cf45ee47dcf988256b872be260f3e0339dc876ad..61500a4bba9ad2cdc6f1438169bed3b26cba407c 100644 (file)
@@ -1,3 +1,12 @@
+2021-05-23  Tobias Burnus  <tobias@codesourcery.com>
+
+       Backported from master:
+       2021-05-21  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/99928
+       * c-c++-common/gomp/pr99928-3.c: Remove all xfails.
+       * c-c++-common/gomp/pr99928-15.c: New test.
+
 2021-05-23  Tobias Burnus  <tobias@codesourcery.com>
 
        Backported from master:
diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-15.c b/gcc/testsuite/c-c++-common/gomp/pr99928-15.c
new file mode 100644 (file)
index 0000000..f0c6232
--- /dev/null
@@ -0,0 +1,26 @@
+/* PR middle-end/99928 */
+
+int v;
+
+void
+foo (void)
+{
+  #pragma omp target parallel firstprivate (v) map(tofrom: v)  /* { dg-bogus "'v' appears both in data and map clauses" } */
+  v++;
+}
+
+void
+bar (void)
+{
+  #pragma omp target firstprivate (v) map (tofrom: v)  /* { dg-error "'v' appears both in data and map clauses" } */
+  v++;
+}
+
+void
+baz (void)
+{
+  int j;
+  #pragma omp target simd firstprivate (v) map (tofrom: v) private (j) /* { dg-error "'v' appears both in data and map clauses" } */
+  for (int i = 0; i < 1; i++)
+    j = v;
+}
index 67f590bb7ef4a40679de965d57ff46876defbdf2..cf9c72d75b88f06c9df740d04e5915f75fae70ab 100644 (file)
@@ -82,8 +82,8 @@ bar (void)
     #pragma omp section
     l07 = 2;
   }
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l08" "gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l08\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l08" "gimple" } } */
+  /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l08\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l08\\)" "gimple" } } *//* FIXME: This should be on for instead.  */
   /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l08\\)" "gimple" } } *//* FIXME: This should be on for instead.  */
   /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(l08\\)" "gimple" } } *//* FIXME.  */
@@ -91,8 +91,8 @@ bar (void)
   #pragma omp target parallel for firstprivate (l08) lastprivate (l08)
   for (int i = 0; i < 64; i++)
     l08 = i;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l09" "gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l09\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l09" "gimple" } } */
+  /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l09\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l09\\)" "gimple" } } *//* FIXME: This should be on for instead.  */
   /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l09\\)" "gimple" } } *//* FIXME: This should be on for instead.  */
   /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(l09\\)" "gimple" } } *//* FIXME.  */
@@ -102,8 +102,8 @@ bar (void)
   #pragma omp target parallel for simd firstprivate (l09) lastprivate (l09)
   for (int i = 0; i < 64; i++)
     l09 = i;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l10" "gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l10\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l10" "gimple" } } */
+  /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l10\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(l10\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l10\\)" "gimple" } } */
   #pragma omp target simd firstprivate (l10) lastprivate (l10)
index 593f71f87b38c8db705e7ed4c53cf33a688822cd..5817a0ff3b23e5d0d79ac937cd3fdcc5f3ac9da5 100644 (file)
@@ -1544,6 +1544,11 @@ class auto_suppress_location_wrappers
 #define OMP_CLAUSE_FIRSTPRIVATE_NO_REFERENCE(NODE) \
   TREE_PRIVATE (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_FIRSTPRIVATE))
 
+/* True on a FIRSTPRIVATE clause with OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT also
+   set if target construct is the only one that accepts the clause.  */
+#define OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET(NODE) \
+  TREE_PROTECTED (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_FIRSTPRIVATE))
+
 /* True on a LASTPRIVATE clause if a FIRSTPRIVATE clause for the same
    decl is present in the chain.  */
 #define OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE(NODE) \