diff options
author | Richard Guenther <rguenther@suse.de> | 2009-06-17 10:26:24 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2009-06-17 10:26:24 +0000 |
commit | 3cb8677cc030b145391ac547f159609b03dbbd6c (patch) | |
tree | 6565fa35aaddaec6451161a08051d6b81e16a68d | |
parent | d81b4c614be057ac515828a6b7a92745a542c551 (diff) | |
download | gcc-3cb8677cc030b145391ac547f159609b03dbbd6c.zip gcc-3cb8677cc030b145391ac547f159609b03dbbd6c.tar.gz gcc-3cb8677cc030b145391ac547f159609b03dbbd6c.tar.bz2 |
re PR middle-end/40460 (Enormous memory usage during compilation with -O2 or -O3 optimizations.)
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: r148593
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/torture/pr40460.C | 9 | ||||
-rw-r--r-- | gcc/tree-chrec.c | 10 | ||||
-rw-r--r-- | gcc/tree-chrec.h | 3 |
5 files changed, 29 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0b736d6..6fab0ba 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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-16 J"orn Rennecke <joern.rennecke@arc.com> Janis Johnson <janis187@us.ibm.com> diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f84f90c..b918233 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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-05 Olatunji Ruwase <tjruwase@google.com> * gcc.dg/plugin/one_time_plugin.c: New test. diff --git a/gcc/testsuite/g++.dg/torture/pr40460.C b/gcc/testsuite/g++.dg/torture/pr40460.C new file mode 100644 index 0000000..1d54df7 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr40460.C @@ -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); +} + diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c index 495f95a..997ce89 100644 --- a/gcc/tree-chrec.c +++ b/gcc/tree-chrec.c @@ -220,16 +220,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); diff --git a/gcc/tree-chrec.h b/gcc/tree-chrec.h index 76c24b3..db45eed 100644 --- a/gcc/tree-chrec.h +++ b/gcc/tree-chrec.h @@ -132,7 +132,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 |