http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55551



--- Comment #2 from Teresa Johnson <tejohnson at google dot com> 2012-11-30 
22:05:22 UTC ---

Found the issue. Doing final testing, but the patch is below. FTR, I

couldn't do a slim-lto-bootstrap, it appears this config file is not

yet committed to trunk? Reproduced with just a normal lto bootstrap

though.



Teresa





2012-11-30  Teresa Johnson  <tejohn...@google.com>



* lto-cgraph.c (merge_profile_summaries): Handle scaled histogram

        entries that map to the same index.



Index: lto-cgraph.c

===================================================================

--- lto-cgraph.c (revision 193999)

+++ lto-cgraph.c (working copy)

@@ -1363,17 +1363,20 @@ merge_profile_summaries (struct lto_file_decl_data

          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);

+      /* 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);

-      lto_gcov_summary.histogram[new_ix].min_value = scaled_min;

+      lto_gcov_summary.histogram[new_ix].min_value

+          = MIN (lto_gcov_summary.histogram[new_ix].min_value, scaled_min);

       /* Some of the scaled counter values would ostensibly need to be placed

          into different (larger) histogram buckets, but we keep things simple

          here and place the scaled cumulative counter value in the bucket

          corresponding to the scaled minimum counter value.  */

       lto_gcov_summary.histogram[new_ix].cum_value

-          = RDIV (saved_profile_info->histogram[h_ix].cum_value

-                  * saved_scale, REG_BR_PROB_BASE);

+          += RDIV (saved_profile_info->histogram[h_ix].cum_value

+                   * saved_scale, REG_BR_PROB_BASE);

       lto_gcov_summary.histogram[new_ix].num_counters

-          = saved_profile_info->histogram[h_ix].num_counters;

+          += saved_profile_info->histogram[h_ix].num_counters;

     }



   /* Watch roundoff errors.  */





On Fri, Nov 30, 2012 at 9:37 AM, Teresa Johnson <tejohn...@google.com> wrote:

> Working on reproducing right now. Teresa

>

> On Fri, Nov 30, 2012 at 9:20 AM, markus at trippelsdorf dot de

> <gcc-bugzi...@gcc.gnu.org> wrote:

>>

>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55551

>>

>> Markus Trippelsdorf <markus at trippelsdorf dot de> changed:

>>

>>            What    |Removed                     |Added

>> ----------------------------------------------------------------------------

>>                  CC|                            |tejohnson at gcc dot

>>                    |                            |gnu.org

>>

>> --

>> Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email

>> ------- You are receiving this mail because: -------

>> You are on the CC list for the bug.

>

>

>

> --

> Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413

Reply via email to