From 70d937f960ca5f261d0b5f9c38c504364bacfb12 Mon Sep 17 00:00:00 2001 From: davidxl Date: Fri, 11 Apr 2014 03:46:30 +0000 Subject: [PATCH] backport r196626 (making alias lipo link consistent) from v16 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/google@209290 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc-4_8/gcc/ipa-inline-transform.c | 5 +---- gcc-4_8/gcc/l-ipo.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/gcc-4_8/gcc/ipa-inline-transform.c b/gcc-4_8/gcc/ipa-inline-transform.c index 5f6a55ca3b6..34b47644504 100644 --- a/gcc-4_8/gcc/ipa-inline-transform.c +++ b/gcc-4_8/gcc/ipa-inline-transform.c @@ -346,7 +346,6 @@ inline_call (struct cgraph_edge *e, bool update_original, struct cgraph_node *to = NULL; struct cgraph_edge *curr = e; struct cgraph_node *callee = cgraph_function_or_thunk_node (e->callee, NULL); - struct cgraph_node *resolved_target = callee; bool new_edges_found = false; /* Skip fake edge. */ @@ -379,9 +378,7 @@ inline_call (struct cgraph_edge *e, bool update_original, { struct cgraph_node *alias = e->callee, *next_alias; - if (L_IPO_COMP_MODE && cgraph_pre_profiling_inlining_done) - resolved_target = cgraph_lipo_get_resolved_node (callee->symbol.decl); - cgraph_redirect_edge_callee (e, resolved_target); + cgraph_redirect_edge_callee (e, callee); while (alias && alias != callee) { if (!alias->callers diff --git a/gcc-4_8/gcc/l-ipo.c b/gcc-4_8/gcc/l-ipo.c index a0f482668dd..bedbde0af9b 100644 --- a/gcc-4_8/gcc/l-ipo.c +++ b/gcc-4_8/gcc/l-ipo.c @@ -1552,6 +1552,18 @@ resolve_cgraph_node (struct cgraph_sym **slot, struct cgraph_node *node) } return; } + + /* Handle aliases properly. Make sure the alias symbol resolution + is consistent with alias target */ + if (node->alias && !node->thunk.thunk_p) + { + struct cgraph_node *decl2_tgt = cgraph_function_or_thunk_node (node, NULL); + if (cgraph_lipo_get_resolved_node_1 (decl2_tgt->symbol.decl, false) == decl2_tgt) + { + (*slot)->rep_node = node; + (*slot)->rep_decl = decl2; + } + } return; } @@ -1614,8 +1626,18 @@ cgraph_do_link (void) FOR_EACH_FUNCTION (node) { gcc_assert (!node->global.inlined_to); + /* Delay aliases */ + if (node->alias && !node->thunk.thunk_p) + continue; cgraph_link_node (node); } + + /* Now handle aliases */ + FOR_EACH_FUNCTION (node) + { + if (node->alias && !node->thunk.thunk_p) + cgraph_link_node (node); + } } struct promo_ent -- 2.11.4.GIT