re PR tree-optimization/55862 (ICE in compute_antic, at tree-ssa-pre.c:2495)
authorRichard Biener <rguenther@suse.de>
Fri, 4 Jan 2013 13:28:53 +0000 (13:28 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 4 Jan 2013 13:28:53 +0000 (13:28 +0000)
2013-01-04  Richard Biener  <rguenther@suse.de>

PR tree-optimization/55862
* tree-ssa-pre.c (phi_translate_1): Valueize SSA names after
translating them through PHI nodes.

* gcc.dg/torture/pr55862.c: New testcase.

From-SVN: r194906

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr55862.c [new file with mode: 0644]
gcc/tree-ssa-pre.c

index 9a842c4..1c6e735 100644 (file)
@@ -1,3 +1,9 @@
+2013-01-04  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/55862
+       * tree-ssa-pre.c (phi_translate_1): Valueize SSA names after
+       translating them through PHI nodes.
+
 2013-01-04  Martin Jambor  <mjambor@suse.cz>
 
        PR tree-optimization/55755
index c9c434b..1ce0571 100644 (file)
@@ -1,3 +1,8 @@
+2013-01-04  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/55862
+       * gcc.dg/torture/pr55862.c: New testcase.
+
 2013-01-04  Martin Jambor  <mjambor@suse.cz>
 
        PR tree-optimization/55755
diff --git a/gcc/testsuite/gcc.dg/torture/pr55862.c b/gcc/testsuite/gcc.dg/torture/pr55862.c
new file mode 100644 (file)
index 0000000..eb8dceb
--- /dev/null
@@ -0,0 +1,31 @@
+/* { dg-do compile } */\r
+\r
+int g, a, *b;\r
+\r
+void f(void)\r
+{\r
+  int *p;\r
+\r
+  if(g)\r
+    {\r
+      int **k = &p;\r
+\r
+      for(; g; p++)\r
+       for(a = 0; a < 1; a++)\r
+         {\r
+           int *c = p;\r
+label2:\r
+           if(a < 1)\r
+             *c = 0;\r
+         }\r
+\r
+      goto label1;\r
+\r
+      while(g++)\r
+       for(*b = 0; *b; b++)\r
+         label1:\r
+             ;\r
+    }\r
+\r
+  goto label2;\r
+}\r
index 9c72f33..ed89738 100644 (file)
@@ -1729,6 +1729,10 @@ phi_translate_1 (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2,
            edge e = find_edge (pred, gimple_bb (def_stmt));
            tree def = PHI_ARG_DEF (def_stmt, e->dest_idx);
 
+           /* Valueize it.  */
+           if (TREE_CODE (def) == SSA_NAME)
+             def = VN_INFO (def)->valnum;
+
            /* Handle constant. */
            if (is_gimple_min_invariant (def))
              return get_or_alloc_expr_for_constant (def);