]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix PR43083: Do not handle regions ending with multiple edges on the exit BB.
authorSebastian Pop <sebastian.pop@amd.com>
Tue, 23 Feb 2010 12:59:48 +0000 (12:59 +0000)
committerSebastian Pop <spop@gcc.gnu.org>
Tue, 23 Feb 2010 12:59:48 +0000 (12:59 +0000)
2010-02-22  Sebastian Pop  <sebastian.pop@amd.com>

PR middle-end/43083
* graphite-scop-detection.c (create_single_exit_edge): Move
the call to find_single_exit_edge to....
(create_sese_edges): ...here.  Don't handle multiple edges
exiting the function.
(build_graphite_scops): Don't handle multiple edges
exiting the function.

* gcc.dg/graphite/pr43083.c: New.

From-SVN: r156997

gcc/ChangeLog.graphite
gcc/graphite-scop-detection.c
gcc/testsuite/gcc.dg/graphite/pr43083.c [new file with mode: 0644]

index b3a820e0db1db90dd6cfe0e6fd383ac015ac3dbd..f1e90051492ac260f021a0e9b61a692d2b97b4c0 100644 (file)
@@ -1,3 +1,15 @@
+2010-02-22  Sebastian Pop  <sebastian.pop@amd.com>
+
+       PR middle-end/43083
+       * graphite-scop-detection.c (create_single_exit_edge): Move
+       the call to find_single_exit_edge to....
+       (create_sese_edges): ...here.  Don't handle multiple edges
+       exiting the function.
+       (build_graphite_scops): Don't handle multiple edges
+       exiting the function.
+
+       * gcc.dg/graphite/pr43083.c: New.
+
 2010-02-22  Sebastian Pop  <sebastian.pop@amd.com>
 
        PR middle-end/43097
index d89f0f8153761e37076ea36c465e784af7545626..5c1dbbd29814e2317315dc3b2e89482af122400e 100644 (file)
@@ -935,9 +935,6 @@ create_single_exit_edge (sd_region *region)
   edge forwarder = NULL;
   basic_block exit;
 
-  if (find_single_exit_edge (region))
-    return;
-
   /* We create a forwarder bb (5) for all edges leaving this region
      (3->5, 4->5).  All other edges leading to the same bb, are moved
      to a new bb (6).  If these edges where part of another region (2->5)
@@ -1031,7 +1028,10 @@ create_sese_edges (VEC (sd_region, heap) *regions)
   mark_exit_edges (regions);
 
   for (i = 0; VEC_iterate (sd_region, regions, i, s); i++)
-    create_single_exit_edge (s);
+    /* Don't handle multiple edges exiting the function.  */
+    if (!find_single_exit_edge (s)
+       && s->exit != EXIT_BLOCK_PTR)
+      create_single_exit_edge (s);
 
   unmark_exit_edges (regions);
 
@@ -1057,7 +1057,12 @@ build_graphite_scops (VEC (sd_region, heap) *regions,
     {
       edge entry = find_single_entry_edge (s);
       edge exit = find_single_exit_edge (s);
-      scop_p scop = new_scop (new_sese (entry, exit));
+      scop_p scop;
+
+      if (!exit)
+       continue;
+
+      scop = new_scop (new_sese (entry, exit));
       VEC_safe_push (scop_p, heap, *scops, scop);
 
       /* Are there overlapping SCoPs?  */
@@ -1323,7 +1328,7 @@ build_scops (VEC (scop_p, heap) **scops)
 
   canonicalize_loop_closed_ssa_form ();
   build_scops_1 (single_succ (ENTRY_BLOCK_PTR), ENTRY_BLOCK_PTR->loop_father,
-                             &regions, loop);
+                &regions, loop);
   create_sese_edges (regions);
   build_graphite_scops (regions, scops);
 
diff --git a/gcc/testsuite/gcc.dg/graphite/pr43083.c b/gcc/testsuite/gcc.dg/graphite/pr43083.c
new file mode 100644 (file)
index 0000000..afb97af
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-options "-O3 -fgraphite-identity" } */
+
+extern void baz(void);
+
+static inline int bar(void)
+{
+  int i;
+  for (i = 0; i < 10; i++) baz();
+}
+
+int foo(void)
+{
+  if (bar() != 0) return 0;
+}