aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/cgraphclones.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/cgraphclones.c')
-rw-r--r--gcc-4.9/gcc/cgraphclones.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/cgraphclones.c b/gcc-4.9/gcc/cgraphclones.c
index 9fec2a04d..c23509c28 100644
--- a/gcc-4.9/gcc/cgraphclones.c
+++ b/gcc-4.9/gcc/cgraphclones.c
@@ -315,6 +315,11 @@ duplicate_thunk_for_node (cgraph_node *thunk, cgraph_node *node)
if (thunk_of->thunk.thunk_p)
node = duplicate_thunk_for_node (thunk_of, node);
+ /* We need to copy arguments, at LTO these mat not be read from function
+ section. */
+ if (!DECL_ARGUMENTS (thunk->decl))
+ cgraph_get_body (thunk);
+
struct cgraph_edge *cs;
for (cs = node->callers; cs; cs = cs->next_caller)
if (cs->caller->thunk.thunk_p
@@ -339,6 +344,22 @@ duplicate_thunk_for_node (cgraph_node *thunk, cgraph_node *node)
node->clone.args_to_skip,
false);
}
+
+ tree *link = &DECL_ARGUMENTS (new_decl);
+ int i = 0;
+ for (tree pd = DECL_ARGUMENTS (thunk->decl); pd; pd = DECL_CHAIN (pd), i++)
+ {
+ if (!node->clone.args_to_skip
+ || !bitmap_bit_p (node->clone.args_to_skip, i))
+ {
+ tree nd = copy_node (pd);
+ DECL_CONTEXT (nd) = new_decl;
+ *link = nd;
+ link = &DECL_CHAIN (nd);
+ }
+ }
+ *link = NULL_TREE;
+
gcc_checking_assert (!DECL_STRUCT_FUNCTION (new_decl));
gcc_checking_assert (!DECL_INITIAL (new_decl));
gcc_checking_assert (!DECL_RESULT (new_decl));
@@ -363,6 +384,11 @@ duplicate_thunk_for_node (cgraph_node *thunk, cgraph_node *node)
cgraph_call_edge_duplication_hooks (thunk->callees, e);
if (!expand_thunk (new_thunk, false))
new_thunk->analyzed = true;
+ else
+ {
+ new_thunk->thunk.thunk_p = false;
+ cgraph_analyze_function (new_thunk);
+ }
cgraph_call_node_duplication_hooks (thunk, new_thunk);
return new_thunk;
}