From: rguenth Date: Tue, 5 Sep 2006 08:36:39 +0000 (+0000) Subject: 2006-09-05 Richard Guenther X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=fd2730c0a6adf8791147dd9718d653ab8ec7c044 2006-09-05 Richard Guenther PR tree-optimization/28905 * tree-vrp.c (fix_equivalence_set): Manually implement !value_ranges_intersect_p to also handle symbolic ranges. * gcc.c-torture/compile/pr28905.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116696 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b4490c4f8cf..30a49bb379f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2006-09-05 Richard Guenther + PR tree-optimization/28905 + * tree-vrp.c (fix_equivalence_set): Manually implement + !value_ranges_intersect_p to also handle symbolic ranges. + +2006-09-05 Richard Guenther + PR middle-end/28935 * tree-ssa-ccp.c (fold_stmt_r): Make sure to fold the condition of a COND_EXPR. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1a4cda0f8c6..a1946dddf41 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2006-09-05 Richard Guenther + PR tree-optimization/28905 + * gcc.c-torture/compile/pr28905.c: New testcase. + +2006-09-05 Richard Guenther + PR middle-end/28935 * gcc.dg/pr28935.c: New testcase. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr28905.c b/gcc/testsuite/gcc.c-torture/compile/pr28905.c new file mode 100644 index 00000000000..83a381ab8c9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr28905.c @@ -0,0 +1,11 @@ +/* We used to ICE here because after VRP we ended up with + non-compatible ranges in a value-range equivalences set. */ +void code_comment (int size) +{ + int i; + for (i = 0; i < size; i++) + if (i) + if (i < 0) + if (i < 0) + return; +} diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 5f532114757..a2127446a85 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -774,14 +774,18 @@ fix_equivalence_set (value_range_t *vr_p) value_range_t *equiv_vr = vr_value[i]; if (equiv_vr->type == VR_VARYING - || equiv_vr->type == VR_UNDEFINED - || symbolic_range_p (equiv_vr)) + || equiv_vr->type == VR_UNDEFINED) continue; - if (equiv_vr->type == VR_RANGE - && vr_p->type == VR_RANGE - && !value_ranges_intersect_p (vr_p, equiv_vr)) - bitmap_set_bit (to_remove, i); + if (vr_p->type == VR_RANGE + && equiv_vr->type == VR_RANGE) + { + /* Two ranges have an empty intersection if their end points + are outside of the other range. */ + if (compare_values (equiv_vr->min, vr_p->max) == 1 + || compare_values (equiv_vr->max, vr_p->min) == -1) + bitmap_set_bit (to_remove, i); + } else if ((equiv_vr->type == VR_RANGE && vr_p->type == VR_ANTI_RANGE) || (equiv_vr->type == VR_ANTI_RANGE && vr_p->type == VR_RANGE)) {