diff options
author | Richard Guenther <rguenther@suse.de> | 2006-07-07 12:31:29 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2006-07-07 12:31:29 +0000 |
commit | 1ce35d260ce28d8bf428ef923169899be85a382e (patch) | |
tree | 6302ef291529a9f7d84576775cadb3ee62a10839 | |
parent | b5b1842549c359a16002b52b0de2b82183c1735b (diff) | |
download | gcc-1ce35d260ce28d8bf428ef923169899be85a382e.zip gcc-1ce35d260ce28d8bf428ef923169899be85a382e.tar.gz gcc-1ce35d260ce28d8bf428ef923169899be85a382e.tar.bz2 |
re PR tree-optimization/28187 ('-O2 -fwrapv' exhausts memory.)
2006-07-07 Richard Guenther <rguenther@suse.de>
PR tree-optimization/28187
* tree-vrp.c (vrp_operand_equal_p): New function.
(vrp_bitmap_equal_p): Likewise.
(update_value_range): Use them to compare old and new
max and min values.
* gcc.dg/pr28187.c: New testcase.
From-SVN: r115255
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr28187.c | 22 | ||||
-rw-r--r-- | gcc/tree-vrp.c | 27 |
4 files changed, 57 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bd3e3bb..79fb2a6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2006-07-07 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/28187 + * tree-vrp.c (vrp_operand_equal_p): New function. + (vrp_bitmap_equal_p): Likewise. + (update_value_range): Use them to compare old and new + max and min values. + 2006-07-06 Roger Sayle <roger@eyesopen.com> * c-parser.c (c_parser_skip_to_end_of_block_or_statement): Add diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6537b28..eb1b5d0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-07-07 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/28187 + * gcc.dg/pr28187.c: New testcase. + 2006-07-07 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/address_conversion.adb: New test. diff --git a/gcc/testsuite/gcc.dg/pr28187.c b/gcc/testsuite/gcc.dg/pr28187.c new file mode 100644 index 0000000..bc3b62d --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr28187.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O -ftree-vrp -fwrapv" } */ + +extern void bar(int); +void checkgroups(int last, int verbose) +{ + int window = 0; + int outstanding = 0; + while (window < last || outstanding) { + while (outstanding < 47 && window < last) { + if (window < last) { + outstanding++; + if (verbose) + bar(window); + bar(window++); + } + } + if (outstanding > 0) + bar(0); + } +} + diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 9eac7e9..64f292e 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -290,6 +290,25 @@ get_value_range (tree var) return vr; } +/* Return true, if VAL1 and VAL2 are equal values for VRP purposes. */ + +static inline bool +vrp_operand_equal_p (tree val1, tree val2) +{ + return (val1 == val2 + || (val1 && val2 + && operand_equal_p (val1, val2, 0))); +} + +/* Return true, if the bitmaps B1 and B2 are equal. */ + +static inline bool +vrp_bitmap_equal_p (bitmap b1, bitmap b2) +{ + return (b1 == b2 + || (b1 && b2 + && bitmap_equal_p (b1, b2))); +} /* Update the value range and equivalence set for variable VAR to NEW_VR. Return true if NEW_VR is different from VAR's previous @@ -310,11 +329,9 @@ update_value_range (tree var, value_range_t *new_vr) /* Update the value range, if necessary. */ old_vr = get_value_range (var); is_new = old_vr->type != new_vr->type - || old_vr->min != new_vr->min - || old_vr->max != new_vr->max - || (old_vr->equiv == NULL && new_vr->equiv) - || (old_vr->equiv && new_vr->equiv == NULL) - || (!bitmap_equal_p (old_vr->equiv, new_vr->equiv)); + || !vrp_operand_equal_p (old_vr->min, new_vr->min) + || !vrp_operand_equal_p (old_vr->max, new_vr->max) + || !vrp_bitmap_equal_p (old_vr->equiv, new_vr->equiv); if (is_new) set_value_range (old_vr, new_vr->type, new_vr->min, new_vr->max, |