summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-forwprop.c
diff options
context:
space:
mode:
authorKai Tietz <ktietz@redhat.com>2011-07-21 14:11:28 +0200
committerKai Tietz <ktietz@gcc.gnu.org>2011-07-21 14:11:28 +0200
commit7f3ff782991c13d787b67918e965c8a1dd620935 (patch)
tree3fcf31bae07e5780a558bd87b46dde066bfb218e /gcc/tree-ssa-forwprop.c
parent0c53708eadd727f4089028e09840865db25a3cd9 (diff)
downloadgcc-7f3ff782991c13d787b67918e965c8a1dd620935.tar.gz
ChangeLog gcc/
2011-07-21 Kai Tietz <ktietz@redhat.com> * fold-const.c (fold_unary_loc): Preserve indirect comparison cast to none-boolean type. * tree-ssa.c (useless_type_conversion_p): Preserve cast from/to boolean-type. * gimplify.c (gimple_boolify): Handle boolification of comparisons. (gimplify_expr): Boolifiy non aggregate-typed comparisons. * tree-cfg.c (verify_gimple_comparison): Check result type of comparison expression. * tree-ssa-forwprop.c (forward_propagate_comparison): Adjust test of condition result and disallow type-cast sinking into comparison. ChangeLog gcc/testsuite 2011-07-21 Kai Tietz <ktietz@redhat.com> * gcc.dg/tree-ssa/pr30978.c: adjusted. * gcc.dg/tree-ssa/ssa-fre-6.c: Likewise. * gcc.dg/binop-xor1.c: Set to fail. * gcc.dg/binop-xor3.c: Set to fail. From-SVN: r176563
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r--gcc/tree-ssa-forwprop.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index d51773a2a3f..c08cb18e7af 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -1132,20 +1132,12 @@ forward_propagate_comparison (gimple stmt)
if (!INTEGRAL_TYPE_P (TREE_TYPE (lhs)))
return false;
- /* We can propagate the condition into a conversion. */
- if (CONVERT_EXPR_CODE_P (code))
- {
- /* Avoid using fold here as that may create a COND_EXPR with
- non-boolean condition as canonical form. */
- tmp = build2 (gimple_assign_rhs_code (stmt), TREE_TYPE (lhs),
- gimple_assign_rhs1 (stmt), gimple_assign_rhs2 (stmt));
- }
/* We can propagate the condition into a statement that
computes the logical negation of the comparison result. */
- else if ((code == BIT_NOT_EXPR
- && TYPE_PRECISION (TREE_TYPE (lhs)) == 1)
- || (code == BIT_XOR_EXPR
- && integer_onep (gimple_assign_rhs2 (use_stmt))))
+ if ((code == BIT_NOT_EXPR
+ && TYPE_PRECISION (TREE_TYPE (lhs)) == 1)
+ || (code == BIT_XOR_EXPR
+ && integer_onep (gimple_assign_rhs2 (use_stmt))))
{
tree type = TREE_TYPE (gimple_assign_rhs1 (stmt));
bool nans = HONOR_NANS (TYPE_MODE (type));
@@ -1750,6 +1742,7 @@ simplify_bitwise_binary (gimple_stmt_iterator *gsi)
arg2));
tem = make_ssa_name (tem, newop);
gimple_assign_set_lhs (newop, tem);
+ gimple_set_location (newop, gimple_location (stmt));
gsi_insert_before (gsi, newop, GSI_SAME_STMT);
gimple_assign_set_rhs_with_ops_1 (gsi, NOP_EXPR,
tem, NULL_TREE, NULL_TREE);
@@ -1779,6 +1772,7 @@ simplify_bitwise_binary (gimple_stmt_iterator *gsi)
newop = gimple_build_assign_with_ops (code, tem, def1_arg1, def2_arg1);
tem = make_ssa_name (tem, newop);
gimple_assign_set_lhs (newop, tem);
+ gimple_set_location (newop, gimple_location (stmt));
gsi_insert_before (gsi, newop, GSI_SAME_STMT);
gimple_assign_set_rhs_with_ops_1 (gsi, NOP_EXPR,
tem, NULL_TREE, NULL_TREE);
@@ -1807,6 +1801,7 @@ simplify_bitwise_binary (gimple_stmt_iterator *gsi)
tem, def1_arg1, arg2);
tem = make_ssa_name (tem, newop);
gimple_assign_set_lhs (newop, tem);
+ gimple_set_location (newop, gimple_location (stmt));
/* Make sure to re-process the new stmt as it's walking upwards. */
gsi_insert_before (gsi, newop, GSI_NEW_STMT);
gimple_assign_set_rhs1 (stmt, tem);