diff options
author | Steven Bosscher <steven@gcc.gnu.org> | 2012-10-31 21:37:10 +0000 |
---|---|---|
committer | Steven Bosscher <steven@gcc.gnu.org> | 2012-10-31 21:37:10 +0000 |
commit | 03b06a83441cac588cf04f494915ffd3868a9bed (patch) | |
tree | 457138650afbcc0d91ef7e60a9f2ca4718a4b83d /gcc/cfganal.c | |
parent | e212c7f56c62dc492e7d2af6d55636d19229d114 (diff) | |
download | gcc-03b06a83441cac588cf04f494915ffd3868a9bed.tar.gz |
re PR tree-optimization/55018 (CDDCE pass is too aggressive sometimes with infinite loops and with some functions)
gcc/
PR tree-optimization/55018
* basic-block.h (dfs_find_deadend): New prototype.
* cfganal.c (dfs_find_deadend): No longer static. Use bitmap
instead of sbitmap for visited.
(flow_dfs_compute_reverse_execute): Use dfs_find_deadend here, too.
* dominance.c (calc_dfs_tree): If saw_unconnected,
traverse from dfs_find_deadend of unconnected b
instead of b directly.
testsuite/
PR tree-optimization/55018
* gcc.dg/torture/pr55018.c: New test.
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r193047
Diffstat (limited to 'gcc/cfganal.c')
-rw-r--r-- | gcc/cfganal.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gcc/cfganal.c b/gcc/cfganal.c index 58c763f8454..4bef629d13b 100644 --- a/gcc/cfganal.c +++ b/gcc/cfganal.c @@ -573,7 +573,9 @@ post_order_compute (int *post_order, bool include_entry_exit, } -/* Helper routine for inverted_post_order_compute. +/* Helper routine for inverted_post_order_compute + flow_dfs_compute_reverse_execute, and the reverse-CFG + deapth first search in dominance.c. BB has to belong to a region of CFG unreachable by inverted traversal from the exit. i.e. there's no control flow path from ENTRY to EXIT @@ -593,19 +595,17 @@ post_order_compute (int *post_order, bool include_entry_exit, that all blocks in the region are reachable by starting an inverted traversal from the returned block. */ -static basic_block +basic_block dfs_find_deadend (basic_block bb) { - sbitmap visited = sbitmap_alloc (last_basic_block); - bitmap_clear (visited); + bitmap visited = BITMAP_ALLOC (NULL); for (;;) { - SET_BIT (visited, bb->index); if (EDGE_COUNT (bb->succs) == 0 - || TEST_BIT (visited, EDGE_SUCC (bb, 0)->dest->index)) + || ! bitmap_set_bit (visited, bb->index)) { - sbitmap_free (visited); + BITMAP_FREE (visited); return bb; } @@ -958,7 +958,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 (!TEST_BIT (data->visited_blocks, bb->index)) - return bb; + return dfs_find_deadend (bb); return NULL; } |