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 16:14:00 +0200 (CEST)
- Subject: [PATCH] More type fixes.
Nothing earth shattering but maybe the VN change. For not value-numbered
SSA_NAMEs we retain a zero value-number which causes willy-nilly
eliminations across different types which later ICEs of course. In
theory harmless as we only do not value-number SSA_NAMEs with zero
uses. Still this looked like the most simple fix.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
Richard.
2009-04-15 Richard Guenther <rguenther@suse.de>
* tree-ssa-pre.c (eliminate): When replacing a PHI node carry
out a necessary conversion.
* tree-ssa-sccvn.c (run_scc_vn): Also assign value-ids to
names we didn't value number.
* tree-mudflap.c (mf_build_check_statement_for): Use correct types.
Index: gcc/tree-ssa-pre.c
===================================================================
*** gcc/tree-ssa-pre.c.orig 2009-04-14 10:18:14.000000000 +0200
--- gcc/tree-ssa-pre.c 2009-04-15 13:44:59.000000000 +0200
*************** eliminate (void)
*** 4181,4186 ****
--- 4181,4188 ----
remove_phi_node (&gsi, false);
+ if (!useless_type_conversion_p (TREE_TYPE (res), TREE_TYPE (sprime)))
+ sprime = fold_convert (TREE_TYPE (res), sprime);
stmt = gimple_build_assign (res, sprime);
SSA_NAME_DEF_STMT (res) = stmt;
if (TREE_CODE (sprime) == SSA_NAME)
Index: gcc/tree-ssa-sccvn.c
===================================================================
*** gcc/tree-ssa-sccvn.c.orig 2009-04-14 10:18:14.000000000 +0200
--- gcc/tree-ssa-sccvn.c 2009-04-15 13:45:47.000000000 +0200
*************** run_scc_vn (bool may_insert_arg)
*** 2886,2892 ****
if (!name)
continue;
info = VN_INFO (name);
! if (info->valnum == name)
info->value_id = get_next_value_id ();
else if (is_gimple_min_invariant (info->valnum))
info->value_id = get_or_alloc_constant_value_id (info->valnum);
--- 2886,2893 ----
if (!name)
continue;
info = VN_INFO (name);
! if (info->valnum == name
! || info->valnum == VN_TOP)
info->value_id = get_next_value_id ();
else if (is_gimple_min_invariant (info->valnum))
info->value_id = get_or_alloc_constant_value_id (info->valnum);
Index: gcc/tree-mudflap.c
===================================================================
*** gcc/tree-mudflap.c.orig 2009-03-31 12:20:22.000000000 +0200
--- gcc/tree-mudflap.c 2009-04-15 14:14:37.000000000 +0200
*************** mf_build_check_statement_for (tree base,
*** 634,640 ****
/* Build the conditional jump. 'cond' is just a temporary so we can
simply build a void COND_EXPR. We do need labels in both arms though. */
! g = gimple_build_cond (NE_EXPR, cond, integer_zero_node, NULL_TREE,
NULL_TREE);
gimple_set_location (g, location);
gimple_seq_add_stmt (&seq, g);
--- 634,640 ----
/* Build the conditional jump. 'cond' is just a temporary so we can
simply build a void COND_EXPR. We do need labels in both arms though. */
! g = gimple_build_cond (NE_EXPR, cond, boolean_false_node, NULL_TREE,
NULL_TREE);
gimple_set_location (g, location);
gimple_seq_add_stmt (&seq, g);
*************** mf_build_check_statement_for (tree base,
*** 664,672 ****
/* u is a string, so it is already a gimple value. */
u = mf_file_function_line_tree (location);
/* NB: we pass the overall [base..limit] range to mf_check. */
! v = fold_build2 (PLUS_EXPR, integer_type_node,
fold_build2 (MINUS_EXPR, mf_uintptr_type, mf_limit, mf_base),
! integer_one_node);
v = force_gimple_operand (v, &stmts, true, NULL_TREE);
gimple_seq_add_seq (&seq, stmts);
g = gimple_build_call (mf_check_fndecl, 4, mf_base, v, dirflag, u);
--- 664,672 ----
/* u is a string, so it is already a gimple value. */
u = mf_file_function_line_tree (location);
/* NB: we pass the overall [base..limit] range to mf_check. */
! v = fold_build2 (PLUS_EXPR, mf_uintptr_type,
fold_build2 (MINUS_EXPR, mf_uintptr_type, mf_limit, mf_base),
! build_int_cst (mf_uintptr_type, 1));
v = force_gimple_operand (v, &stmts, true, NULL_TREE);
gimple_seq_add_seq (&seq, stmts);
g = gimple_build_call (mf_check_fndecl, 4, mf_base, v, dirflag, u);