[PATCH] Fix some tree-ssa.exp tests
Richard Guenther
rguenther@suse.de
Thu Jul 17 12:36:00 GMT 2008
This combined patch fixes
FAIL: gcc.dg/tree-ssa/20030709-2.c scan-tree-dump-times cddce ".rtmem" 0
FAIL: gcc.dg/tree-ssa/20030807-2.c scan-tree-dump-times dom3 "if " 0
FAIL: gcc.dg/tree-ssa/20030922-1.c scan-tree-dump-times dom3 "if " 0
I'll commit it after bootstrapping & testing it.
Richard.
2008-07-17 Richard Guenther <rguenther@suse.de>
* tree-ssa-dom.c (initialize_hash_element): Do not record
the type for single rhs assigns.
(hashable_expr_equal_p): Deal with NULL types.
(eliminate_redundant_computations): Use print_gimple_expr.
* tree-vrp.c (stmt_interesting_for_vrp): Fix builtin call check.
(vrp_visit_stmt): Likewise.
* tree-ssa-forwprop.c (simplify_gimple_switch): Fix typo.
Index: gcc/tree-ssa-dom.c
===================================================================
*** gcc/tree-ssa-dom.c.orig 2008-07-17 14:14:22.000000000 +0200
--- gcc/tree-ssa-dom.c 2008-07-17 14:15:49.000000000 +0200
*************** initialize_hash_element (gimple stmt, tr
*** 225,231 ****
{
enum tree_code subcode = gimple_assign_rhs_code (stmt);
! expr->type = TREE_TYPE (gimple_assign_lhs (stmt));
switch (get_gimple_rhs_class (subcode))
{
--- 225,231 ----
{
enum tree_code subcode = gimple_assign_rhs_code (stmt);
! expr->type = NULL_TREE;
switch (get_gimple_rhs_class (subcode))
{
*************** initialize_hash_element (gimple stmt, tr
*** 235,245 ****
--- 235,247 ----
break;
case GIMPLE_UNARY_RHS:
expr->kind = EXPR_UNARY;
+ expr->type = TREE_TYPE (gimple_assign_lhs (stmt));
expr->ops.unary.op = subcode;
expr->ops.unary.opnd = gimple_assign_rhs1 (stmt);
break;
case GIMPLE_BINARY_RHS:
expr->kind = EXPR_BINARY;
+ expr->type = TREE_TYPE (gimple_assign_lhs (stmt));
expr->ops.binary.op = subcode;
expr->ops.binary.opnd0 = gimple_assign_rhs1 (stmt);
expr->ops.binary.opnd1 = gimple_assign_rhs2 (stmt);
*************** hashable_expr_equal_p (const struct hash
*** 354,364 ****
/* If both types don't have the same signedness, precision, and mode,
then we can't consider them equal. */
! if (TREE_CODE (type0) == ERROR_MARK
! || TREE_CODE (type1) == ERROR_MARK
! || TYPE_UNSIGNED (type0) != TYPE_UNSIGNED (type1)
! || TYPE_PRECISION (type0) != TYPE_PRECISION (type1)
! || TYPE_MODE (type0) != TYPE_MODE (type1))
return false;
if (expr0->kind != expr1->kind)
--- 356,367 ----
/* If both types don't have the same signedness, precision, and mode,
then we can't consider them equal. */
! if (type0 != type1
! && (TREE_CODE (type0) == ERROR_MARK
! || TREE_CODE (type1) == ERROR_MARK
! || TYPE_UNSIGNED (type0) != TYPE_UNSIGNED (type1)
! || TYPE_PRECISION (type0) != TYPE_PRECISION (type1)
! || TYPE_MODE (type0) != TYPE_MODE (type1)))
return false;
if (expr0->kind != expr1->kind)
*************** eliminate_redundant_computations (gimple
*** 1886,1894 ****
if (dump_file && (dump_flags & TDF_DETAILS))
{
! fprintf (dump_file, " Replaced redundant expr in statement\n ");
! print_gimple_stmt (dump_file, stmt, 0, dump_flags);
! fprintf (dump_file, " with '");
print_generic_expr (dump_file, cached_lhs, dump_flags);
fprintf (dump_file, "'\n");
}
--- 1889,1897 ----
if (dump_file && (dump_flags & TDF_DETAILS))
{
! fprintf (dump_file, " Replaced redundant expr '");
! print_gimple_expr (dump_file, stmt, 0, dump_flags);
! fprintf (dump_file, "' with '");
print_generic_expr (dump_file, cached_lhs, dump_flags);
fprintf (dump_file, "'\n");
}
Index: gcc/tree-vrp.c
===================================================================
*** gcc/tree-vrp.c.orig 2008-07-17 14:14:22.000000000 +0200
--- gcc/tree-vrp.c 2008-07-17 14:15:49.000000000 +0200
*************** stmt_interesting_for_vrp (gimple stmt)
*** 5046,5054 ****
&& (INTEGRAL_TYPE_P (TREE_TYPE (lhs))
|| POINTER_TYPE_P (TREE_TYPE (lhs)))
&& ((is_gimple_call (stmt)
! && TREE_CODE (gimple_call_fn (stmt)) == ADDR_EXPR
! && DECL_P (TREE_OPERAND (gimple_call_fn (stmt), 0))
! && DECL_IS_BUILTIN (TREE_OPERAND (gimple_call_fn (stmt), 0)))
|| ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS)))
return true;
}
--- 5046,5053 ----
&& (INTEGRAL_TYPE_P (TREE_TYPE (lhs))
|| POINTER_TYPE_P (TREE_TYPE (lhs)))
&& ((is_gimple_call (stmt)
! && gimple_call_fndecl (stmt) != NULL_TREE
! && DECL_IS_BUILTIN (gimple_call_fndecl (stmt)))
|| ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS)))
return true;
}
*************** vrp_visit_stmt (gimple stmt, edge *taken
*** 5845,5853 ****
builtin functions. */
if ((is_gimple_call (stmt)
! && TREE_CODE (gimple_call_fn (stmt)) == ADDR_EXPR
! && DECL_P (TREE_OPERAND (gimple_call_fn (stmt), 0))
! && DECL_IS_BUILTIN (TREE_OPERAND (gimple_call_fn (stmt), 0)))
|| ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS))
return vrp_visit_assignment_or_call (stmt, output_p);
}
--- 5844,5851 ----
builtin functions. */
if ((is_gimple_call (stmt)
! && gimple_call_fndecl (stmt) != NULL_TREE
! && DECL_IS_BUILTIN (gimple_call_fndecl (stmt)))
|| ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS))
return vrp_visit_assignment_or_call (stmt, output_p);
}
Index: gcc/tree-ssa-forwprop.c
===================================================================
*** gcc/tree-ssa-forwprop.c.orig 2008-07-17 11:05:42.000000000 +0200
--- gcc/tree-ssa-forwprop.c 2008-07-17 14:23:29.000000000 +0200
*************** simplify_gimple_switch (gimple stmt)
*** 1080,1086 ****
int need_precision;
bool fail;
! def = gimple_assign_lhs (def_stmt);
#ifdef ENABLE_CHECKING
/* ??? Why was Jeff testing this? We are gimple... */
--- 1080,1086 ----
int need_precision;
bool fail;
! def = gimple_assign_rhs1 (def_stmt);
#ifdef ENABLE_CHECKING
/* ??? Why was Jeff testing this? We are gimple... */
More information about the Gcc-patches
mailing list