More explicit checking of which OMP constructs we're expecting, part II
authorThomas Schwinge <thomas@codesourcery.com>
Fri, 20 Nov 2020 09:41:46 +0000 (10:41 +0100)
committerThomas Schwinge <thomas@codesourcery.com>
Tue, 24 Nov 2020 09:28:04 +0000 (10:28 +0100)
In particular, more precisely highlight what applies generally vs. the special
handling for the current 'parloops'-based OpenACC 'kernels' implementation.

gcc/
* omp-expand.c (expand_oacc_for): More explicit checking of which
OMP constructs we're expecting.

gcc/omp-expand.c

index c0e94e5..928644b 100644 (file)
@@ -7413,6 +7413,21 @@ expand_omp_taskloop_for_inner (struct omp_region *region,
 static void
 expand_oacc_for (struct omp_region *region, struct omp_for_data *fd)
 {
+  bool is_oacc_kernels_parallelized
+    = (lookup_attribute ("oacc kernels parallelized",
+                        DECL_ATTRIBUTES (current_function_decl)) != NULL);
+  {
+    bool is_oacc_kernels
+      = (lookup_attribute ("oacc kernels",
+                          DECL_ATTRIBUTES (current_function_decl)) != NULL);
+    if (is_oacc_kernels_parallelized)
+      gcc_checking_assert (is_oacc_kernels);
+  }
+  gcc_assert (gimple_in_ssa_p (cfun) == is_oacc_kernels_parallelized);
+  /* In the following, some of the 'gimple_in_ssa_p (cfun)' conditionals are
+     for SSA specifics, and some are for 'parloops' OpenACC
+     'kernels'-parallelized specifics.  */
+
   tree v = fd->loop.v;
   enum tree_code cond_code = fd->loop.cond_code;
   enum tree_code plus_code = PLUS_EXPR;