summaryrefslogtreecommitdiff
path: root/gcc/cfganal.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-09 04:21:49 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-09 04:21:49 +0000
commitbd98a41841b4c2f94efb5ba21092c33939611646 (patch)
tree06652f7acaf9367a0888955e343219ae2cf9e5d9 /gcc/cfganal.c
parent817ab1a3675b97e7084be72cfbf7d7f65f1ddaf8 (diff)
downloadgcc-bd98a41841b4c2f94efb5ba21092c33939611646.tar.gz
* cfg.c (redirect_edge_succ_nodup): Use find_edge rather than
implementing it inline. * cfganal.c (find_edge): Search pred->succs or succ->preds, whichever is shorter. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@90333 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfganal.c')
-rw-r--r--gcc/cfganal.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/gcc/cfganal.c b/gcc/cfganal.c
index 651f1534552..06c71f678c6 100644
--- a/gcc/cfganal.c
+++ b/gcc/cfganal.c
@@ -478,9 +478,18 @@ find_edge (basic_block pred, basic_block succ)
edge e;
edge_iterator ei;
- FOR_EACH_EDGE (e, ei, pred->succs)
- if (e->dest == succ)
- return e;
+ if (EDGE_COUNT (pred->succs) <= EDGE_COUNT (succ->preds))
+ {
+ FOR_EACH_EDGE (e, ei, pred->succs)
+ if (e->dest == succ)
+ return e;
+ }
+ else
+ {
+ FOR_EACH_EDGE (e, ei, succ->preds)
+ if (e->src == pred)
+ return e;
+ }
return NULL;
}