This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR46730
On Thu, 2 Dec 2010, Jakub Jelinek wrote:
> On Wed, Dec 01, 2010 at 02:10:14PM +0100, Richard Guenther wrote:
> > 2010-12-01 Richard Guenther <rguenther@suse.de>
> >
> > PR tree-optimization/46730
> > * value-prof.c (gimple_ic): Always generate a separate merge BB.
> >
> > * g++.dg/tree-prof/indir-call-prof-2.C: New testcase.
> >
> > Index: gcc/value-prof.c
> > ===================================================================
> > *** gcc/value-prof.c (revision 167303)
> > --- gcc/value-prof.c (working copy)
> > *************** gimple_ic (gimple icall_stmt, struct cgr
> > *** 1146,1155 ****
> > icall_bb->count = all - count;
> >
> > /* Do not disturb existing EH edges from the indirect call. */
> > ! if (last_stmt (icall_bb) != icall_stmt)
> > e_ij = split_block (icall_bb, icall_stmt);
> > else
> > ! e_ij = find_fallthru_edge (icall_bb->succs);
> > join_bb = e_ij->dest;
> > join_bb->count = all;
> >
> > --- 1146,1160 ----
> > icall_bb->count = all - count;
> >
> > /* Do not disturb existing EH edges from the indirect call. */
> > ! if (gsi_stmt (gsi_last_bb (icall_bb)) != icall_stmt)
>
> Shouldn't this be gsi_last_nondebug_bb (icall_bb) instead?
Fixed as follows instead.
Bootstrapped and tested on x86_64-unknown-linxu-gnu, applied.
Richard.
2010-12-02 Richard Guenther <rguenther@suse.de>
* value-prof.c (gimple_ic): Use stmt_ends_bb_p to detect
the case we need to split the edge and not the block.
Index: gcc/value-prof.c
===================================================================
*** gcc/value-prof.c (revision 167367)
--- gcc/value-prof.c (working copy)
*************** gimple_ic (gimple icall_stmt, struct cgr
*** 1146,1152 ****
icall_bb->count = all - count;
/* Do not disturb existing EH edges from the indirect call. */
! if (gsi_stmt (gsi_last_bb (icall_bb)) != icall_stmt)
e_ij = split_block (icall_bb, icall_stmt);
else
{
--- 1146,1152 ----
icall_bb->count = all - count;
/* Do not disturb existing EH edges from the indirect call. */
! if (!stmt_ends_bb_p (icall_stmt))
e_ij = split_block (icall_bb, icall_stmt);
else
{