diff options
author | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-02-28 21:31:29 +0000 |
---|---|---|
committer | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-02-28 21:31:29 +0000 |
commit | 7ae0e4a96c159b4d613f7099ffd6d860ac26a32d (patch) | |
tree | 8d1748fbeb1a55f369adfeaebb8d0d24b433d2d2 /gcc/c-common.c | |
parent | c5780f6df7be05e8b129d88dadfceaae3a0ec4da (diff) | |
download | gcc-7ae0e4a96c159b4d613f7099ffd6d860ac26a32d.tar.gz |
PR middle-end/14752
* c-common.c (c_common_truthvalue_conversion) <MINUS_EXPR,
BIT_XOR_EXPR, BIT_AND_EXPR>: Delete. Let fold optimize these
cases via the construction of "expr != 0".
* gcc.dg/fold-eqandshift-2.c: New test case.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111575 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 4f8ab8e0d4b..1a11c3b189a 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -2537,37 +2537,6 @@ c_common_truthvalue_conversion (tree expr) return c_common_truthvalue_conversion (TREE_OPERAND (expr, 0)); break; - case MINUS_EXPR: - /* Perhaps reduce (x - y) != 0 to (x != y). The expressions - aren't guaranteed to the be same for modes that can represent - infinity, since if x and y are both +infinity, or both - -infinity, then x - y is not a number. - - Note that this transformation is safe when x or y is NaN. - (x - y) is then NaN, and both (x - y) != 0 and x != y will - be false. */ - if (HONOR_INFINITIES (TYPE_MODE (TREE_TYPE (TREE_OPERAND (expr, 0))))) - break; - /* Fall through.... */ - case BIT_XOR_EXPR: - /* This and MINUS_EXPR can be changed into a comparison of the - two objects. */ - if (TREE_TYPE (TREE_OPERAND (expr, 0)) - == TREE_TYPE (TREE_OPERAND (expr, 1))) - return fold_build2 (NE_EXPR, truthvalue_type_node, - TREE_OPERAND (expr, 0), TREE_OPERAND (expr, 1)); - return fold_build2 (NE_EXPR, truthvalue_type_node, - TREE_OPERAND (expr, 0), - fold_convert (TREE_TYPE (TREE_OPERAND (expr, 0)), - TREE_OPERAND (expr, 1))); - - case BIT_AND_EXPR: - if (integer_onep (TREE_OPERAND (expr, 1)) - && TREE_TYPE (expr) != truthvalue_type_node) - /* Using convert here would cause infinite recursion. */ - return build1 (NOP_EXPR, truthvalue_type_node, expr); - break; - case MODIFY_EXPR: if (!TREE_NO_WARNING (expr)) warning (OPT_Wparentheses, |