This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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?

That would be what last_stmt does but that isn't what we want here.
We need to split after the call stmt, not the debug stmt.  So we
can only avoid the split-block if the BB ends with a call (with
the last_stmt or gsi_last_nondebug_bb we'll ICE because the
debug stmt will refer to a wrong SSA name).

Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]