+2015-09-23 Thomas Schwinge <thomas@codesourcery.com>
+ Nathan Sidwell <nathan@codesourcery.com>
+
+ * omp-low.h (omp_reduction_init_op): Declare.
+ * omp-low.c (omp_reduction_init_op): New, broken out of ...
+ (omp_reduction_init): ... here. Call it.
+ * tree-parloops.c (initialize_reductions): Use
+ omp_reduction_init_op.
+
2015-09-23 Richard Biener <rguenther@suse.de>
PR middle-end/67662
}
-/* Construct the initialization value for reduction CLAUSE. */
+/* Construct the initialization value for reduction operation OP. */
tree
-omp_reduction_init (tree clause, tree type)
+omp_reduction_init_op (location_t loc, enum tree_code op, tree type)
{
- location_t loc = OMP_CLAUSE_LOCATION (clause);
- switch (OMP_CLAUSE_REDUCTION_CODE (clause))
+ switch (op)
{
case PLUS_EXPR:
case MINUS_EXPR:
}
}
+/* Construct the initialization value for reduction CLAUSE. */
+
+tree
+omp_reduction_init (tree clause, tree type)
+{
+ return omp_reduction_init_op (OMP_CLAUSE_LOCATION (clause),
+ OMP_CLAUSE_REDUCTION_CODE (clause), type);
+}
+
/* Return alignment to be assumed for var in CLAUSE, which should be
OMP_CLAUSE_ALIGNED. */
extern tree find_omp_clause (tree, enum omp_clause_code);
extern void omp_expand_local (basic_block);
extern void free_omp_regions (void);
+extern tree omp_reduction_init_op (location_t, enum tree_code, tree);
extern tree omp_reduction_init (tree, tree);
extern bool make_gimple_omp_edges (basic_block, struct omp_region **, int *);
extern void omp_finish_file (void);
int
initialize_reductions (reduction_info **slot, struct loop *loop)
{
- tree init, c;
- tree bvar, type, arg;
+ tree init;
+ tree type, arg;
edge e;
struct reduction_info *const reduc = *slot;
/* In the phi node at the header, replace the argument coming
from the preheader with the reduction initialization value. */
- /* Create a new variable to initialize the reduction. */
+ /* Initialize the reduction. */
type = TREE_TYPE (PHI_RESULT (reduc->reduc_phi));
- bvar = create_tmp_var (type, "reduction");
-
- c = build_omp_clause (gimple_location (reduc->reduc_stmt),
- OMP_CLAUSE_REDUCTION);
- OMP_CLAUSE_REDUCTION_CODE (c) = reduc->reduction_code;
- OMP_CLAUSE_DECL (c) = SSA_NAME_VAR (reduc_stmt_res (reduc->reduc_stmt));
-
- init = omp_reduction_init (c, TREE_TYPE (bvar));
+ init = omp_reduction_init_op (gimple_location (reduc->reduc_stmt),
+ reduc->reduction_code, type);
reduc->init = init;
/* Replace the argument representing the initialization value