+2013-10-18 Teresa Johnson <tejohnson@google.com>
+
+ * tree-ssa-tail-merge.c (replace_block_by): Update edge
+ weights during merging.
+
2013-10-18 Andrew MacLeod <amacleod@redhat.com>
* tree-cfg.h: Rename from tree-flow.h. Remove #includes.
replace_block_by (basic_block bb1, basic_block bb2)
{
edge pred_edge;
+ edge e1;
+ edge_iterator ei;
unsigned int i;
gimple bb2_phi;
bb2->count += bb1->count;
+ /* Merge the outgoing edge counts from bb1 onto bb2. */
+ FOR_EACH_EDGE (e1, ei, bb1->succs)
+ {
+ edge e2;
+ e2 = find_edge (bb2, e1->dest);
+ gcc_assert (e2);
+ e2->count += e1->count;
+ /* Recompute the probability from the new merged edge count (bb2->count
+ was updated above). */
+ e2->probability = GCOV_COMPUTE_SCALE (e2->count, bb2->count);
+ }
+
/* Do updates that use bb1, before deleting bb1. */
release_last_vdef (bb1);
same_succ_flush_bb (bb1);