This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] More type fixes
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 15 Apr 2009 18:11:07 +0200 (CEST)
- Subject: [PATCH] More type fixes
Less and less failures ...
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
Richard.
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.
Index: gcc/omp-low.c
===================================================================
*** gcc/omp-low.c.orig 2009-04-14 15:49:23.000000000 +0200
--- gcc/omp-low.c 2009-04-15 15:23:00.000000000 +0200
*************** lower_rec_input_clauses (tree clauses, g
*** 2318,2331 ****
name);
gimple_add_tmp_var (x);
TREE_ADDRESSABLE (x) = 1;
! x = build_fold_addr_expr_with_type (x, TREE_TYPE (new_var));
}
else
{
x = build_call_expr (built_in_decls[BUILT_IN_ALLOCA], 1, x);
- x = fold_convert (TREE_TYPE (new_var), x);
}
gimplify_assign (new_var, x, ilist);
new_var = build_fold_indirect_ref (new_var);
--- 2318,2331 ----
name);
gimple_add_tmp_var (x);
TREE_ADDRESSABLE (x) = 1;
! x = build_fold_addr_expr (x);
}
else
{
x = build_call_expr (built_in_decls[BUILT_IN_ALLOCA], 1, x);
}
+ x = fold_convert (TREE_TYPE (new_var), x);
gimplify_assign (new_var, x, ilist);
new_var = build_fold_indirect_ref (new_var);
*************** expand_omp_for_generic (struct omp_regio
*** 3843,3849 ****
itype = lang_hooks.types.type_for_size (TYPE_PRECISION (vtype), 0);
t = fold_build2 (TRUNC_MOD_EXPR, type, tem, counts[i]);
t = fold_convert (itype, t);
! t = fold_build2 (MULT_EXPR, itype, t, fd->loops[i].step);
if (POINTER_TYPE_P (vtype))
t = fold_build2 (POINTER_PLUS_EXPR, vtype,
fd->loops[i].n1, fold_convert (sizetype, t));
--- 3843,3850 ----
itype = lang_hooks.types.type_for_size (TYPE_PRECISION (vtype), 0);
t = fold_build2 (TRUNC_MOD_EXPR, type, tem, counts[i]);
t = fold_convert (itype, t);
! t = fold_build2 (MULT_EXPR, itype, t,
! fold_convert (itype, fd->loops[i].step));
if (POINTER_TYPE_P (vtype))
t = fold_build2 (POINTER_PLUS_EXPR, vtype,
fd->loops[i].n1, fold_convert (sizetype, t));
Index: gcc/tree-loop-distribution.c
===================================================================
*** gcc/tree-loop-distribution.c.orig 2009-04-15 15:08:46.000000000 +0200
--- gcc/tree-loop-distribution.c 2009-04-15 15:14:18.000000000 +0200
*************** generate_loops_for_partition (struct loo
*** 216,222 ****
return true;
}
! /* Build size argument. */
static inline tree
build_size_arg (tree nb_iter, tree op, gimple_seq* stmt_list)
--- 216,222 ----
return true;
}
! /* Build the size argument for a memset call. */
static inline tree
build_size_arg (tree nb_iter, tree op, gimple_seq* stmt_list)
*************** build_size_arg (tree nb_iter, tree op, g
*** 224,231 ****
tree nb_bytes;
gimple_seq stmts = NULL;
! nb_bytes = fold_build2 (MULT_EXPR, TREE_TYPE (nb_iter),
! nb_iter, TYPE_SIZE_UNIT (TREE_TYPE (op)));
nb_bytes = force_gimple_operand (nb_bytes, &stmts, true, NULL);
gimple_seq_add_seq (stmt_list, stmts);
--- 224,233 ----
tree nb_bytes;
gimple_seq stmts = NULL;
! nb_bytes = fold_build2 (MULT_EXPR, size_type_node,
! 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);
gimple_seq_add_seq (stmt_list, stmts);
*************** generate_memset_zero (gimple stmt, tree
*** 272,278 ****
{
nb_bytes = build_size_arg (nb_iter, op0, &stmt_list);
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 = force_gimple_operand (addr_base, &stmts, true, NULL);
gimple_seq_add_seq (&stmt_list, stmts);
--- 274,281 ----
{
nb_bytes = build_size_arg (nb_iter, op0, &stmt_list);
addr_base = size_binop (PLUS_EXPR, DR_OFFSET (dr), DR_INIT (dr));
! addr_base = fold_build2 (MINUS_EXPR, sizetype, addr_base,
! fold_convert (sizetype, nb_bytes));
addr_base = force_gimple_operand (addr_base, &stmts, true, NULL);
gimple_seq_add_seq (&stmt_list, stmts);
*************** generate_memset_zero (gimple stmt, tree
*** 291,297 ****
fn = build1 (ADDR_EXPR, build_pointer_type (fntype), fndecl);
if (!nb_bytes)
! nb_bytes = build_size_arg (nb_iter, op0, &stmt_list);
fn_call = gimple_build_call (fn, 3, mem, integer_zero_node, nb_bytes);
gimple_seq_add_stmt (&stmt_list, fn_call);
--- 294,300 ----
fn = build1 (ADDR_EXPR, build_pointer_type (fntype), fndecl);
if (!nb_bytes)
! nb_bytes = build_size_arg (nb_iter, op0, &stmt_list);
fn_call = gimple_build_call (fn, 3, mem, integer_zero_node, nb_bytes);
gimple_seq_add_stmt (&stmt_list, fn_call);
Index: gcc/tree-profile.c
===================================================================
*** gcc/tree-profile.c.orig 2009-04-04 11:28:46.000000000 +0200
--- gcc/tree-profile.c 2009-04-15 15:56:00.000000000 +0200
*************** static tree
*** 208,213 ****
--- 208,215 ----
prepare_instrumented_value (gimple_stmt_iterator *gsi, histogram_value 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),
true, NULL_TREE, true, GSI_SAME_STMT);
}