summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/Makefile.in2
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/pr48739-1.c27
-rw-r--r--gcc/testsuite/gcc.dg/pr48739-2.c27
-rw-r--r--gcc/tree-ssa.c6
6 files changed, 75 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c4740586d22..2a365e7ce21 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 8c501dd2e53..e0b209845f0 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -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) \
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a5dc669cc37..459eea5518a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..4dcdca977ce
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr48739-1.c
@@ -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
index 00000000000..c79f4e86a6b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr48739-2.c
@@ -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;
+}
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index 980716944ff..7564a52fabf 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -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);