* predict.c (estimate_probability): Fix roundoff error.
From-SVN: r62765
This commit is contained in:
parent
9083b5dab9
commit
6efcd26809
@ -1,3 +1,7 @@
|
||||
Wed Feb 12 15:19:42 CET 2003 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* predict.c (estimate_probability): Fix roundoff error.
|
||||
|
||||
2003-02-12 Kazu Hirata <kazu@cs.umass.edu>
|
||||
|
||||
* config/h8300/h8300.md (a peephole2): Don't handle 65535.
|
||||
|
@ -449,14 +449,19 @@ estimate_probability (loops_info)
|
||||
if (simple_loop_p (loops_info, loop, &desc)
|
||||
&& desc.const_iter)
|
||||
{
|
||||
int prob;
|
||||
niter = desc.niter + 1;
|
||||
if (niter == 0) /* We might overflow here. */
|
||||
niter = desc.niter;
|
||||
|
||||
prob = (REG_BR_PROB_BASE
|
||||
- (REG_BR_PROB_BASE + niter /2) / niter);
|
||||
/* Branch prediction algorithm gives 0 frequency for everything
|
||||
after the end of loop for loop having 0 probability to finish. */
|
||||
if (prob == REG_BR_PROB_BASE)
|
||||
prob = REG_BR_PROB_BASE - 1;
|
||||
predict_edge (desc.in_edge, PRED_LOOP_ITERATIONS,
|
||||
REG_BR_PROB_BASE
|
||||
- (REG_BR_PROB_BASE + niter /2)
|
||||
/ niter);
|
||||
prob);
|
||||
}
|
||||
|
||||
bbs = get_loop_body (loop);
|
||||
|
Loading…
Reference in New Issue
Block a user