On Tue, Mar 25, 2025 at 08:33:41AM -0700, Andi Kleen wrote:
> > 2025-03-25  Jakub Jelinek  <ja...@redhat.com>
> >         Andi Kleen  <a...@gcc.gnu.org>
> > 
> >     PR gcov-profile/118442
> >     * profile.cc (branch_prob): Ignore EDGE_FAKE edges from musttail calls
> >     to EXIT.
> > 
> >     * c-c++-common/pr118442.c: New test.
> > 
> > --- gcc/profile.cc.jj       2025-01-02 11:23:16.458517673 +0100
> > +++ gcc/profile.cc  2025-03-25 09:57:21.860398601 +0100
> > @@ -1340,6 +1340,20 @@ branch_prob (bool thunk)
> >       EDGE_INFO (e)->ignore = 1;
> >       ignored_edges++;
> >     }
> > +      /* Ignore fake edges after musttail calls.  */
> > +      if ((e->flags & EDGE_FAKE)
> > +     && e->dest == EXIT_BLOCK_PTR_FOR_FN (cfun))
> > +   {
> > +     gimple_stmt_iterator gsi = gsi_last_bb (e->src);
> 
> At least the musttail pass allows some statements after the call, like labels
> and debug information. Not sure if it matters.

I think it shouldn't.
gimple_flow_call_edges_add splits basic blocks with calls after those calls
and adds the EDGE_FAKE edges to EXIT, so the last stmt at the end of
the bb from which the edge goes should be the call.

        Jakub

Reply via email to