This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR46528
- From: Richard Guenther <rguenther at suse dot de>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 2 Dec 2010 16:41:43 +0100 (CET)
- Subject: Re: [PATCH] Fix PR46528
- References: <alpine.LNX.2.00.1011251651220.23074@zhemvz.fhfr.qr> <20101202142833.GK29412@tyan-ft48-01.lab.bos.redhat.com>
On Thu, 2 Dec 2010, Jakub Jelinek wrote:
> On Thu, Nov 25, 2010 at 04:53:33PM +0100, Richard Guenther wrote:
> > This fixes the problem on the testcase in PR46528 where we end up
> > with mismatched profiles when doing -g0 -fprofile-generate vs.
> > -g -fprofile-use as in (some) profiledbootstrap runs.
>
> I don't think this is 100% correct, it might still trigger if there
> are no normal stmts with location, only debug stmts with location, then
> last will be still set and might result in differences.
>
> Fixed thusly, ok for trunk?
Ok if it passed profiledbootstrap.
Thanks,
Richard.
> 2010-12-02 Jakub Jelinek <jakub@redhat.com>
>
> PR tree-optimization/46528
> PR debug/46338
> * profile.c (branch_prob): Make sure last is never set to a debug
> stmt.
>
> --- gcc/profile.c 2010-11-26 10:50:25.562279727 +0100
> +++ gcc/profile.c 2010-11-30 16:22:51.582292282 +0100
> @@ -937,11 +937,12 @@ branch_prob (void)
> /* It may happen that there are compiler generated statements
> without a locus at all. Go through the basic block from the
> last to the first statement looking for a locus. */
> - for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); gsi_prev (&gsi))
> + for (gsi = gsi_last_nondebug_bb (bb);
> + !gsi_end_p (gsi);
> + gsi_prev_nondebug (&gsi))
> {
> last = gsi_stmt (gsi);
> - if (!is_gimple_debug (last)
> - && gimple_has_location (last))
> + if (gimple_has_location (last))
> break;
> }
>
>
> Jakub
>
>
--
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 - GF: Markus Rex