aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
authorJames A. Morrison <phython@gcc.gnu.org>2005-07-20 20:26:11 +0000
committerJames A. Morrison <phython@gcc.gnu.org>2005-07-20 20:26:11 +0000
commit4db8040cd4deb681b4bfe51535345eca42cbd42b (patch)
tree7f921cc272661cbe1016b176fa359221ff219a4f /gcc/tree-vrp.c
parent09350e36ee3973f286340455d1e8c01506699f73 (diff)
downloadgcc-4db8040cd4deb681b4bfe51535345eca42cbd42b.zip
gcc-4db8040cd4deb681b4bfe51535345eca42cbd42b.tar.gz
gcc-4db8040cd4deb681b4bfe51535345eca42cbd42b.tar.bz2
tree.h (tree_expr_nonzero_p): Export.
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. From-SVN: r102201
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r--gcc/tree-vrp.c36
1 files changed, 3 insertions, 33 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index a42a21a..e7d877d 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -95,36 +95,6 @@ static sbitmap blocks_visited;
static value_range_t **vr_value;
-/* Return true if EXPR computes a non-zero value. */
-
-bool
-expr_computes_nonzero (tree expr)
-{
- /* Type casts won't change anything, so just strip them. */
- STRIP_NOPS (expr);
-
- /* Calling alloca, guarantees that the value is non-NULL. */
- if (alloca_call_p (expr))
- return true;
-
- /* The address of a non-weak symbol is never NULL, unless the user
- has requested not to remove NULL pointer checks. */
- if (flag_delete_null_pointer_checks
- && TREE_CODE (expr) == ADDR_EXPR
- && VAR_OR_FUNCTION_DECL_P (TREE_OPERAND (expr, 0))
- && !DECL_WEAK (TREE_OPERAND (expr, 0)))
- return true;
-
- /* IOR of any value with a nonzero value will result in a nonzero
- value. */
- if (TREE_CODE (expr) == BIT_IOR_EXPR
- && integer_nonzerop (TREE_OPERAND (expr, 1)))
- return true;
-
- return false;
-}
-
-
/* Return true if ARG is marked with the nonnull attribute in the
current function signature. */
@@ -393,13 +363,13 @@ symbolic_range_p (value_range_t *vr)
}
-/* Like expr_computes_nonzero, but this function uses value ranges
+/* Like tree_expr_nonzero_p, but this function uses value ranges
obtained so far. */
static bool
vrp_expr_computes_nonzero (tree expr)
{
- if (expr_computes_nonzero (expr))
+ if (tree_expr_nonzero_p (expr))
return true;
/* If we have an expression of the form &X->a, then the expression
@@ -1319,7 +1289,7 @@ extract_range_from_unary_expr (value_range_t *vr, tree expr)
determining if it evaluates to NULL [0, 0] or non-NULL (~[0, 0]). */
if (POINTER_TYPE_P (TREE_TYPE (expr)) || POINTER_TYPE_P (TREE_TYPE (op0)))
{
- if (range_is_nonnull (&vr0) || expr_computes_nonzero (expr))
+ if (range_is_nonnull (&vr0) || tree_expr_nonzero_p (expr))
set_value_range_to_nonnull (vr, TREE_TYPE (expr));
else if (range_is_null (&vr0))
set_value_range_to_null (vr, TREE_TYPE (expr));