===================================================================
@@ -956,7 +957,16 @@ input_overwrite_node (struct lto_file_de
node->lowered = bp_unpack_value (bp, 1);
node->analyzed = tag == LTO_cgraph_analyzed_node;
node->in_other_partition = bp_unpack_value (bp, 1);
- if (node->in_other_partition)
+ if (node->in_other_partition
+ /* Avoid updating decl when we are seeing just inline clone.
+ When inlining function that has functions already inlined into it,
+ we produce clones of inline clones.
+
+ WPA partitioning might put each clone into different unit and
+ we might end up streaming inline clone from other partition
+ to support clone we are interested in. */
+ && (!node->clone_of
+ || node->clone_of->decl != node->decl))
{
DECL_EXTERNAL (node->decl) = 1;
TREE_STATIC (node->decl) = 0;
===================================================================
@@ -160,9 +160,6 @@ lto_materialize_function (struct cgraph_
and also functions that are needed to produce virtual clones. */
if (node->analyzed || has_analyzed_clone_p (node))
{
- /* This function has a definition. */
- TREE_STATIC (decl) = 1;
-
/* Clones don't need to be read. */
if (node->clone_of)
return;
@@ -198,8 +195,6 @@ lto_materialize_function (struct cgraph_
if (!flag_wpa)
ggc_collect ();
}
- else
- DECL_EXTERNAL (decl) = 1;
/* Let the middle end know about the function. */
rest_of_decl_compilation (decl, 1, 0);