Commit ada39f0b by Richard Guenther Committed by Richard Biener

omp-low.c (lower_rec_input_clauses): Build correct address expressions.

2009-04-15  Richard Guenther  <rguenther@suse.de>

	* omp-low.c (lower_rec_input_clauses): Build correct address
	expressions.
	(expand_omp_for_generic): Fix multiplication type.
	* tree-loop-distribution.c (build_size_arg): Build a
	size_t argument.
	(generate_memset_zero): Fix types.
	* tree-profile.c (prepare_instrumented_value): Correctly
	widen a pointer.

From-SVN: r146129
parent 6866c6e8
2009-04-15 Richard Guenther <rguenther@suse.de>
* omp-low.c (lower_rec_input_clauses): Build correct address
expressions.
(expand_omp_for_generic): Fix multiplication type.
* tree-loop-distribution.c (build_size_arg): Build a
size_t argument.
(generate_memset_zero): Fix types.
* tree-profile.c (prepare_instrumented_value): Correctly
widen a pointer.
2009-04-15 Ian Lance Taylor <iant@google.com> 2009-04-15 Ian Lance Taylor <iant@google.com>
* c.opt (Wenum-compare): Enable for C and Objc. Initialize to -1. * c.opt (Wenum-compare): Enable for C and Objc. Initialize to -1.
......
...@@ -2318,14 +2318,14 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, ...@@ -2318,14 +2318,14 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist,
name); name);
gimple_add_tmp_var (x); gimple_add_tmp_var (x);
TREE_ADDRESSABLE (x) = 1; TREE_ADDRESSABLE (x) = 1;
x = build_fold_addr_expr_with_type (x, TREE_TYPE (new_var)); x = build_fold_addr_expr (x);
} }
else else
{ {
x = build_call_expr (built_in_decls[BUILT_IN_ALLOCA], 1, x); x = build_call_expr (built_in_decls[BUILT_IN_ALLOCA], 1, x);
x = fold_convert (TREE_TYPE (new_var), x);
} }
x = fold_convert (TREE_TYPE (new_var), x);
gimplify_assign (new_var, x, ilist); gimplify_assign (new_var, x, ilist);
new_var = build_fold_indirect_ref (new_var); new_var = build_fold_indirect_ref (new_var);
...@@ -3843,7 +3843,8 @@ expand_omp_for_generic (struct omp_region *region, ...@@ -3843,7 +3843,8 @@ expand_omp_for_generic (struct omp_region *region,
itype = lang_hooks.types.type_for_size (TYPE_PRECISION (vtype), 0); itype = lang_hooks.types.type_for_size (TYPE_PRECISION (vtype), 0);
t = fold_build2 (TRUNC_MOD_EXPR, type, tem, counts[i]); t = fold_build2 (TRUNC_MOD_EXPR, type, tem, counts[i]);
t = fold_convert (itype, t); t = fold_convert (itype, t);
t = fold_build2 (MULT_EXPR, itype, t, fd->loops[i].step); t = fold_build2 (MULT_EXPR, itype, t,
fold_convert (itype, fd->loops[i].step));
if (POINTER_TYPE_P (vtype)) if (POINTER_TYPE_P (vtype))
t = fold_build2 (POINTER_PLUS_EXPR, vtype, t = fold_build2 (POINTER_PLUS_EXPR, vtype,
fd->loops[i].n1, fold_convert (sizetype, t)); fd->loops[i].n1, fold_convert (sizetype, t));
......
...@@ -216,7 +216,7 @@ generate_loops_for_partition (struct loop *loop, bitmap partition, bool copy_p) ...@@ -216,7 +216,7 @@ generate_loops_for_partition (struct loop *loop, bitmap partition, bool copy_p)
return true; return true;
} }
/* Build size argument. */ /* Build the size argument for a memset call. */
static inline tree static inline tree
build_size_arg (tree nb_iter, tree op, gimple_seq* stmt_list) build_size_arg (tree nb_iter, tree op, gimple_seq* stmt_list)
...@@ -224,8 +224,10 @@ build_size_arg (tree nb_iter, tree op, gimple_seq* stmt_list) ...@@ -224,8 +224,10 @@ build_size_arg (tree nb_iter, tree op, gimple_seq* stmt_list)
tree nb_bytes; tree nb_bytes;
gimple_seq stmts = NULL; gimple_seq stmts = NULL;
nb_bytes = fold_build2 (MULT_EXPR, TREE_TYPE (nb_iter), nb_bytes = fold_build2 (MULT_EXPR, size_type_node,
nb_iter, TYPE_SIZE_UNIT (TREE_TYPE (op))); fold_convert (size_type_node, nb_iter),
fold_convert (size_type_node,
TYPE_SIZE_UNIT (TREE_TYPE (op))));
nb_bytes = force_gimple_operand (nb_bytes, &stmts, true, NULL); nb_bytes = force_gimple_operand (nb_bytes, &stmts, true, NULL);
gimple_seq_add_seq (stmt_list, stmts); gimple_seq_add_seq (stmt_list, stmts);
...@@ -272,7 +274,8 @@ generate_memset_zero (gimple stmt, tree op0, tree nb_iter, ...@@ -272,7 +274,8 @@ generate_memset_zero (gimple stmt, tree op0, tree nb_iter,
{ {
nb_bytes = build_size_arg (nb_iter, op0, &stmt_list); nb_bytes = build_size_arg (nb_iter, op0, &stmt_list);
addr_base = size_binop (PLUS_EXPR, DR_OFFSET (dr), DR_INIT (dr)); addr_base = size_binop (PLUS_EXPR, DR_OFFSET (dr), DR_INIT (dr));
addr_base = fold_build2 (MINUS_EXPR, sizetype, addr_base, nb_bytes); addr_base = fold_build2 (MINUS_EXPR, sizetype, addr_base,
fold_convert (sizetype, nb_bytes));
addr_base = force_gimple_operand (addr_base, &stmts, true, NULL); addr_base = force_gimple_operand (addr_base, &stmts, true, NULL);
gimple_seq_add_seq (&stmt_list, stmts); gimple_seq_add_seq (&stmt_list, stmts);
...@@ -291,7 +294,7 @@ generate_memset_zero (gimple stmt, tree op0, tree nb_iter, ...@@ -291,7 +294,7 @@ generate_memset_zero (gimple stmt, tree op0, tree nb_iter,
fn = build1 (ADDR_EXPR, build_pointer_type (fntype), fndecl); fn = build1 (ADDR_EXPR, build_pointer_type (fntype), fndecl);
if (!nb_bytes) if (!nb_bytes)
nb_bytes = build_size_arg (nb_iter, op0, &stmt_list); nb_bytes = build_size_arg (nb_iter, op0, &stmt_list);
fn_call = gimple_build_call (fn, 3, mem, integer_zero_node, nb_bytes); fn_call = gimple_build_call (fn, 3, mem, integer_zero_node, nb_bytes);
gimple_seq_add_stmt (&stmt_list, fn_call); gimple_seq_add_stmt (&stmt_list, fn_call);
......
...@@ -208,6 +208,8 @@ static tree ...@@ -208,6 +208,8 @@ static tree
prepare_instrumented_value (gimple_stmt_iterator *gsi, histogram_value value) prepare_instrumented_value (gimple_stmt_iterator *gsi, histogram_value value)
{ {
tree val = value->hvalue.value; tree val = value->hvalue.value;
if (POINTER_TYPE_P (TREE_TYPE (val)))
val = fold_convert (sizetype, val);
return force_gimple_operand_gsi (gsi, fold_convert (gcov_type_node, val), return force_gimple_operand_gsi (gsi, fold_convert (gcov_type_node, val),
true, NULL_TREE, true, GSI_SAME_STMT); true, NULL_TREE, true, GSI_SAME_STMT);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment