aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/torture/pr40460.C9
-rw-r--r--gcc/tree-chrec.c10
-rw-r--r--gcc/tree-chrec.h3
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