Commit f38b3647 by Jan Hubicka Committed by Jan Hubicka

tree-ssa-tail-merge.c (replace_block_by): Fix and re-enable profile merging.


	* tree-ssa-tail-merge.c (replace_block_by): Fix and re-enable profile
	merging.

From-SVN: r254650
parent e8c91a4c
2017-11-10 Jan Hubicka <hubicka@ucw.cz>
* tree-ssa-tail-merge.c (replace_block_by): Fix and re-enable profile
merging.
2017-11-10 Michael Meissner <meissner@linux.vnet.ibm.com> 2017-11-10 Michael Meissner <meissner@linux.vnet.ibm.com>
* config/rs6000/rs6000.md (bswaphi2_reg): On ISA 3.0 systems, * config/rs6000/rs6000.md (bswaphi2_reg): On ISA 3.0 systems,
...@@ -1556,52 +1556,33 @@ replace_block_by (basic_block bb1, basic_block bb2) ...@@ -1556,52 +1556,33 @@ replace_block_by (basic_block bb1, basic_block bb2)
pred_edge, UNKNOWN_LOCATION); pred_edge, UNKNOWN_LOCATION);
} }
bb2->count += bb1->count;
/* FIXME: Fix merging of probabilities. They need to be redistributed
according to the relative counts of merged BBs. */
#if 0
/* Merge the outgoing edge counts from bb1 onto bb2. */ /* Merge the outgoing edge counts from bb1 onto bb2. */
profile_count out_sum = profile_count::zero ();
int out_freq_sum = 0;
edge e1, e2; edge e1, e2;
edge_iterator ei;
/* Recompute the edge probabilities from the new merged edge count. if (bb2->count.initialized_p ())
Use the sum of the new merged edge counts computed above instead FOR_EACH_EDGE (e1, ei, bb1->succs)
of bb2's merged count, in case there are profile count insanities {
making the bb count inconsistent with the edge weights. */ e2 = find_edge (bb2, e1->dest);
FOR_EACH_EDGE (e1, ei, bb1->succs) gcc_assert (e2);
{
if (e1->count ().initialized_p ()) /* If probabilities are same, we are done.
out_sum += e1->count (); If counts are nonzero we can distribute accordingly. In remaining
out_freq_sum += EDGE_FREQUENCY (e1); cases just avreage the values and hope for the best. */
} if (e1->probability == e2->probability)
FOR_EACH_EDGE (e1, ei, bb2->succs) ;
{ else if (bb1->count.nonzero_p () || bb2->count.nonzero_p ())
if (e1->count ().initialized_p ()) e2->probability
out_sum += e1->count (); = e2->probability
out_freq_sum += EDGE_FREQUENCY (e1); * bb2->count.probability_in (bb1->count + bb2->count)
} + e1->probability
FOR_EACH_EDGE (e1, ei, bb1->succs) * bb1->count.probability_in (bb1->count + bb2->count);
{ else
e2 = find_edge (bb2, e1->dest); e2->probability = e2->probability * profile_probability::even ()
gcc_assert (e2); + e1->probability * profile_probability::even ();
if (out_sum > 0 && e2->count ().initialized_p ()) }
{ bb2->count += bb1->count;
e2->probability = e2->count ().probability_in (bb2->count);
}
else if (bb1->count.to_frequency (cfun) && bb2->count.to_frequency (cfun))
e2->probability = e1->probability;
else if (bb2->count.to_frequency (cfun) && !bb1->count.to_frequency (cfun))
;
else if (out_freq_sum)
e2->probability = profile_probability::from_reg_br_prob_base
(GCOV_COMPUTE_SCALE (EDGE_FREQUENCY (e1)
+ EDGE_FREQUENCY (e2),
out_freq_sum));
out_sum += e2->count ();
}
#endif
/* Move over any user labels from bb1 after the bb2 labels. */ /* Move over any user labels from bb1 after the bb2 labels. */
gimple_stmt_iterator gsi1 = gsi_start_bb (bb1); gimple_stmt_iterator gsi1 = gsi_start_bb (bb1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment