diff options
author | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-07-09 22:44:03 +0000 |
---|---|---|
committer | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-07-09 22:44:03 +0000 |
commit | c8e41bd91cde9c8c33f6d49f4e1d2e1be70d7d8b (patch) | |
tree | 0e61aac0e1113d8e8432e300c7301abcb9e59db8 /gcc/cfghooks.c | |
parent | 74f5e5c93d27c4093561b792572164dab8b27e6d (diff) | |
download | gcc-c8e41bd91cde9c8c33f6d49f4e1d2e1be70d7d8b.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126499 138bc75d-0d04-0410-961f-82ee72b054a4
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 98b5e349e70..286625766e3 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) |