summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-08 21:47:50 +0000
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-08 21:47:50 +0000
commit92b0c449eee3b59e8c783a05a431e3bbfc2c02fa (patch)
treeca1b207002e81b12401d7342ca360d8f53c065f0 /gcc
parentd5c8383bd6585bc9cc45e8bdd6b9739459ea7943 (diff)
downloadgcc-92b0c449eee3b59e8c783a05a431e3bbfc2c02fa.tar.gz
gcc/
PR tree-optimization/55191 * cfganal.c (connect_infinite_loops_to_exit): Call dfs_deadend here. (flow_dfs_compute_reverse_execute): Don't call it here. testsuite/ PR tree-optimization/55191 * gcc.dg/pr55191.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193341 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/cfganal.c8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr55191.c14
4 files changed, 30 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 76f53f4bd01..17089b09100 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2012-11-08 Steven Bosscher <steven@gcc.gnu.org>
+
+ PR tree-optimization/55191
+ * cfganal.c (connect_infinite_loops_to_exit): Call dfs_deadend here.
+ (flow_dfs_compute_reverse_execute): Don't call it here.
+
2012-11-08 Jakub Jelinek <jakub@redhat.com>
PR debug/53145
diff --git a/gcc/cfganal.c b/gcc/cfganal.c
index 214e468d46e..7a76c60e433 100644
--- a/gcc/cfganal.c
+++ b/gcc/cfganal.c
@@ -452,6 +452,7 @@ void
connect_infinite_loops_to_exit (void)
{
basic_block unvisited_block = EXIT_BLOCK_PTR;
+ basic_block deadend_block;
struct depth_first_search_dsS dfs_ds;
/* Perform depth-first search in the reverse graph to find nodes
@@ -467,8 +468,9 @@ connect_infinite_loops_to_exit (void)
if (!unvisited_block)
break;
- make_edge (unvisited_block, EXIT_BLOCK_PTR, EDGE_FAKE);
- flow_dfs_compute_reverse_add_bb (&dfs_ds, unvisited_block);
+ deadend_block = dfs_find_deadend (unvisited_block);
+ make_edge (deadend_block, EXIT_BLOCK_PTR, EDGE_FAKE);
+ flow_dfs_compute_reverse_add_bb (&dfs_ds, deadend_block);
}
flow_dfs_compute_reverse_finish (&dfs_ds);
@@ -958,7 +960,7 @@ flow_dfs_compute_reverse_execute (depth_first_search_ds data,
/* Determine if there are unvisited basic blocks. */
FOR_BB_BETWEEN (bb, last_unvisited, NULL, prev_bb)
if (!bitmap_bit_p (data->visited_blocks, bb->index))
- return dfs_find_deadend (bb);
+ return bb;
return NULL;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a93996cc748..f67250981c3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-11-08 Steven Bosscher <steven@gcc.gnu.org>
+
+ PR tree-optimization/55191
+ * gcc.dg/pr55191.c: New test.
+
2012-11-08 Jakub Jelinek <jakub@redhat.com>
PR debug/54499
diff --git a/gcc/testsuite/gcc.dg/pr55191.c b/gcc/testsuite/gcc.dg/pr55191.c
new file mode 100644
index 00000000000..568425ce038
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr55191.c
@@ -0,0 +1,14 @@
+/* PR tree-optimization/55191 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int a, b;
+
+void f(void)
+{
+ b = a || b;
+
+ for(a = 0; a < 2; a++);
+ while(1);
+}
+