diff options
author | Sebastian Pop <s.pop@samsung.com> | 2015-02-26 13:56:39 +0000 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2015-02-26 06:56:39 -0700 |
commit | ae762b31c4d775283ecbd629ba904b7ab9e600b4 (patch) | |
tree | ce4b757be7776f3330ed6156248bb1ada1caf074 /gcc/tree-ssa-threadupdate.c | |
parent | db847fa8f2cca6139188b8dfa0a7064319b19193 (diff) | |
download | gcc-ae762b31c4d775283ecbd629ba904b7ab9e600b4.zip gcc-ae762b31c4d775283ecbd629ba904b7ab9e600b4.tar.gz gcc-ae762b31c4d775283ecbd629ba904b7ab9e600b4.tar.bz2 |
re PR middle-end/65048 (ICE in add_phi_args_after_copy_edge, at tree-cfg.c)
PR tree-optimization/65048
* tree-ssa-threadupdate.c (valid_jump_thread_path): New.
(thread_through_all_blocks): Call valid_jump_thread_path.
Remove invalid FSM jump-thread paths.
PR tree-optimization/65048
* gcc.dg/tree-ssa/ssa-dom-thread-9.c: New.
From-SVN: r221007
Diffstat (limited to 'gcc/tree-ssa-threadupdate.c')
-rw-r--r-- | gcc/tree-ssa-threadupdate.c | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c index 3326144..7a41ab2 100644 --- a/gcc/tree-ssa-threadupdate.c +++ b/gcc/tree-ssa-threadupdate.c @@ -2473,6 +2473,21 @@ duplicate_seme_region (edge entry, edge exit, return true; } +/* Return true when PATH is a valid jump-thread path. */ + +static bool +valid_jump_thread_path (vec<jump_thread_edge *> *path) +{ + unsigned len = path->length (); + + /* Check that the path is connected. */ + for (unsigned int j = 0; j < len - 1; j++) + if ((*path)[j]->e->dest != (*path)[j+1]->e->src) + return false; + + return true; +} + /* Walk through all blocks and thread incoming edges to the appropriate outgoing edge for each edge pair recorded in THREADED_EDGES. @@ -2505,12 +2520,25 @@ thread_through_all_blocks (bool may_peel_loop_headers) vec<jump_thread_edge *> *path = paths[i]; edge entry = (*path)[0]->e; - if ((*path)[0]->type != EDGE_FSM_THREAD - /* Do not jump-thread twice from the same block. */ - || bitmap_bit_p (threaded_blocks, entry->src->index)) { - i++; - continue; - } + /* Only code-generate FSM jump-threads in this loop. */ + if ((*path)[0]->type != EDGE_FSM_THREAD) + { + i++; + continue; + } + + /* Do not jump-thread twice from the same block. */ + if (bitmap_bit_p (threaded_blocks, entry->src->index) + /* Verify that the jump thread path is still valid: a + previous jump-thread may have changed the CFG, and + invalidated the current path. */ + || !valid_jump_thread_path (path)) + { + /* Remove invalid FSM jump-thread paths. */ + delete_jump_thread_path (path); + paths.unordered_remove (i); + continue; + } unsigned len = path->length (); edge exit = (*path)[len - 1]->e; |