]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/40460 (Enormous memory usage during compilation with -O2 or -O3...
authorRichard Guenther <rguenther@suse.de>
Wed, 17 Jun 2009 12:00:40 +0000 (12:00 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 17 Jun 2009 12:00:40 +0000 (12:00 +0000)
2009-06-17  Richard Guenther  <rguenther@suse.de>

PR middle-end/40460
* tree-chrec.h (build_polynomial_chrec): If we cannot determine
if there is no evolution of left in the loop bail out.
* tree-chrec.c (chrec_fold_multiply_poly_poly): CSE one
chrec_fold_multiply.

* g++.dg/torture/pr40460.C: New testcase.

From-SVN: r148603

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr40460.C [new file with mode: 0644]
gcc/tree-chrec.c
gcc/tree-chrec.h

index 546a2051553fd00a2498254528172fa53cc97f63..d4402d07d51610bc06ab23991a2674f87d74ef98 100644 (file)
@@ -1,3 +1,11 @@
+2009-06-17  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/40460
+       * tree-chrec.h (build_polynomial_chrec): If we cannot determine
+       if there is no evolution of left in the loop bail out.
+       * tree-chrec.c (chrec_fold_multiply_poly_poly): CSE one
+       chrec_fold_multiply.
+
 2009-06-11  Uros Bizjak  <ubizjak@gmail.com>
 
        Backport from mainline:
index 3c0a7af86c07df9795082cd2148083320f7ae9f4..cb1d8a0fb7c3dc44eabac58706298fd18a79d59c 100644 (file)
@@ -1,3 +1,8 @@
+2009-06-17  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/40460
+       * g++.dg/torture/pr40460.C: New testcase.
+
 2009-06-08  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/40373
diff --git a/gcc/testsuite/g++.dg/torture/pr40460.C b/gcc/testsuite/g++.dg/torture/pr40460.C
new file mode 100644 (file)
index 0000000..1d54df7
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+
+void bar(int);
+void foo(void)
+{
+  for (int i = 0; i<1; ++i)
+    bar (i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i);
+}
+
index 1435201a951185a767bd4121b357f26d4fafcb7d..ccc1dcfa724fcd5abaa6aacb24d91af645c712f4 100644 (file)
@@ -219,16 +219,16 @@ chrec_fold_multiply_poly_poly (tree type,
   /* "a*c".  */
   t0 = chrec_fold_multiply (type, CHREC_LEFT (poly0), CHREC_LEFT (poly1));
 
-  /* "a*d + b*c + b*d".  */
+  /* "a*d + b*c".  */
   t1 = chrec_fold_multiply (type, CHREC_LEFT (poly0), CHREC_RIGHT (poly1));
   t1 = chrec_fold_plus (type, t1, chrec_fold_multiply (type,
                                                       CHREC_RIGHT (poly0),
                                                       CHREC_LEFT (poly1)));
-  t1 = chrec_fold_plus (type, t1, chrec_fold_multiply (type,
-                                                      CHREC_RIGHT (poly0),
-                                                      CHREC_RIGHT (poly1)));
-  /* "2*b*d".  */
+  /* "b*d".  */
   t2 = chrec_fold_multiply (type, CHREC_RIGHT (poly0), CHREC_RIGHT (poly1));
+  /* "a*d + b*c + b*d".  */
+  t1 = chrec_fold_plus (type, t1, t2);
+  /* "2*b*d".  */
   t2 = chrec_fold_multiply (type, SCALAR_FLOAT_TYPE_P (type)
                            ? build_real (type, dconst2)
                            : build_int_cst (type, 2), t2);
index c908ec5c66b49417c1dc7f9cb516da44831414b1..37a54bee114d2e50802be0ffd73513d16efa52b6 100644 (file)
@@ -129,7 +129,8 @@ build_polynomial_chrec (unsigned loop_num,
       || right == chrec_dont_know)
     return chrec_dont_know;
 
-  if (no_evolution_in_loop_p (left, loop_num, &val) && !val)
+  if (!no_evolution_in_loop_p (left, loop_num, &val)
+      || !val)
     return chrec_dont_know;
 
   /* Pointer types should occur only on the left hand side, i.e. in