Re: [PATCH v2 1/2] PR118442: Don't instrument exit edges after musttail

2025-03-26 Thread Jan Hubicka
> > > > Hmm. I do wonder whether your earlier patch was more "correct" in the > > sense that a tail call does not return to the calling function but its > > caller. > > That means it should not have a fallthru edge, so our representation > > with feeding a return value to a function-local return

Re: [PATCH v2 1/2] PR118442: Don't instrument exit edges after musttail

2025-03-26 Thread Jan Hubicka
> > Hmm. I do wonder whether your earlier patch was more "correct" in the > sense that a tail call does not return to the calling function but its caller. > That means it should not have a fallthru edge, so our representation > with feeding a return value to a function-local return stmt isn't a g

Re: [PATCH v2 1/2] PR118442: Don't instrument exit edges after musttail

2025-03-26 Thread Jan Hubicka
> The only question I have is flow_call_edges_add only called while > profiling or is it called some other time? So looking into who calls > flow_call_edges_add, it is only branch_prob (profile.cc) which is only > called from tree-profile.cc. So a cleanup (for GCC 16 is remove the > cfghook flow_ca

Re: [PATCH v2 1/2] PR118442: Don't instrument exit edges after musttail

2025-03-20 Thread Jakub Jelinek
On Thu, Mar 20, 2025 at 09:08:25AM +0100, Richard Biener wrote: > Hmm. I do wonder whether your earlier patch was more "correct" in the > sense that a tail call does not return to the calling function but its caller. > That means it should not have a fallthru edge, so our representation > with fee

Re: [PATCH v2 1/2] PR118442: Don't instrument exit edges after musttail

2025-03-20 Thread Richard Biener
On Thu, Mar 20, 2025 at 2:34 AM 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 execution

Re: [PATCH v2 1/2] PR118442: Don't instrument exit edges after musttail

2025-03-19 Thread Andrew Pinski
On Wed, Mar 19, 2025 at 6:34 PM 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 execution

[PATCH v2 1/2] PR118442: Don't instrument exit edges after musttail

2025-03-19 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