https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119491
--- Comment #3 from rguenther at suse dot de <rguenther at suse dot de> --- On Thu, 27 Mar 2025, jakub at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119491 > > Jakub Jelinek <jakub at gcc dot gnu.org> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > CC| |jakub at gcc dot gnu.org, > | |rguenth at gcc dot gnu.org > > --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- > I think it would be useful to do one cleanup_eh far earlier after IPA, right > now we have cleanup_eh before IPA (but after tailr) and another one only a few > passes after tailc almost at the end of GIMPLE passes. > Inlining can introduce cases where EH needs to be cleaned up and perhaps the > lack of that hurts even other optimizations than just tailc. > So perhaps around vrp1 (i.e. after some cleanups of the post IPA IL (ccp, > forwprop, fre))? > > Another possibility is what you have but have a special version of the pass > guarded on cfun->has_musttail (though that won't help other tail calls, just > musttail). > > Or yet another possibility is not to handle musttail calls during tailc (so, > pretty much set diag_musttail only in musttail; then it would be the same > thing > as only_musttail and could be merged into just one flag) pass and do it always > in the musttail pass. This won't help tail calls other than musttail as well. > > Now the second or third option are maybe slightly safer this late in stage4, > but perhaps we have still time to add another cleanup_eh. > > Richi, what do you think about this? It probably makes sense to cleanup EH either right after inlining when we inlined a "substantial" EH tree or after the first round of scalar cleanups post-IPA which would usually be after the DSE/DCE pair which itself is a bit late, only after jump threading & VRP and after array bound diags (uh?). I'm not sure we want to shuffle passes at this point though.