+2016-07-25 Martin Liska <mliska@suse.cz>
+
+ PR gcov-profile/71868
+ * cfgloopanal.c (expected_loop_iterations_unbounded): When we
+ have a function with multiple latches, count them all.
+
2016-07-25 Martin Liska <mliska@suse.cz>
* tree-ssa-loop-niter.c (loop_only_exit_p): Release body array.
/* If we have no profile at all, use AVG_LOOP_NITER. */
if (profile_status_for_fn (cfun) == PROFILE_ABSENT)
expected = PARAM_VALUE (PARAM_AVG_LOOP_NITER);
- else if (loop->latch->count || loop->header->count)
+ else if (loop->latch && (loop->latch->count || loop->header->count))
{
gcov_type count_in, count_latch;
freq_latch = 0;
FOR_EACH_EDGE (e, ei, loop->header->preds)
- if (e->src == loop->latch)
- freq_latch = EDGE_FREQUENCY (e);
+ if (flow_bb_inside_loop_p (loop, e->src))
+ freq_latch += EDGE_FREQUENCY (e);
else
freq_in += EDGE_FREQUENCY (e);