aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-05-18 05:37:27 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2007-05-18 05:37:27 +0000
commitb60b471172167ddbfe0ef0e6d2691af28aae9196 (patch)
tree82b59301017fd7caf050bd86c289a5e62f6bbfed /gcc/tree-vrp.c
parent0968bb3d1d3090e0caba5101baa43789d41b62cb (diff)
downloadgcc-b60b471172167ddbfe0ef0e6d2691af28aae9196.zip
gcc-b60b471172167ddbfe0ef0e6d2691af28aae9196.tar.gz
gcc-b60b471172167ddbfe0ef0e6d2691af28aae9196.tar.bz2
re PR tree-optimization/31953 (ICE in set_value_range, at tree-vrp.c:305)
./: PR tree-optimization/31953 * tree-vrp.c (set_value_range_to_value): Add equiv parameter. Change all callers. (set_value_range_to_null): Call set_value_range_to_value. (extract_range_from_comparison): Likewise. testsuite/: PR tree-optimization/31953 * gcc.c-torture/compile/pr31953.c: New test. From-SVN: r124823
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r--gcc/tree-vrp.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 5f42ff6..efb4f68 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -358,7 +358,7 @@ set_value_range_to_varying (value_range_t *vr)
infinity when we shouldn't. */
static inline void
-set_value_range_to_value (value_range_t *vr, tree val)
+set_value_range_to_value (value_range_t *vr, tree val, bitmap equiv)
{
gcc_assert (is_gimple_min_invariant (val));
if (is_overflow_infinity (val))
@@ -374,7 +374,7 @@ set_value_range_to_value (value_range_t *vr, tree val)
val = TYPE_MIN_VALUE (TREE_TYPE (val));
}
}
- set_value_range (vr, VR_RANGE, val, val, NULL);
+ set_value_range (vr, VR_RANGE, val, val, equiv);
}
/* Set value range VR to a non-negative range of type TYPE.
@@ -418,8 +418,7 @@ set_value_range_to_nonnull (value_range_t *vr, tree type)
static inline void
set_value_range_to_null (value_range_t *vr, tree type)
{
- tree zero = build_int_cst (type, 0);
- set_value_range (vr, VR_RANGE, zero, zero, vr->equiv);
+ set_value_range_to_value (vr, build_int_cst (type, 0), vr->equiv);
}
@@ -1702,7 +1701,7 @@ extract_range_from_binary_expr (value_range_t *vr, tree expr)
if (TREE_CODE (op0) == SSA_NAME)
vr0 = *(get_value_range (op0));
else if (is_gimple_min_invariant (op0))
- set_value_range_to_value (&vr0, op0);
+ set_value_range_to_value (&vr0, op0, NULL);
else
set_value_range_to_varying (&vr0);
@@ -1710,7 +1709,7 @@ extract_range_from_binary_expr (value_range_t *vr, tree expr)
if (TREE_CODE (op1) == SSA_NAME)
vr1 = *(get_value_range (op1));
else if (is_gimple_min_invariant (op1))
- set_value_range_to_value (&vr1, op1);
+ set_value_range_to_value (&vr1, op1, NULL);
else
set_value_range_to_varying (&vr1);
@@ -2107,7 +2106,7 @@ extract_range_from_unary_expr (value_range_t *vr, tree expr)
if (TREE_CODE (op0) == SSA_NAME)
vr0 = *(get_value_range (op0));
else if (is_gimple_min_invariant (op0))
- set_value_range_to_value (&vr0, op0);
+ set_value_range_to_value (&vr0, op0, NULL);
else
set_value_range_to_varying (&vr0);
@@ -2490,7 +2489,7 @@ extract_range_from_cond_expr (value_range_t *vr, tree expr)
if (TREE_CODE (op0) == SSA_NAME)
vr0 = *(get_value_range (op0));
else if (is_gimple_min_invariant (op0))
- set_value_range_to_value (&vr0, op0);
+ set_value_range_to_value (&vr0, op0, NULL);
else
set_value_range_to_varying (&vr0);
@@ -2498,7 +2497,7 @@ extract_range_from_cond_expr (value_range_t *vr, tree expr)
if (TREE_CODE (op1) == SSA_NAME)
vr1 = *(get_value_range (op1));
else if (is_gimple_min_invariant (op1))
- set_value_range_to_value (&vr1, op1);
+ set_value_range_to_value (&vr1, op1, NULL);
else
set_value_range_to_varying (&vr1);
@@ -2528,7 +2527,10 @@ extract_range_from_comparison (value_range_t *vr, tree expr)
its type may be different from _Bool. Convert VAL to EXPR's
type. */
val = fold_convert (TREE_TYPE (expr), val);
- set_value_range (vr, VR_RANGE, val, val, vr->equiv);
+ if (is_gimple_min_invariant (val))
+ set_value_range_to_value (vr, val, vr->equiv);
+ else
+ set_value_range (vr, VR_RANGE, val, val, vr->equiv);
}
else
/* The result of a comparison is always true or false. */
@@ -2562,7 +2564,7 @@ extract_range_from_expr (value_range_t *vr, tree expr)
else if (TREE_CODE_CLASS (code) == tcc_comparison)
extract_range_from_comparison (vr, expr);
else if (is_gimple_min_invariant (expr))
- set_value_range_to_value (vr, expr);
+ set_value_range_to_value (vr, expr, NULL);
else
set_value_range_to_varying (vr);