summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2015-02-08 20:08:21 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2015-02-08 20:08:21 +0000
commit07f3273080a77f007b3634a4a46cbea0a18947bd (patch)
treef74e46cf83945e5d96a8c78c3d8cb1fd5c4fe28e
parent135f23d5d08f2ce5ceb7129d74a256942ac5ac35 (diff)
downloadgcc-07f3273080a77f007b3634a4a46cbea0a18947bd.tar.gz
PR ipa/63566
* cgraphunit.c (cgraph_node::analyze): Be sure target of thunk is aliases before trying to expand it. (cgraph_node::expand_thunk): Fix formating. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220518 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/cgraphunit.c21
2 files changed, 24 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 465c99945ab..7122413fc0e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2015-02-08 Jan Hubicka <hubicka@ucw.cz>
+
+ PR ipa/63566
+ * cgraphunit.c (cgraph_node::analyze): Be sure target of thunk is
+ aliases before trying to expand it.
+ (cgraph_node::expand_thunk): Fix formating.
+
2015-02-07 Sandra Loosemore <sandra@codesourcery.com>
* doc/extend.texi (Function Attributes [naked]): Copy-edit.
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 35b244e4b81..8280fc4a1a3 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -580,8 +580,19 @@ cgraph_node::analyze (void)
if (thunk.thunk_p)
{
- create_edge (cgraph_node::get (thunk.alias),
- NULL, 0, CGRAPH_FREQ_BASE);
+ cgraph_node *t = cgraph_node::get (thunk.alias);
+
+ create_edge (t, NULL, 0, CGRAPH_FREQ_BASE);
+ /* Target code in expand_thunk may need the thunk's target
+ to be analyzed, so recurse here. */
+ if (!t->analyzed)
+ t->analyze ();
+ if (t->alias)
+ {
+ t = t->get_alias_target ();
+ if (!t->analyzed)
+ t->analyze ();
+ }
if (!expand_thunk (false, false))
{
thunk.alias = NULL;
@@ -1515,7 +1526,8 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)
current_function_decl = thunk_fndecl;
/* Ensure thunks are emitted in their correct sections. */
- resolve_unique_section (thunk_fndecl, 0, flag_function_sections);
+ resolve_unique_section (thunk_fndecl, 0,
+ flag_function_sections);
DECL_RESULT (thunk_fndecl)
= build_decl (DECL_SOURCE_LOCATION (thunk_fndecl),
@@ -1568,7 +1580,8 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)
current_function_decl = thunk_fndecl;
/* Ensure thunks are emitted in their correct sections. */
- resolve_unique_section (thunk_fndecl, 0, flag_function_sections);
+ resolve_unique_section (thunk_fndecl, 0,
+ flag_function_sections);
DECL_IGNORED_P (thunk_fndecl) = 1;
bitmap_obstack_initialize (NULL);