diff options
author | James A. Morrison <phython@gcc.gnu.org> | 2005-07-20 20:26:11 +0000 |
---|---|---|
committer | James A. Morrison <phython@gcc.gnu.org> | 2005-07-20 20:26:11 +0000 |
commit | ce59ee23ae72d338442ce62359c6531c36dea90f (patch) | |
tree | 7f921cc272661cbe1016b176fa359221ff219a4f /gcc/fold-const.c | |
parent | 59a218c4007c3588c5dae3bd9649da57d34006a7 (diff) |
2005-07-20 James A. Morrison <phython@gcc.gnu.org>
* tree.h (tree_expr_nonzero_p): Export.
* fold-const.c (tree_expr_nonzero_p): Likewise.
Return true for CALL_EXPRs that are alloca calls.
(fold_binary): Use omit_one_operand when checking EQ_EXPRs or NE_EXPRs
against zero.
* tree-flow.h (expr_computes_nonzero): Remove.
* tree-vrp.c (expr_computes_nonzero): Remove.
(vrp_expr_computes_nonzero): Use tree_expr_nonzero_p.
(extract_range_from_unary_expr): Likewise.
* tree-ssa-dom.c (record_equivalences_from_stmt): Use
tree_expr_nonzero_p.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@102201 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index e9d88d1e6c3..7b83eb3ef5f 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -132,7 +132,6 @@ static bool reorder_operands_p (tree, tree); static tree fold_negate_const (tree, tree); static tree fold_not_const (tree, tree); static tree fold_relational_const (enum tree_code, tree, tree, tree); -static bool tree_expr_nonzero_p (tree); /* We know that A1 + B1 = SUM1, using 2's complement arithmetic and ignoring overflow. Suppose A, B and SUM have the same respective signs as A1, B1, @@ -9694,10 +9693,12 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) } if ((code == EQ_EXPR || code == NE_EXPR) - && !TREE_SIDE_EFFECTS (arg0) && integer_zerop (arg1) && tree_expr_nonzero_p (arg0)) - return constant_boolean_node (code==NE_EXPR, type); + { + tree res = constant_boolean_node (code==NE_EXPR, type); + return omit_one_operand (type, res, arg0); + } t1 = fold_relational_const (code, type, arg0, arg1); return t1 == NULL_TREE ? NULL_TREE : t1; @@ -10797,7 +10798,7 @@ tree_expr_nonnegative_p (tree t) For floating point we further ensure that T is not denormal. Similar logic is present in nonzero_address in rtlanal.h. */ -static bool +bool tree_expr_nonzero_p (tree t) { tree type = TREE_TYPE (t); @@ -10904,6 +10905,9 @@ tree_expr_nonzero_p (tree t) return tree_expr_nonzero_p (TREE_OPERAND (t, 1)) || tree_expr_nonzero_p (TREE_OPERAND (t, 0)); + case CALL_EXPR: + return alloca_call_p (t); + default: break; } |