Compiler speed (vanilla vs. LTO, PGO and LTO+PGO)

Jan Hubicka
Thu Mar 28 23:35:00 GMT 2013

> Interesting, I was able to get faste LTO+PGO compile times than non-LTO,PGO.
> I however did testng only on combine.c compliation, so not very scientific.
> There are some cases FDO information is not streamed well in all cases.  I will
> post patch for that later today.  Perhaps it will make situation bit better.

there is overflow in the histogram merging code truncating all gcov counters
that do not fit in integer. Fixed by the following patch I applied to mainline
as obvious.  It may make the LTO binaries noticeably smaller (we will see on
the next run of regular SPEC testers).


Index: ChangeLog
--- ChangeLog	(revision 197205)
+++ ChangeLog	(working copy)
@@ -1,5 +1,9 @@
 2013-03-28  Jan Hubicka  <>
+	* lto-cgraph.c (merge_profile_summaries): Fix overflows.
+2013-03-28  Jan Hubicka  <>
 	* data-streamer-in.c (streamer_read_gcov_count): New function.
 	* gimple-streamer-out.c: Include value-prof.h.
 	(output_gimple_stmt): Output histogram.
Index: lto-cgraph.c
--- lto-cgraph.c	(revision 197205)
+++ lto-cgraph.c	(working copy)
@@ -1362,8 +1362,8 @@ merge_profile_summaries (struct lto_file
       /* Scale up the min value as we did the corresponding sum_all
          above. Use that to find the new histogram index.  */
-      int scaled_min = RDIV (saved_profile_info->histogram[h_ix].min_value
-                             * saved_scale, REG_BR_PROB_BASE);
+      gcov_type scaled_min = RDIV (saved_profile_info->histogram[h_ix].min_value
+                                   * saved_scale, REG_BR_PROB_BASE);
       /* The new index may be shared with another scaled histogram entry,
          so we need to account for a non-zero histogram entry at new_ix.  */
       unsigned new_ix = gcov_histo_index (scaled_min);

More information about the Gcc-help mailing list