diff options
Diffstat (limited to 'gcc/lto/lto.c')
-rw-r--r-- | gcc/lto/lto.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index 6ab7535..556e7e6 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -149,37 +149,36 @@ lto_materialize_function (struct cgraph_node *node) /* Clones don't need to be read. */ if (node->clone_of) return; - file_data = node->local.lto_file_data; - name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); - - /* We may have renamed the declaration, e.g., a static function. */ - name = lto_get_decl_name_mapping (file_data, name); - - data = lto_get_section_data (file_data, LTO_section_function_body, - name, &len); - if (!data) - fatal_error ("%s: section %s is missing", - file_data->file_name, - name); - - gcc_assert (DECL_STRUCT_FUNCTION (decl) == NULL); /* Load the function body only if not operating in WPA mode. In WPA mode, the body of the function is not needed. */ if (!flag_wpa) { + file_data = node->local.lto_file_data; + name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); + + /* We may have renamed the declaration, e.g., a static function. */ + name = lto_get_decl_name_mapping (file_data, name); + + data = lto_get_section_data (file_data, LTO_section_function_body, + name, &len); + if (!data) + fatal_error ("%s: section %s is missing", + file_data->file_name, + name); + + gcc_assert (DECL_STRUCT_FUNCTION (decl) == NULL); + allocate_struct_function (decl, false); announce_function (decl); lto_input_function_body (file_data, decl, data); if (DECL_FUNCTION_PERSONALITY (decl) && !first_personality_decl) first_personality_decl = DECL_FUNCTION_PERSONALITY (decl); lto_stats.num_function_bodies++; + lto_free_section_data (file_data, LTO_section_function_body, name, + data, len); + ggc_collect (); } - - lto_free_section_data (file_data, LTO_section_function_body, name, - data, len); - if (!flag_wpa) - ggc_collect (); } /* Let the middle end know about the function. */ @@ -200,7 +199,7 @@ lto_read_in_decl_state (struct data_in *data_in, const uint32_t *data, uint32_t i, j; ix = *data++; - decl = lto_streamer_cache_get (data_in->reader_cache, (int) ix); + decl = lto_streamer_cache_get (data_in->reader_cache, ix); if (TREE_CODE (decl) != FUNCTION_DECL) { gcc_assert (decl == void_type_node); |