aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
authorKazu Hirata <kazu@cs.umass.edu>2005-04-29 16:23:18 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2005-04-29 16:23:18 +0000
commitd54485660a538334a90ce036ae6b1e011b301515 (patch)
tree7d79e5bb9ea9131043f8689608e39ddf697f7968 /gcc/tree-vrp.c
parent7dcc58cdbc2de85dd27ac79e20550643c7c8953d (diff)
downloadgcc-d54485660a538334a90ce036ae6b1e011b301515.zip
gcc-d54485660a538334a90ce036ae6b1e011b301515.tar.gz
gcc-d54485660a538334a90ce036ae6b1e011b301515.tar.bz2
re PR tree-optimization/21030 (ICE in set_value_range building 176.gcc with -O2)
gcc/ PR tree-optimization/21030 * tree-vrp.c (adjust_range_with_scev): Do not create invalid ranges where VR->MAX is smaller than VR->MIN. testsuite/ PR tree-optimization/21030 * gcc.dg/tree-ssa/pr21030.c: New. From-SVN: r98999
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r--gcc/tree-vrp.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 4d0b034..0fe5c7b 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -893,19 +893,40 @@ adjust_range_with_scev (value_range *vr, struct loop *l, tree var)
}
else if (vr->type == VR_RANGE)
{
+ tree min = vr->min;
+ tree max = vr->max;
+
if (init_is_max)
{
- /* INIT is the maximum value. If INIT is lower than
- VR->MAX, set VR->MAX to INIT. */
- if (compare_values (init, vr->max) == -1)
- set_value_range (vr, VR_RANGE, vr->min, init);
+ /* INIT is the maximum value. If INIT is lower than VR->MAX
+ but no smaller than VR->MIN, set VR->MAX to INIT. */
+ if (compare_values (init, max) == -1)
+ {
+ max = init;
+
+ /* If we just created an invalid range with the minimum
+ greater than the maximum, take the minimum all the
+ way to -INF. */
+ if (compare_values (min, max) == 1)
+ min = TYPE_MIN_VALUE (TREE_TYPE (min));
+ }
}
else
{
/* If INIT is bigger than VR->MIN, set VR->MIN to INIT. */
- if (compare_values (init, vr->min) == 1)
- set_value_range (vr, VR_RANGE, init, vr->max);
+ if (compare_values (init, min) == 1)
+ {
+ min = init;
+
+ /* If we just created an invalid range with the minimum
+ greater than the maximum, take the maximum all the
+ way to +INF. */
+ if (compare_values (min, max) == 1)
+ max = TYPE_MAX_VALUE (TREE_TYPE (max));
+ }
}
+
+ set_value_range (vr, VR_RANGE, min, max);
}
}