Hi, stepping through the streaming process it turns out to be funny difference between gimple_has_body and node->has_gimple_body_p. While the first tests whether gimple body really exists in memory (by looking for DECL_STRUCT_FUNCTION) the second tests if gimple body can be made available via node->get_body (so gimple_body_p returns 1).
Now what happens is that function clone is created and the original function becomes dead and thus is marked as external declaration. At this point we can not get the body via node->get_body, but body is still around since analyzer read it. This makes the renumbering loop to miss this particular body. Since for node->clone_of we have gimple_body_p (node->clone_of->decl) == true and node->has_gimple_body_p (node->clone_of) == false While for node we have node->has_gimple_body_p (node) == true This is both correct but next stage1 we really ought to rename one of predicates. Sadly I can not think of much better names though. I am testing. 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);