/* We do not need the leftover chaining of namespaces from the
binding level. */
DECL_CHAIN (t) = NULL_TREE;
- /* Set DECL_VALUE_EXPRs of OpenMP privatized member artificial
- decls to error_mark_node. These are DECL_IGNORED_P and after
- OpenMP lowering they aren't useful anymore. Clearing DECL_VALUE_EXPR
- doesn't work, as expansion could then consider them as something
- to be expanded. */
- if (VAR_P (t)
- && DECL_LANG_SPECIFIC (t)
- && DECL_OMP_PRIVATIZED_MEMBER (t)
- && DECL_IGNORED_P (t))
- SET_DECL_VALUE_EXPR (t, error_mark_node);
}
/* Stub for c-common. Please keep in sync with c-decl.c.
\f
/* Re-gimplification and code generation routines. */
+/* Remove omp_member_access_dummy_var variables from gimple_bind_vars
+ of BIND if in a method. */
+
+static void
+maybe_remove_omp_member_access_dummy_vars (gbind *bind)
+{
+ if (DECL_ARGUMENTS (current_function_decl)
+ && DECL_ARTIFICIAL (DECL_ARGUMENTS (current_function_decl))
+ && (TREE_CODE (TREE_TYPE (DECL_ARGUMENTS (current_function_decl)))
+ == POINTER_TYPE))
+ {
+ tree vars = gimple_bind_vars (bind);
+ for (tree *pvar = &vars; *pvar; )
+ if (omp_member_access_dummy_var (*pvar))
+ *pvar = DECL_CHAIN (*pvar);
+ else
+ pvar = &DECL_CHAIN (*pvar);
+ gimple_bind_set_vars (bind, vars);
+ }
+}
+
+/* Remove omp_member_access_dummy_var variables from BLOCK_VARS of
+ block and its subblocks. */
+
+static void
+remove_member_access_dummy_vars (tree block)
+{
+ for (tree *pvar = &BLOCK_VARS (block); *pvar; )
+ if (omp_member_access_dummy_var (*pvar))
+ *pvar = DECL_CHAIN (*pvar);
+ else
+ pvar = &DECL_CHAIN (*pvar);
+
+ for (block = BLOCK_SUBBLOCKS (block); block; block = BLOCK_CHAIN (block))
+ remove_member_access_dummy_vars (block);
+}
+
/* If a context was created for STMT when it was scanned, return it. */
static omp_context *
pop_gimplify_context (new_stmt);
gimple_bind_append_vars (new_stmt, ctx->block_vars);
+ maybe_remove_omp_member_access_dummy_vars (new_stmt);
BLOCK_VARS (block) = gimple_bind_vars (new_stmt);
if (BLOCK_VARS (block))
TREE_USED (block) = 1;
/* Declare all the variables created by mapping and the variables
declared in the scope of the parallel body. */
record_vars_into (ctx->block_vars, child_fn);
+ maybe_remove_omp_member_access_dummy_vars (par_bind);
record_vars_into (gimple_bind_vars (par_bind), child_fn);
if (ctx->record_type)
/* Declare all the variables created by mapping and the variables
declared in the scope of the target body. */
record_vars_into (ctx->block_vars, child_fn);
+ maybe_remove_omp_member_access_dummy_vars (tgt_bind);
record_vars_into (gimple_bind_vars (tgt_bind), child_fn);
}
break;
case GIMPLE_BIND:
lower_omp (gimple_bind_body_ptr (as_a <gbind *> (stmt)), ctx);
+ maybe_remove_omp_member_access_dummy_vars (as_a <gbind *> (stmt));
break;
case GIMPLE_OMP_PARALLEL:
case GIMPLE_OMP_TASK:
all_contexts = NULL;
}
BITMAP_FREE (task_shared_vars);
+
+ /* If current function is a method, remove artificial dummy VAR_DECL created
+ for non-static data member privatization, they aren't needed for
+ debuginfo nor anything else, have been already replaced everywhere in the
+ IL and cause problems with LTO. */
+ if (DECL_ARGUMENTS (current_function_decl)
+ && DECL_ARTIFICIAL (DECL_ARGUMENTS (current_function_decl))
+ && (TREE_CODE (TREE_TYPE (DECL_ARGUMENTS (current_function_decl)))
+ == POINTER_TYPE))
+ remove_member_access_dummy_vars (DECL_INITIAL (current_function_decl));
return 0;
}