diff options
author | Zdenek Dvorak <dvorakz@suse.cz> | 2007-07-10 00:44:03 +0200 |
---|---|---|
committer | Zdenek Dvorak <rakdver@gcc.gnu.org> | 2007-07-09 22:44:03 +0000 |
commit | 452ba14de17872cf0d51da73f6faa6b2f3668753 (patch) | |
tree | 0e61aac0e1113d8e8432e300c7301abcb9e59db8 /gcc/cfghooks.c | |
parent | 18c492a9942639026fc27de5f1631f35b3d1b5ab (diff) | |
download | gcc-452ba14de17872cf0d51da73f6faa6b2f3668753.zip gcc-452ba14de17872cf0d51da73f6faa6b2f3668753.tar.gz gcc-452ba14de17872cf0d51da73f6faa6b2f3668753.tar.bz2 |
cfghooks.c (remove_edge): New function.
* cfghooks.c (remove_edge): New function.
(redirect_edge_and_branch, remove_branch, merge_blocks): Updated
loop exit rescans.
* cfghooks.h (remove_edge): Declare.
* cfg.c (remove_edge): Renamed to remove_edge_raw.
* basic-block.h (remove_edge): Declaration changed to remove_edge_raw.
From-SVN: r126499
Diffstat (limited to 'gcc/cfghooks.c')
-rw-r--r-- | gcc/cfghooks.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c index 98b5e34..2866257 100644 --- a/gcc/cfghooks.c +++ b/gcc/cfghooks.c @@ -310,10 +310,10 @@ redirect_edge_and_branch (edge e, basic_block dest) ret = cfg_hooks->redirect_edge_and_branch (e, dest); - /* If RET != E, then the edge E was removed since RET already lead to the - same destination. */ - if (ret != NULL && current_loops != NULL) - rescan_loop_exit (e, false, ret != e); + /* If RET != E, then either the redirection failed, or the edge E + was removed since RET already lead to the same destination. */ + if (current_loops != NULL && ret == e) + rescan_loop_exit (e, false, false); return ret; } @@ -350,9 +350,6 @@ remove_branch (edge e) other = EDGE_SUCC (src, EDGE_SUCC (src, 0) == e); irr = other->flags & EDGE_IRREDUCIBLE_LOOP; - if (current_loops != NULL) - rescan_loop_exit (e, false, true); - e = redirect_edge_and_branch (e, other->dest); gcc_assert (e != NULL); @@ -360,6 +357,17 @@ remove_branch (edge e) e->flags |= irr; } +/* Removes edge E from cfg. Unlike remove_branch, it does not update IL. */ + +void +remove_edge (edge e) +{ + if (current_loops != NULL) + rescan_loop_exit (e, false, true); + + remove_edge_raw (e); +} + /* Redirect the edge E to basic block DEST even if it requires creating of a new basic block; then it returns the newly created basic block. Aborts when redirection is impossible. */ @@ -657,11 +665,7 @@ merge_blocks (basic_block a, basic_block b) whole lot of them and hope the caller knows what they're doing. */ while (EDGE_COUNT (a->succs) != 0) - { - if (current_loops != NULL) - rescan_loop_exit (EDGE_SUCC (a, 0), false, true); - remove_edge (EDGE_SUCC (a, 0)); - } + remove_edge (EDGE_SUCC (a, 0)); /* Adjust the edges out of B for the new owner. */ FOR_EACH_EDGE (e, ei, b->succs) |