summaryrefslogtreecommitdiff
path: root/gcc/cfgrtl.c
diff options
context:
space:
mode:
authorkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-26 06:54:13 +0000
committerkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-26 06:54:13 +0000
commit34f05bfaa65c6c9e7fd41715a5a20318f6c4bce3 (patch)
tree9f87a6a1db8557e68bd95fa7b6de583a88b9a66c /gcc/cfgrtl.c
parent6a881b08b1f6938bc49a01d05ef21b18d48dd10f (diff)
downloadgcc-34f05bfaa65c6c9e7fd41715a5a20318f6c4bce3.tar.gz
* cfgrtl.c (try_redirect_by_replacing_jump): Speed up the
check that tests if all edges go to the same destination. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91334 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgrtl.c')
-rw-r--r--gcc/cfgrtl.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 4e0fc4cb8fc..3ba3265e683 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -662,10 +662,8 @@ try_redirect_by_replacing_jump (edge e, basic_block target, bool in_cfglayout)
{
basic_block src = e->src;
rtx insn = BB_END (src), kill_from;
- edge tmp;
rtx set;
int fallthru = 0;
- edge_iterator ei;
/* If we are partitioning hot/cold basic blocks, we don't want to
mess up unconditional or indirect jumps that cross between hot
@@ -682,12 +680,17 @@ try_redirect_by_replacing_jump (edge e, basic_block target, bool in_cfglayout)
|| BB_PARTITION (src) != BB_PARTITION (target)))
return NULL;
- /* Verify that all targets will be TARGET. */
- FOR_EACH_EDGE (tmp, ei, src->succs)
- if (tmp->dest != target && tmp != e)
- break;
+ /* We can replace or remove a complex jump only when we have exactly
+ two edges. Also, if we have exactly one outgoing edge, we can
+ redirect that. */
+ if (EDGE_COUNT (src->succs) >= 3
+ /* Verify that all targets will be TARGET. Specifically, the
+ edge that is not E must also go to TARGET. */
+ || (EDGE_COUNT (src->succs) == 2
+ && EDGE_SUCC (src, EDGE_SUCC (src, 0) == e)->dest != target))
+ return NULL;
- if (tmp || !onlyjump_p (insn))
+ if (!onlyjump_p (insn))
return NULL;
if ((!optimize || reload_completed) && tablejump_p (insn, NULL, NULL))
return NULL;