[omp, hsa] Do not gridify simd constructs
authorjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Feb 2016 17:35:29 +0000 (17:35 +0000)
committerjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Feb 2016 17:35:29 +0000 (17:35 +0000)
2016-02-26  Martin Jambor  <mjambor@suse.cz>

* omp-low.c (grid_find_ungridifiable_statement): Store problematic
statements to wi->info.  Also disallow omp simd constructs.
(grid_target_follows_gridifiable_pattern): Use wi.info to dump reason
for not gridifying.  Dump special string for omp_for.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233746 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/omp-low.c

index a34883e..7ce5fdc 100644 (file)
@@ -1,3 +1,10 @@
+2016-02-26  Martin Jambor  <mjambor@suse.cz>
+
+       * omp-low.c (grid_find_ungridifiable_statement): Store problematic
+       statements to wi->info.  Also disallow omp simd constructs.
+       (grid_target_follows_gridifiable_pattern): Use wi.info to dump reason
+       for not gridifying.  Dump special string for omp_for.
+
 2016-02-26  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        PR target/69245
index fcbb3e0..989d03e 100644 (file)
@@ -17241,7 +17241,7 @@ grid_find_single_omp_among_assignments (gimple_seq seq, location_t target_loc,
 static tree
 grid_find_ungridifiable_statement (gimple_stmt_iterator *gsi,
                                   bool *handled_ops_p,
-                                  struct walk_stmt_info *)
+                                  struct walk_stmt_info *wi)
 {
   *handled_ops_p = false;
   gimple *stmt = gsi_stmt (*gsi);
@@ -17251,6 +17251,7 @@ grid_find_ungridifiable_statement (gimple_stmt_iterator *gsi,
       if (gimple_call_noreturn_p (as_a <gcall *> (stmt)))
        {
          *handled_ops_p = true;
+         wi->info = stmt;
          return error_mark_node;
        }
       break;
@@ -17266,8 +17267,19 @@ grid_find_ungridifiable_statement (gimple_stmt_iterator *gsi,
     case GIMPLE_OMP_TARGET:
     case GIMPLE_OMP_ORDERED:
       *handled_ops_p = true;
+      wi->info = stmt;
       return error_mark_node;
 
+    case GIMPLE_OMP_FOR:
+      if ((gimple_omp_for_kind (stmt) & GF_OMP_FOR_SIMD)
+         && gimple_omp_for_combined_into_p (stmt))
+       {
+         *handled_ops_p = true;
+         wi->info = stmt;
+         return error_mark_node;
+       }
+      break;
+
     default:
       break;
     }
@@ -17509,10 +17521,11 @@ grid_target_follows_gridifiable_pattern (gomp_target *target, tree *group_size_p
 
   struct walk_stmt_info wi;
   memset (&wi, 0, sizeof (wi));
-  if (gimple *bad = walk_gimple_seq (gimple_omp_body (gfor),
-                                    grid_find_ungridifiable_statement,
-                                    NULL, &wi))
+  if (walk_gimple_seq (gimple_omp_body (gfor),
+                      grid_find_ungridifiable_statement,
+                      NULL, &wi))
     {
+      gimple *bad = (gimple *) wi.info;
       if (dump_enabled_p ())
        {
          if (is_gimple_call (bad))
@@ -17520,6 +17533,11 @@ grid_target_follows_gridifiable_pattern (gomp_target *target, tree *group_size_p
                             "Will not turn target construct into a gridified "
                             " GPGPU kernel because the inner loop contains "
                             "call to a noreturn function\n");
+         if (gimple_code (bad) == GIMPLE_OMP_FOR)
+           dump_printf_loc (MSG_NOTE, tloc,
+                            "Will not turn target construct into a gridified "
+                            " GPGPU kernel because the inner loop contains "
+                            "a simd construct\n");
          else
            dump_printf_loc (MSG_NOTE, tloc,
                             "Will not turn target construct into a gridified "