summaryrefslogtreecommitdiff
path: root/gcc/cfgloopmanip.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2005-08-03 13:34:49 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2005-08-03 13:34:49 +0000
commitfb54ef7ccb98fc1c10a1662869dab0a3ab52a35a (patch)
tree1a926b9bc202452ffb1c89f9db59da5c72ea357e /gcc/cfgloopmanip.c
parent136305f40bec39c518bec801bcb454cf483005f3 (diff)
downloadgcc-fb54ef7ccb98fc1c10a1662869dab0a3ab52a35a.tar.gz
* cfgloop.h (DLTHE_FLAG_COMPLETTE_PEEL): New flag.
* cfgloopmanip.c (duplicate_loop_to_header_edge): Special case profile updating for complette unrolling. * loop-unroll.c (peel_loop_completely): Use it. * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Likewise. (tree_unroll_loops_completely): Disable code growing unrolling of cold loops. * update-conroll.c: New testcase. * update-conroll-2.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102687 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgloopmanip.c')
-rw-r--r--gcc/cfgloopmanip.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index 648e8372ff8..1e364279403 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -913,7 +913,28 @@ duplicate_loop_to_header_edge (struct loop *loop, edge e, struct loops *loops,
? prob_pass_wont_exit
: prob_pass_thru;
- if (is_latch)
+ /* Complette peeling is special as the probability of exit in last
+ copy becomes 1. */
+ if (flags & DLTHE_FLAG_COMPLETTE_PEEL)
+ {
+ int wanted_freq = EDGE_FREQUENCY (e);
+
+ if (wanted_freq > freq_in)
+ wanted_freq = freq_in;
+
+ gcc_assert (!is_latch);
+ /* First copy has frequency of incomming edge. Each subseqeuent
+ frequency should be reduced by prob_pass_wont_exit. Caller
+ should've managed the flags so all except for original loop
+ has won't exist set. */
+ scale_act = RDIV (wanted_freq * REG_BR_PROB_BASE, freq_in);
+ /* Now simulate the duplication adjustments and compute header
+ frequency of the last copy. */
+ for (i = 0; i < ndupl; i++)
+ wanted_freq = RDIV (wanted_freq * scale_step[i], REG_BR_PROB_BASE);
+ scale_main = RDIV (wanted_freq * REG_BR_PROB_BASE, freq_in);
+ }
+ else if (is_latch)
{
prob_pass_main = TEST_BIT (wont_exit, 0)
? prob_pass_wont_exit