diff options
author | bonzini <bonzini@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-12-30 10:36:39 +0000 |
---|---|---|
committer | bonzini <bonzini@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-12-30 10:36:39 +0000 |
commit | aa2741ffa699fd827feb2de21de63661eca390f3 (patch) | |
tree | dff617f60fb29bcb714b70cce7fcdc2dbf630d62 /gcc/tree-vrp.c | |
parent | bd23343072e6e7e6f52c23c6b2e164c2c81e838a (diff) | |
download | gcc-aa2741ffa699fd827feb2de21de63661eca390f3.tar.gz |
2008-12-30 Paolo Bonzini <bonzini@gnu.org>
PR tree-optimization/38572
* tree-vrp.c (vrp_visit_phi_node): Look out for invalid ranges
and change them to VARYING.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142962 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r-- | gcc/tree-vrp.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 9d23b24087f..4b6caca1c37 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -6361,9 +6361,12 @@ vrp_visit_phi_node (gimple phi) minimums. */ if (cmp_min > 0 || cmp_min < 0) { - /* If we will end up with a (-INF, +INF) range, set it - to VARYING. */ - if (vrp_val_is_max (vr_result.max)) + /* If we will end up with a (-INF, +INF) range, set it to + VARYING. Same if the previous max value was invalid for + the type and we'd end up with vr_result.min > vr_result.max. */ + if (vrp_val_is_max (vr_result.max) + || compare_values (TYPE_MIN_VALUE (TREE_TYPE (vr_result.min)), + vr_result.max) > 0) goto varying; if (!needs_overflow_infinity (TREE_TYPE (vr_result.min)) @@ -6380,9 +6383,12 @@ vrp_visit_phi_node (gimple phi) the previous one, go all the way to +INF. */ if (cmp_max < 0 || cmp_max > 0) { - /* If we will end up with a (-INF, +INF) range, set it - to VARYING. */ - if (vrp_val_is_min (vr_result.min)) + /* If we will end up with a (-INF, +INF) range, set it to + VARYING. Same if the previous min value was invalid for + the type and we'd end up with vr_result.max < vr_result.min. */ + if (vrp_val_is_min (vr_result.min) + || compare_values (TYPE_MAX_VALUE (TREE_TYPE (vr_result.max)), + vr_result.min) < 0) goto varying; if (!needs_overflow_infinity (TREE_TYPE (vr_result.max)) |