aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2011-01-25 13:01:54 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2011-01-25 13:01:54 +0100
commit9ffa621eadf61d2f13af900392d250870519d011 (patch)
treeaefd73a972043ecfa734d44e4273ecdb145d0020 /gcc
parentae5b7e39b62c86ab13ad84a911d808f12e54a111 (diff)
downloadgcc-9ffa621eadf61d2f13af900392d250870519d011.zip
gcc-9ffa621eadf61d2f13af900392d250870519d011.tar.gz
gcc-9ffa621eadf61d2f13af900392d250870519d011.tar.bz2
re PR tree-optimization/47427 (ICE in process_constraint, at tree-ssa-structalias.c:2901)
PR tree-optimization/47427 PR tree-optimization/47428 * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Don't coalesce if the new root var would be TREE_READONLY. * gcc.c-torture/compile/pr47427.c: New test. * gcc.c-torture/compile/pr47428.c: New test. From-SVN: r169226
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr47427.c28
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr47428.c42
-rw-r--r--gcc/tree-ssa-copyrename.c16
5 files changed, 98 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 01211ed..14a9052 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2011-01-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/47427
+ PR tree-optimization/47428
+ * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Don't
+ coalesce if the new root var would be TREE_READONLY.
+
2011-01-25 Richard Guenther <rguenther@suse.de>
PR middle-end/47414
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f45aea8..66ded37 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2011-01-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/47427
+ PR tree-optimization/47428
+ * gcc.c-torture/compile/pr47427.c: New test.
+ * gcc.c-torture/compile/pr47428.c: New test.
+
2011-01-25 Richard Guenther <rguenther@suse.de>
PR middle-end/47411
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr47427.c b/gcc/testsuite/gcc.c-torture/compile/pr47427.c
new file mode 100644
index 0000000..4f0b98e
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr47427.c
@@ -0,0 +1,28 @@
+/* PR tree-optimization/47427 */
+
+char *g, *h;
+
+int
+bar (unsigned char x, const int y)
+{
+lab:
+ for (; h; g = h)
+ for (g = 0; h; h++)
+ {
+ int a = 1;
+ if (h)
+ {
+ if (a)
+ goto lab;
+ return y;
+ }
+ }
+ return x;
+}
+
+void
+foo (void)
+{
+ if (bar (0, 1))
+ bar (1, 0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr47428.c b/gcc/testsuite/gcc.c-torture/compile/pr47428.c
new file mode 100644
index 0000000..0c4ccc9
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr47428.c
@@ -0,0 +1,42 @@
+/* PR tree-optimization/47428 */
+
+struct S
+{
+ int s;
+} a;
+int b;
+
+void bar (struct S);
+
+int
+baz (int x __attribute__((unused)), int y)
+{
+ int i;
+ for (i = 0; i < 1; i = 1)
+ for (y = 0; y < 1; y = 1);
+ return y;
+}
+
+void
+foo (void)
+{
+ fn (0);
+}
+
+int
+fn (const int x, int y __attribute__((unused)))
+{
+ if (baz (baz (0, x), 0))
+ return 0;
+ else
+ bar (a);
+ return 0;
+}
+
+void
+bar (struct S x)
+{
+ for (;;)
+ for (; x.s;)
+ b = 0 ? : baz (0, 0);
+}
diff --git a/gcc/tree-ssa-copyrename.c b/gcc/tree-ssa-copyrename.c
index 9c51d11..dfc0b4e 100644
--- a/gcc/tree-ssa-copyrename.c
+++ b/gcc/tree-ssa-copyrename.c
@@ -1,5 +1,5 @@
/* Rename SSA copies.
- Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010
+ Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
Contributed by Andrew MacLeod <amacleod@redhat.com>
@@ -170,7 +170,7 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug)
return false;
}
- /* Never attempt to coalesce 2 difference parameters. */
+ /* Never attempt to coalesce 2 different parameters. */
if (TREE_CODE (root1) == PARM_DECL && TREE_CODE (root2) == PARM_DECL)
{
if (debug)
@@ -226,6 +226,18 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug)
ign2 = false;
}
+ /* Don't coalesce if the new chosen root variable would be read-only.
+ If both ign1 && ign2, then the root var of the larger partition
+ wins, so reject in that case if any of the root vars is TREE_READONLY.
+ Otherwise reject only if the root var, on which replace_ssa_name_symbol
+ will be called below, is readonly. */
+ if ((TREE_READONLY (root1) && ign2) || (TREE_READONLY (root2) && ign1))
+ {
+ if (debug)
+ fprintf (debug, " : Readonly variable. No coalesce.\n");
+ return false;
+ }
+
/* Don't coalesce if the two variables aren't type compatible . */
if (!types_compatible_p (TREE_TYPE (root1), TREE_TYPE (root2))
/* There is a disconnect between the middle-end type-system and