Fix conversions from sreal to nearest integer.
gcc/ChangeLog:
* cfgloop.cc (get_estimated_loop_iterations): Use sreal::to_nearest_int
* cfgloopanal.cc (expected_loop_iterations_unbounded): Likewise.
* predict.cc (estimate_bb_frequencies): Likewise.
* profile.cc (branch_prob): Likewise.
* tree-ssa-loop-niter.cc (estimate_numbers_of_iterations): Likewise
if (expected_loop_iterations_by_profile (loop, &snit, &reliable)
&& reliable)
{
- *nit = (snit + 0.5).to_int ();
+ *nit = snit.to_nearest_int ();
return true;
}
return false;
sreal sreal_expected;
if (expected_loop_iterations_by_profile
(loop, &sreal_expected, read_profile_p))
- expected = (sreal_expected + 0.5).to_int ();
+ expected = sreal_expected.to_nearest_int ();
else
expected = param_avg_loop_niter;
break;
}
}
- tmp = tmp * freq_max + sreal (1, -1);
- profile_count count = profile_count::from_gcov_type (tmp.to_int ());
+ tmp = tmp * freq_max;
+ profile_count count = profile_count::from_gcov_type (tmp.to_nearest_int ());
/* If we have profile feedback in which this function was never
executed, then preserve this info. */
&& expected_loop_iterations_by_profile (loop, &nit, &reliable)
&& reliable)
{
- widest_int bound = (nit + 0.5).to_int ();
+ widest_int bound = nit.to_nearest_int ();
loop->any_estimate = false;
record_niter_bound (loop, bound, true, false);
}
&& expected_loop_iterations_by_profile (loop, &nit, &reliable)
&& reliable)
{
- bound = (nit + 0.5).to_int ();
+ bound = nit.to_nearest_int ();
record_niter_bound (loop, bound, true, false);
}