On Thu, 2021-04-15 at 11:45 +0200, Jan Hubicka wrote: > Hi, > this is patch fixing the underlying issue of function missing > lto_prepare_function_for_streaming because gimple_has_body_p is not > the > same thing as node.has_gimple_body (which needs to be clarified next > stage1 by finding better names for this I suppose). > > I commited it to gcc 11 even though we already have your workaround > since it is small and safe and it may save some pain when backporting > changes to the branch in future - basically all passes at WPA > renumbering statements would hit this issue which is not that obvious > to > debug as we found :) >
I think it's just the analyzer that's affected in gcc 11 (and plugins, I suppose), hence I went with the localized fix, but it's your call. > We may backport it to gcc10 too if you preffer it over your fix - I > think both are fine in general for release branches. > The analyzer started changing stmt uids in gcc 11 (specifically in b0702ac5588333e27d7ec43d21d704521f7a05c6, on 2020-10-27), so I think the fix would only affect plugins in older releases. Dave > lto-bootstrapped/regtested x86_64-linux. > > Honza > > 2021-04-15 Jan Hubicka <hubi...@ucw.cz> > > PR lto/98599 > * lto.c (lto_wpa_write_files): Fix handling of clones. > > diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c > index ceb61bb300b..5903f75ac23 100644 > --- a/gcc/lto/lto.c > +++ b/gcc/lto/lto.c > @@ -306,7 +306,7 @@ lto_wpa_write_files (void) > cgraph_node *node; > /* Do body modifications needed for streaming before we fork out > worker processes. */ > - FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node) > + FOR_EACH_FUNCTION (node) > if (!node->clone_of && gimple_has_body_p (node->decl)) > lto_prepare_function_for_streaming (node); > >