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 :) We may backport it to gcc10 too if you preffer it over your fix - I think both are fine in general for release branches. 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);