diff options
author | Jan Hubicka <jh@suse.cz> | 2002-01-05 11:52:54 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2002-01-05 10:52:54 +0000 |
commit | 1c570418339af7cc16a4ec01ccfbdd1a96568c21 (patch) | |
tree | 6a84e86141d2845d366c1de5768f3abe563fff5b /gcc | |
parent | d83bb9f778da2a861a6aebd527b61ec6c495d494 (diff) | |
download | gcc-1c570418339af7cc16a4ec01ccfbdd1a96568c21.zip gcc-1c570418339af7cc16a4ec01ccfbdd1a96568c21.tar.gz gcc-1c570418339af7cc16a4ec01ccfbdd1a96568c21.tar.bz2 |
* cfgcleanup.c (try_forward_edges): Allow multiple jump threading.
From-SVN: r48563
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cfgcleanup.c | 20 |
2 files changed, 18 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ebcf344..2ada634 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +Sat Jan 5 11:52:05 CET 2002 Jan Hubicka <jh@suse.cz> + + * cfgcleanup.c (try_forward_edges): Allow multiple jump threading. + 2002-01-05 Neil Booth <neil@daikokuya.demon.co.uk> * doc/cppinternals.texi: Update. diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index f4aec51..96dee62 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -369,7 +369,8 @@ try_forward_edges (mode, b) int mode; { bool changed = false; - edge e, next, threaded_edge; + edge e, next, *threaded_edges = NULL; + int nthreaded_edges = 0; for (e = b->succ; e; e = next) { @@ -406,13 +407,17 @@ try_forward_edges (mode, b) /* Allow to thread only over one edge at time to simplify updating of probabilities. */ - else if ((mode & CLEANUP_THREADING) && !threaded) + else if (mode & CLEANUP_THREADING) { - threaded_edge = thread_jump (mode, e, target); - if (threaded_edge) + edge t = thread_jump (mode, e, target); + if (t) { - new_target = threaded_edge->dest; + new_target = t->dest; new_target_threaded = true; + if (!nthreaded_edges) + threaded_edges = xmalloc (sizeof (*threaded_edges) + * n_basic_blocks); + threaded_edges[nthreaded_edges++] = t; } } @@ -462,6 +467,7 @@ try_forward_edges (mode, b) gcov_type edge_count = e->count; int edge_probability = e->probability; int edge_frequency; + int n = 0; /* Don't force if target is exit block. */ if (threaded && target != EXIT_BLOCK_PTR) @@ -498,7 +504,7 @@ try_forward_edges (mode, b) first->succ->count -= edge_count; first->frequency -= edge_frequency; if (first->succ->succ_next) - t = threaded_edge; + t = threaded_edges [n++]; else t = first->succ; @@ -510,6 +516,8 @@ try_forward_edges (mode, b) } } + if (threaded_edges) + free (threaded_edges); return changed; } |