summaryrefslogtreecommitdiff
path: root/gcc/ifcvt.c
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2005-01-05 01:45:00 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2005-01-05 01:45:00 +0000
commit12d7523c344cb89785d92073037c062f3b487b15 (patch)
treef80c754142d8d7426764371d9c1effdfea791755 /gcc/ifcvt.c
parent67be63e60f12049d0b2105a14a94be485b7bfdb4 (diff)
downloadgcc-12d7523c344cb89785d92073037c062f3b487b15.tar.gz
* ifcvt.c (find_if_case_1): Avoid creating an empty forwarder block,
if deleting the then-block allows the test-block to fallthru to the else-block. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92919 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ifcvt.c')
-rw-r--r--gcc/ifcvt.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 98fbd667a01..75932b37e46 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -2927,7 +2927,21 @@ find_if_case_1 (basic_block test_bb, edge then_edge, edge else_edge)
else_bb->global_live_at_start,
then_bb->global_live_at_end);
- new_bb = redirect_edge_and_branch_force (FALLTHRU_EDGE (test_bb), else_bb);
+
+ /* We can avoid creating a new basic block if then_bb is immediately
+ followed by else_bb, i.e. deleting then_bb allows test_bb to fall
+ thru to else_bb. */
+
+ if (then_bb->next_bb == else_bb
+ && then_bb->prev_bb == test_bb)
+ {
+ redirect_edge_succ (FALLTHRU_EDGE (test_bb), else_bb);
+ new_bb = 0;
+ }
+ else
+ new_bb = redirect_edge_and_branch_force (FALLTHRU_EDGE (test_bb),
+ else_bb);
+
then_bb_index = then_bb->index;
delete_basic_block (then_bb);