diff options
author | Richard Guenther <rguenther@suse.de> | 2011-07-19 10:57:15 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-07-19 10:57:15 +0000 |
commit | 530206482667dd180acc4ca1e339389308f0736b (patch) | |
tree | fd9ee6dcb0f9d2b3d7aaed6a958cf751208c3602 /gcc/tree-ssa-forwprop.c | |
parent | b8b2b0094a9047a1ad476d96f0d20d4b56fca625 (diff) | |
download | gcc-530206482667dd180acc4ca1e339389308f0736b.tar.gz |
gimplify.c (gimplify_expr): Gimplify TRUTH_NOT_EXPR as BIT_XOR_EXPR, same as the RTL expander does.
2011-07-19 Richard Guenther <rguenther@suse.de>
* gimplify.c (gimplify_expr): Gimplify TRUTH_NOT_EXPR as
BIT_XOR_EXPR, same as the RTL expander does.
* tree-cfg.c (verify_expr): Disallow TRUTH_NOT_EXPR in the gimple IL.
(verify_gimple_assign_unary): Likewise.
* tree-ssa-propagate.c (valid_gimple_rhs_p): Disallow TRUTH_*_EXPR.
* tree-ssa-forwprop.c (forward_propagate_comparison): Handle
BIT_NOT_EXPR and BIT_XOR_EXPR instead of TRUTH_NOT_EXPR.
* gcc.dg/tree-ssa/bool-10.c: Adjust expected pattern.
* gcc.dg/tree-ssa/bool-11.c: Likewise.
* gcc.dg/torture/20110719-1.c: New testcase.
From-SVN: r176442
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r-- | gcc/tree-ssa-forwprop.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index 8e6b7040af0..1f2a60c49ba 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -1127,7 +1127,8 @@ forward_propagate_comparison (gimple stmt) && (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (use_stmt)) || TREE_CODE_CLASS (gimple_assign_rhs_code (use_stmt)) == tcc_comparison - || gimple_assign_rhs_code (use_stmt) == TRUTH_NOT_EXPR) + || gimple_assign_rhs_code (use_stmt) == BIT_NOT_EXPR + || gimple_assign_rhs_code (use_stmt) == BIT_XOR_EXPR) && INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_lhs (use_stmt)))) { tree lhs = gimple_assign_lhs (use_stmt); @@ -1164,7 +1165,10 @@ forward_propagate_comparison (gimple stmt) } /* We can propagate the condition into a statement that computes the logical negation of the comparison result. */ - else if (gimple_assign_rhs_code (use_stmt) == TRUTH_NOT_EXPR) + else if ((gimple_assign_rhs_code (use_stmt) == BIT_NOT_EXPR + && TYPE_PRECISION (TREE_TYPE (lhs)) == 1) + || (gimple_assign_rhs_code (use_stmt) == 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)); |