]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/28187 ('-O2 -fwrapv' exhausts memory.)
authorRichard Guenther <rguenther@suse.de>
Fri, 7 Jul 2006 12:31:29 +0000 (12:31 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 7 Jul 2006 12:31:29 +0000 (12:31 +0000)
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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr28187.c [new file with mode: 0644]
gcc/tree-vrp.c

index bd3e3bbb1298a58e9e31b7d24de33b886b97a2cd..79fb2a63e5b3dc80237a6dda20fc07706f63502b 100644 (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
index 6537b287b35e83f51df5609d4781db208fbedebc..eb1b5d00054a49d7ebfd147451d2da2e040ee92a 100644 (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.
diff --git a/gcc/testsuite/gcc.dg/pr28187.c b/gcc/testsuite/gcc.dg/pr28187.c
new file mode 100644 (file)
index 0000000..bc3b62d
--- /dev/null
@@ -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);
+    }
+}
+
index 9eac7e9b67deb8b2b03d6e86b5bfd7372bee56ab..64f292e89c40ccb56de98a80978bb426aaa981f4 100644 (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,