aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Dvorak <dvorakz@suse.cz>2007-05-10 23:33:11 +0200
committerZdenek Dvorak <rakdver@gcc.gnu.org>2007-05-10 21:33:11 +0000
commite71d7f88ba619aab4d53468d4f26e97a670842dd (patch)
tree5bd5f7053c0c0609d3643ee5d62d5626410a8069
parent5635c26e579161430860f8f85941949ccf586f1d (diff)
downloadgcc-e71d7f88ba619aab4d53468d4f26e97a670842dd.zip
gcc-e71d7f88ba619aab4d53468d4f26e97a670842dd.tar.gz
gcc-e71d7f88ba619aab4d53468d4f26e97a670842dd.tar.bz2
re PR tree-optimization/31885 (Not removing empty loop, scev not finding the correct result)
PR tree-optimization/31885 * tree-chrec.c (chrec_contains_undetermined): Do not consider NULL_TREE to be undetermined. (automatically_generated_chrec_p): Return false for NULL. * gcc.dg/tree-ssa/loop-29.c: New test. From-SVN: r124602
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/loop-29.c21
-rw-r--r--gcc/tree-chrec.c7
-rw-r--r--gcc/tree-chrec.h3
5 files changed, 38 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7358111..40867e9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2007-05-10 Zdenek Dvorak <dvorakz@suse.cz>
+
+ PR tree-optimization/31885
+ * tree-chrec.c (chrec_contains_undetermined): Do not consider NULL_TREE
+ to be undetermined.
+ (automatically_generated_chrec_p): Return false for NULL.
+
2007-05-08 Bernd Schmidt <bernd.schmidt@analog.com>
* config/bfin/bfin.h (MOVE_RATIO): Define.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 22bc7b7..c0e3d1e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-05-10 Zdenek Dvorak <dvorakz@suse.cz>
+
+ PR tree-optimization/31885
+ * gcc.dg/tree-ssa/loop-29.c: New test.
+
2007-05-10 Dominique d'Humières <dominiq@lps.ens.fr>
* assumed_dummy_1.f90: Fix dg directive.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-29.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-29.c
new file mode 100644
index 0000000..13699aa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-29.c
@@ -0,0 +1,21 @@
+/* PR 31885 */
+
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-empty" } */
+
+struct s {
+ int *blah;
+};
+
+static struct s array[] = { { 0 } };
+
+void
+foo (struct s *p)
+{
+ struct s *q = &array[1];
+ while (p < q)
+ p++;
+}
+
+/* { dg-final { scan-tree-dump-times "Removing empty loop" 1 "empty" } } */
+/* { dg-final { cleanup-tree-dump "empty" } } */
diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c
index 119a35b..7abd5ad 100644
--- a/gcc/tree-chrec.c
+++ b/gcc/tree-chrec.c
@@ -888,11 +888,12 @@ chrec_contains_undetermined (tree chrec)
{
int i, n;
- if (chrec == chrec_dont_know
- || chrec == chrec_not_analyzed_yet
- || chrec == NULL_TREE)
+ if (chrec == chrec_dont_know)
return true;
+ if (chrec == NULL_TREE)
+ return false;
+
n = TREE_OPERAND_LENGTH (chrec);
for (i = 0; i < n; i++)
if (chrec_contains_undetermined (TREE_OPERAND (chrec, i)))
diff --git a/gcc/tree-chrec.h b/gcc/tree-chrec.h
index 95c6f38..6be00d6 100644
--- a/gcc/tree-chrec.h
+++ b/gcc/tree-chrec.h
@@ -36,8 +36,7 @@ extern GTY(()) tree chrec_known;
static inline bool
automatically_generated_chrec_p (tree chrec)
{
- return (chrec == chrec_not_analyzed_yet
- || chrec == chrec_dont_know
+ return (chrec == chrec_dont_know
|| chrec == chrec_known);
}