re PR tree-optimization/48739 (ICE in check_loop_closed_ssa_use() with "-ftree-parall...
authorJakub Jelinek <jakub@redhat.com>
Sat, 20 Aug 2011 07:48:35 +0000 (09:48 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 20 Aug 2011 07:48:35 +0000 (09:48 +0200)
PR tree-optimization/48739
* tree-ssa.c: Include cfgloop.h.
(execute_update_addresses_taken): When updating ssa, if in
loop closed SSA form, call rewrite_into_loop_closed_ssa instead of
update_ssa.
* Makefile.in (tree-ssa.o): Depend on $(CFGLOOP_H).

* gcc.dg/pr48739-1.c: New test.
* gcc.dg/pr48739-2.c: New test.

From-SVN: r177924

gcc/ChangeLog
gcc/Makefile.in
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr48739-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr48739-2.c [new file with mode: 0644]
gcc/tree-ssa.c

index c4740586d22bee3b883b5b636ac885233f94581f..2a365e7ce21303382c342b7e1390cb0286da1d48 100644 (file)
@@ -1,3 +1,12 @@
+2011-08-20  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/48739
+       * tree-ssa.c: Include cfgloop.h.
+       (execute_update_addresses_taken): When updating ssa, if in
+       loop closed SSA form, call rewrite_into_loop_closed_ssa instead of
+       update_ssa.
+       * Makefile.in (tree-ssa.o): Depend on $(CFGLOOP_H).
+
 2011-08-19  Vladimir Makarov  <vmakarov@redhat.com>
 
        PR rtl-optimization/49936
index 8c501dd2e53be6919a140d3533f002f41e43e60d..e0b209845f02a9cb9d9bc80db27fff75ce8e2311 100644 (file)
@@ -2406,7 +2406,7 @@ tree-ssa.o : tree-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
    $(TREE_DUMP_H) langhooks.h $(TREE_PASS_H) $(BASIC_BLOCK_H) $(BITMAP_H) \
    $(FLAGS_H) $(GGC_H) $(HASHTAB_H) pointer-set.h \
    $(GIMPLE_H) $(TREE_INLINE_H) $(TARGET_H) tree-pretty-print.h \
-   gimple-pretty-print.h
+   gimple-pretty-print.h $(CFGLOOP_H)
 tree-into-ssa.o : tree-into-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
    $(TREE_H) $(TM_P_H) $(EXPR_H) output.h $(DIAGNOSTIC_H) \
    $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
index a5dc669cc374880497da942ceeb593e98bc81ab0..459eea5518a6d9fc4894b66578dcb751e125647e 100644 (file)
@@ -1,3 +1,9 @@
+2011-08-20  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/48739
+       * gcc.dg/pr48739-1.c: New test.
+       * gcc.dg/pr48739-2.c: New test.
+
 2011-08-20  Tobias Burnus  <burnus@net-b.de>
 
        * gfortran.dg/graphite/interchange-1.f: Remove xfail.
diff --git a/gcc/testsuite/gcc.dg/pr48739-1.c b/gcc/testsuite/gcc.dg/pr48739-1.c
new file mode 100644 (file)
index 0000000..4dcdca9
--- /dev/null
@@ -0,0 +1,27 @@
+/* PR tree-optimization/48739 */
+/* { dg-do compile } */
+/* { dg-require-effective-target pthread } */
+/* { dg-options "-O1 -ftree-parallelize-loops=2 -fno-tree-dominator-opts" } */
+
+extern int g;
+extern void bar (void);
+
+int
+foo (int x)
+{
+  int a, b, *c = (int *) 0;
+  for (a = 0; a < 10; ++a)
+    {
+      bar ();
+      for (b = 0; b < 5; ++b)
+       {
+         x = 0;
+         c = &x;
+         g = 1;
+       }
+    }
+  *c = x;
+  for (x = 0; x != 10; x++)
+    ;
+  return g;
+}
diff --git a/gcc/testsuite/gcc.dg/pr48739-2.c b/gcc/testsuite/gcc.dg/pr48739-2.c
new file mode 100644 (file)
index 0000000..c79f4e8
--- /dev/null
@@ -0,0 +1,27 @@
+/* PR tree-optimization/48739 */
+/* { dg-do compile } */
+/* { dg-require-effective-target pthread } */
+/* { dg-options "-O1 -ftree-parallelize-loops=2 -fno-tree-dominator-opts" } */
+
+extern int g, v[10];
+extern void bar (void);
+
+int
+foo (int x)
+{
+  int a, b, *c = (int *) 0;
+  for (a = 0; a < 10; ++a)
+    {
+      bar ();
+      for (b = 0; b < 5; ++b)
+       {
+         x = 0;
+         c = &x;
+         g = 1;
+       }
+    }
+  *c = x;
+  for (x = 0; x != 10; x++)
+    v[x] = x;
+  return g;
+}
index 980716944ff501ef0bcbd2bc39291ab5dde51052..7564a52fabf72ce168d8c9b057268cc6625b0e3a 100644 (file)
@@ -43,6 +43,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-dump.h"
 #include "tree-pass.h"
 #include "diagnostic-core.h"
+#include "cfgloop.h"
 
 /* Pointer map of variable mappings, keyed by edge.  */
 static struct pointer_map_t *edge_var_maps;
@@ -2208,7 +2209,10 @@ execute_update_addresses_taken (void)
          }
 
       /* Update SSA form here, we are called as non-pass as well.  */
-      update_ssa (TODO_update_ssa);
+      if (number_of_loops () > 1 && loops_state_satisfies_p (LOOP_CLOSED_SSA))
+       rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
+      else
+       update_ssa (TODO_update_ssa);
     }
 
   BITMAP_FREE (not_reg_needs);