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
This commit is contained in:
Richard Guenther 2006-07-07 12:31:29 +00:00 committed by Richard Biener
parent b5b1842549
commit 1ce35d260c
4 changed files with 57 additions and 5 deletions

View File

@ -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

View File

@ -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.

View File

@ -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);
}
}

View File

@ -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,