[PATCH] PR118442: Don't instrument exit edges after musttail

2025-03-22 Thread Andi Kleen
From: Andi Kleen When -fprofile-generate is used musttail often fails because the compiler adds instrumentation after the tail calls. This patch prevents adding exit extra edges after musttail because for a tail call the execution leaves the function and can never come back even on a unwind or e

Re: [PATCH] PR118442: Don't instrument exit edges after musttail

2025-03-19 Thread Jakub Jelinek
On Wed, Mar 19, 2025 at 12:11:56PM -0700, Andi Kleen wrote: > From: Andi Kleen > > When -fprofile-generate is used musttail often fails because the > compiler adds instrumentation after the tail calls. > > This patch prevents adding exit extra edges after musttail because for a > tail call the e

Re: [PATCH] PR118442: Don't instrument exit edges after musttail

2025-03-19 Thread Andi Kleen
> This looks wrong to me. Even tail calls can be terminated with exit, > perform longjmp, do other things for which stmt_can_terminate_bb_p > should return true. stmt_can_terminate_bb_p is used in many places, not > just in the predict instrumentation. Okay so the check should be only used for s

Re: [PATCH] PR118442: Don't instrument exit edges after musttail

2025-03-19 Thread Andi Kleen
Andi Kleen writes: > diff --git a/gcc/input.cc b/gcc/input.cc > index fabfbfb6eaa..d3b12037ba8 100644 > --- a/gcc/input.cc > +++ b/gcc/input.cc > @@ -1325,6 +1325,8 @@ dump_line_table_statistics (void) >if (s.num_expanded_macros != 0) > fprintf (stderr, "Average number of tokens per macr