diff options
author | Jeff Law <law@redhat.com> | 2013-09-25 21:28:03 -0600 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2013-09-25 21:28:03 -0600 |
commit | 5254eac41daa5fc22a65bfa47d75fa0445dee4ee (patch) | |
tree | 51aec5a2d37e7596f984fc1365e772fdecb9e80b /gcc/tree-ssa-threadedge.c | |
parent | 9adc2b3c52c22752ffccfce101959f82e577e0f1 (diff) | |
download | gcc-5254eac41daa5fc22a65bfa47d75fa0445dee4ee.zip gcc-5254eac41daa5fc22a65bfa47d75fa0445dee4ee.tar.gz gcc-5254eac41daa5fc22a65bfa47d75fa0445dee4ee.tar.bz2 |
tree-flow.h (thread_through_all_blocks): Prototype moved into tree-ssa-threadupdate.h.
* tree-flow.h (thread_through_all_blocks): Prototype moved into
tree-ssa-threadupdate.h.
(register_jump_thread): Similarly.
* tree-ssa-threadupdate.h: New header file.
* tree-ssa-dom.c: Include tree-ssa-threadupdate.h.
* tree-vrp.c: Likewise.
* tree-ssa-threadedge.c: Include tree-ssa-threadupdate.h.
(thread_around_empty_blocks): Change type of path vector argument to
an edge,type pair from just an edge. Initialize both elements when
appending to a jump threading path. Tweak references to elements
appropriately.
(thread_across_edge): Similarly. Release memory for the elements
as needed.
* tree-ssa-threadupdate.c: Include tree-ssa-threadupdate.h.
(dump_jump_thread_path): New function broken out from
register_jump_thread.
(register_jump_thread): Use dump_jump_thread_path. Change type of
path vector entries. Search the path for NULL edges and dump
the path if one is found. Tweak the conversion of path to 3-edge
form to use the block copy type information embedded in the path.
* gcc.dg/tree-ssa/ssa-dom-thread-3.c: Update expected output.
From-SVN: r202933
Diffstat (limited to 'gcc/tree-ssa-threadedge.c')
-rw-r--r-- | gcc/tree-ssa-threadedge.c | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c index 2ca56342..467d982 100644 --- a/gcc/tree-ssa-threadedge.c +++ b/gcc/tree-ssa-threadedge.c @@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see #include "dumpfile.h" #include "tree-ssa.h" #include "tree-ssa-propagate.h" +#include "tree-ssa-threadupdate.h" #include "langhooks.h" #include "params.h" @@ -753,7 +754,7 @@ thread_around_empty_blocks (edge taken_edge, bool handle_dominating_asserts, tree (*simplify) (gimple, gimple), bitmap visited, - vec<edge> *path) + vec<jump_thread_edge *> *path) { basic_block bb = taken_edge->dest; gimple_stmt_iterator gsi; @@ -791,8 +792,10 @@ thread_around_empty_blocks (edge taken_edge, if ((taken_edge->flags & EDGE_DFS_BACK) == 0 && !bitmap_bit_p (visited, taken_edge->dest->index)) { + jump_thread_edge *x + = new jump_thread_edge (taken_edge, EDGE_NO_COPY_SRC_BLOCK); + path->safe_push (x); bitmap_set_bit (visited, taken_edge->dest->index); - path->safe_push (taken_edge); return thread_around_empty_blocks (taken_edge, dummy_cond, handle_dominating_asserts, @@ -828,7 +831,11 @@ thread_around_empty_blocks (edge taken_edge, if (bitmap_bit_p (visited, taken_edge->dest->index)) return false; bitmap_set_bit (visited, taken_edge->dest->index); - path->safe_push (taken_edge); + + jump_thread_edge *x + = new jump_thread_edge (taken_edge, EDGE_NO_COPY_SRC_BLOCK); + path->safe_push (x); + thread_around_empty_blocks (taken_edge, dummy_cond, handle_dominating_asserts, @@ -922,9 +929,13 @@ thread_across_edge (gimple dummy_cond, if (dest == NULL || dest == e->dest) goto fail; - vec<edge> path = vNULL; - path.safe_push (e); - path.safe_push (taken_edge); + vec<jump_thread_edge *> path = vNULL; + jump_thread_edge *x + = new jump_thread_edge (e, EDGE_START_JUMP_THREAD); + path.safe_push (x); + + x = new jump_thread_edge (taken_edge, EDGE_COPY_SRC_BLOCK); + path.safe_push (x); /* See if we can thread through DEST as well, this helps capture secondary effects of threading without having to re-run DOM or @@ -947,8 +958,11 @@ thread_across_edge (gimple dummy_cond, } remove_temporary_equivalences (stack); - propagate_threaded_block_debug_into (path.last ()->dest, e->dest); - register_jump_thread (path, false); + propagate_threaded_block_debug_into (path.last ()->e->dest, + e->dest); + register_jump_thread (path); + for (unsigned int i = 0; i < path.length (); i++) + delete path[i]; path.release (); return; } @@ -978,15 +992,18 @@ thread_across_edge (gimple dummy_cond, bitmap_clear (visited); bitmap_set_bit (visited, taken_edge->dest->index); bitmap_set_bit (visited, e->dest->index); - vec<edge> path = vNULL; + vec<jump_thread_edge *> path = vNULL; /* Record whether or not we were able to thread through a successor of E->dest. */ - path.safe_push (e); - path.safe_push (taken_edge); + jump_thread_edge *x = new jump_thread_edge (e, EDGE_START_JUMP_THREAD); + path.safe_push (x); + + x = new jump_thread_edge (taken_edge, EDGE_COPY_SRC_JOINER_BLOCK); + path.safe_push (x); found = false; if ((e->flags & EDGE_DFS_BACK) == 0 - || ! cond_arg_set_in_bb (path.last (), e->dest)) + || ! cond_arg_set_in_bb (path.last ()->e, e->dest)) found = thread_around_empty_blocks (taken_edge, dummy_cond, handle_dominating_asserts, @@ -998,11 +1015,13 @@ thread_across_edge (gimple dummy_cond, record the jump threading opportunity. */ if (found) { - propagate_threaded_block_debug_into (path.last ()->dest, + propagate_threaded_block_debug_into (path.last ()->e->dest, taken_edge->dest); - register_jump_thread (path, true); + register_jump_thread (path); } + for (unsigned int i = 0; i < path.length (); i++) + delete path[i]; path.release(); } BITMAP_FREE (visited); |