aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfghooks.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cfghooks.cc')
-rw-r--r--gcc/cfghooks.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/cfghooks.cc b/gcc/cfghooks.cc
index 5f7fc27..8b33468 100644
--- a/gcc/cfghooks.cc
+++ b/gcc/cfghooks.cc
@@ -817,6 +817,15 @@ merge_blocks (basic_block a, basic_block b)
if (!cfg_hooks->merge_blocks)
internal_error ("%s does not support merge_blocks", cfg_hooks->name);
+ /* Pick the more reliable count. If both qualities agrees, pick the larger
+ one since turning mistakely hot code to cold is more harmful. */
+ if (a->count.initialized_p ())
+ a->count = b->count;
+ else if (a->count.quality () < b->count.quality ())
+ a->count = b->count;
+ else if (a->count.quality () == b->count.quality ())
+ a->count = a->count.max (b->count);
+
cfg_hooks->merge_blocks (a, b);
if (current_loops != NULL)