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: r148602
This commit is contained in:
Richard Guenther 2009-06-17 11:54:55 +00:00 committed by Richard Biener
parent 2df9310850
commit 721840b3ee
5 changed files with 29 additions and 6 deletions

View 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-17 Richard Guenther <rguenther@suse.de>
PR middle-end/40389

View 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-17 Richard Guenther <rguenther@suse.de>
PR middle-end/40389

View File

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

View File

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

View File

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