Update gcc-50 to SVN version 221572
[dragonfly.git] / contrib / gcc-5.0 / gcc / omp-low.c
index 2d64a74..80bddf0 100644 (file)
@@ -1564,6 +1564,7 @@ finalize_task_copyfn (gomp_task *task_stmt)
 
   /* Inform the callgraph about the new function.  */
   cgraph_node::add_new_function (child_fn, false);
+  cgraph_node::get (child_fn)->parallelized_function = 1;
 }
 
 /* Destroy a omp_context data structures.  Called through the splay tree
@@ -1580,10 +1581,12 @@ delete_omp_context (splay_tree_value value)
     splay_tree_delete (ctx->field_map);
   if (ctx->sfield_map)
     splay_tree_delete (ctx->sfield_map);
+  /* Reduction map is copied to nested contexts, so only delete it in the
+     owner.  */
   if (ctx->reduction_map
-      /* Shared over several omp_contexts.  */
-      && (ctx->outer == NULL
-         || ctx->reduction_map != ctx->outer->reduction_map))
+      && gimple_code (ctx->stmt) == GIMPLE_OMP_TARGET
+      && is_gimple_omp_offloaded (ctx->stmt)
+      && is_gimple_omp_oacc (ctx->stmt))
     splay_tree_delete (ctx->reduction_map);
 
   /* We hijacked DECL_ABSTRACT_ORIGIN earlier.  We need to clear it before
@@ -5567,6 +5570,7 @@ expand_omp_taskreg (struct omp_region *region)
       /* Inform the callgraph about the new function.  */
       DECL_STRUCT_FUNCTION (child_fn)->curr_properties = cfun->curr_properties;
       cgraph_node::add_new_function (child_fn, true);
+      cgraph_node::get (child_fn)->parallelized_function = 1;
 
       /* Fix the callgraph edges for child_cfun.  Those for cfun will be
         fixed in a following pass.  */
@@ -9103,14 +9107,11 @@ expand_omp_target (struct omp_region *region)
     }
 
   gimple g;
-  vec<tree> *args;
   /* The maximum number used by any start_ix, without varargs.  */
-  unsigned int argcnt = 11;
-
-  vec_alloc (args, argcnt);
-  args->quick_push (device);
+  auto_vec<tree, 11> args;
+  args.quick_push (device);
   if (offloaded)
-    args->quick_push (build_fold_addr_expr (child_fn));
+    args.quick_push (build_fold_addr_expr (child_fn));
   switch (start_ix)
     {
     case BUILT_IN_GOMP_TARGET:
@@ -9118,7 +9119,7 @@ expand_omp_target (struct omp_region *region)
     case BUILT_IN_GOMP_TARGET_UPDATE:
       /* This const void * is part of the current ABI, but we're not actually
         using it.  */
-      args->quick_push (build_zero_cst (ptr_type_node));
+      args.quick_push (build_zero_cst (ptr_type_node));
       break;
     case BUILT_IN_GOACC_DATA_START:
     case BUILT_IN_GOACC_ENTER_EXIT_DATA:
@@ -9128,10 +9129,10 @@ expand_omp_target (struct omp_region *region)
     default:
       gcc_unreachable ();
     }
-  args->quick_push (t1);
-  args->quick_push (t2);
-  args->quick_push (t3);
-  args->quick_push (t4);
+  args.quick_push (t1);
+  args.quick_push (t2);
+  args.quick_push (t3);
+  args.quick_push (t4);
   switch (start_ix)
     {
     case BUILT_IN_GOACC_DATA_START:
@@ -9164,9 +9165,9 @@ expand_omp_target (struct omp_region *region)
          t_vector_length = fold_convert_loc (OMP_CLAUSE_LOCATION (c),
                                              integer_type_node,
                                              OMP_CLAUSE_VECTOR_LENGTH_EXPR (c));
-       args->quick_push (t_num_gangs);
-       args->quick_push (t_num_workers);
-       args->quick_push (t_vector_length);
+       args.quick_push (t_num_gangs);
+       args.quick_push (t_num_workers);
+       args.quick_push (t_vector_length);
       }
       /* FALLTHRU */
     case BUILT_IN_GOACC_ENTER_EXIT_DATA:
@@ -9188,13 +9189,13 @@ expand_omp_target (struct omp_region *region)
                                      integer_type_node,
                                      OMP_CLAUSE_ASYNC_EXPR (c));
 
-       args->quick_push (t_async);
+       args.quick_push (t_async);
        /* Save the index, and... */
-       t_wait_idx = args->length ();
+       t_wait_idx = args.length ();
        /* ... push a default value.  */
-       args->quick_push (fold_convert_loc (gimple_location (entry_stmt),
-                                           integer_type_node,
-                                           integer_zero_node));
+       args.quick_push (fold_convert_loc (gimple_location (entry_stmt),
+                                          integer_type_node,
+                                          integer_zero_node));
        c = find_omp_clause (clauses, OMP_CLAUSE_WAIT);
        if (c)
          {
@@ -9204,19 +9205,19 @@ expand_omp_target (struct omp_region *region)
              {
                if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_WAIT)
                  {
-                   args->safe_push (fold_convert_loc (OMP_CLAUSE_LOCATION (c),
-                                                      integer_type_node,
-                                                      OMP_CLAUSE_WAIT_EXPR (c)));
+                   args.safe_push (fold_convert_loc (OMP_CLAUSE_LOCATION (c),
+                                                     integer_type_node,
+                                                     OMP_CLAUSE_WAIT_EXPR (c)));
                    n++;
                  }
              }
 
            /* Now that we know the number, replace the default value.  */
-           args->ordered_remove (t_wait_idx);
-           args->quick_insert (t_wait_idx,
-                               fold_convert_loc (gimple_location (entry_stmt),
-                                                 integer_type_node,
-                                                 build_int_cst (integer_type_node, n)));
+           args.ordered_remove (t_wait_idx);
+           args.quick_insert (t_wait_idx,
+                              fold_convert_loc (gimple_location (entry_stmt),
+                                                integer_type_node,
+                                                build_int_cst (integer_type_node, n)));
          }
       }
       break;
@@ -9224,8 +9225,7 @@ expand_omp_target (struct omp_region *region)
       gcc_unreachable ();
     }
 
-  g = gimple_build_call_vec (builtin_decl_explicit (start_ix), *args);
-  args->release ();
+  g = gimple_build_call_vec (builtin_decl_explicit (start_ix), args);
   gimple_set_location (g, gimple_location (entry_stmt));
   gsi_insert_before (&gsi, g, GSI_SAME_STMT);
   if (!offloaded)