From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 516 invoked by alias); 30 Nov 2012 22:05:40 -0000 Received: (qmail 446 invoked by uid 55); 30 Nov 2012 22:05:23 -0000 From: "tejohnson at google dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug gcov-profile/55551] Revision 193999 breaks lto/profiledbootstrap Date: Fri, 30 Nov 2012 22:05:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: gcov-profile X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tejohnson at google dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-11/txt/msg03051.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55551 --- Comment #2 from Teresa Johnson 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 * 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 wrote: > Working on reproducing right now. Teresa > > On Fri, Nov 30, 2012 at 9:20 AM, markus at trippelsdorf dot de > wrote: >> >> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55551 >> >> Markus Trippelsdorf 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 | tejohnson@google.com | 408-460-2413