LTRANS clears the profile summary after reading it and used to leave its
cutoff and maximum count at zero. Restore the merged fields so profile
adjustment uses the same summary as WPA.
Regression tested on aarch64-linux-gnu with no new regressions.
gcc/ChangeLog:
* lto-cgraph.cc (merge_profile_summaries): Restore the merged cutoff
and maximum count in LTRANS.
Signed-off-by: Kugan Vivekanandarajah <[email protected]>
---
gcc/lto-cgraph.cc | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/gcc/lto-cgraph.cc b/gcc/lto-cgraph.cc
index b3644e47bec..fe57223556f 100644
--- a/gcc/lto-cgraph.cc
+++ b/gcc/lto-cgraph.cc
@@ -1801,7 +1801,20 @@ merge_profile_summaries (struct lto_file_decl_data
**file_data_vec)
/* If merging already happent at WPA time, we are done. */
if (flag_ltrans)
- return;
+ {
+ /* The streamed LTRANS summaries were already merged at WPA. */
+ for (j = 0; (file_data = file_data_vec[j]) != NULL; j++)
+ if (file_data->profile_info.runs)
+ {
+ profile_info->sum_max
+ = MAX (profile_info->sum_max,
+ file_data->profile_info.sum_max);
+ profile_info->cutoff
+ = MAX (profile_info->cutoff,
+ file_data->profile_info.cutoff);
+ }
+ return;
+ }
/* Now compute count_materialization_scale of each node.
During LTRANS we already have values of count_materialization_scale
--
2.34.1