aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/coverage.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/coverage.c')
-rw-r--r--gcc-4.9/gcc/coverage.c46
1 files changed, 37 insertions, 9 deletions
diff --git a/gcc-4.9/gcc/coverage.c b/gcc-4.9/gcc/coverage.c
index a7f183d0c..6b1d0d6cd 100644
--- a/gcc-4.9/gcc/coverage.c
+++ b/gcc-4.9/gcc/coverage.c
@@ -720,7 +720,18 @@ read_counts_file (const char *da_file_name, unsigned module_id)
return;
}
else
- return;
+ {
+ inform (input_location, "file %s not found, disabling profile use",
+ da_file_name);
+ set_profile_use_options (&global_options, &global_options_set,
+ false, true);
+ /* RESET is invoked during covrerage_init when process_options is done.
+ Need to reset optimization_default_node and optimization_current_node. */
+ /* Save the current optimization options. */
+ optimization_default_node = build_optimization_node (&global_options);
+ optimization_current_node = optimization_default_node;
+ return;
+ }
}
if (!gcov_magic (gcov_read_unsigned (), GCOV_DATA_MAGIC))
@@ -1023,7 +1034,10 @@ get_coverage_counts_entry (struct function *func, unsigned counter)
if (PARAM_VALUE (PARAM_PROFILE_FUNC_INTERNAL_ID))
elt.ident = FUNC_DECL_GLOBAL_ID (func);
else
- elt.ident = coverage_compute_profile_id (cgraph_get_node (func->decl));
+ {
+ gcc_assert (coverage_node_map_initialized_p ());
+ elt.ident = cgraph_get_node (func->decl)->profile_id;
+ }
elt.ctr = counter;
entry = counts_hash.find (&elt);
@@ -1131,7 +1145,10 @@ get_coverage_counts_no_warn (struct function *f, unsigned counter, unsigned *n_c
if (PARAM_VALUE (PARAM_PROFILE_FUNC_INTERNAL_ID))
elt.ident = FUNC_DECL_GLOBAL_ID (f);
else
- elt.ident = coverage_compute_profile_id (cgraph_get_node (f->decl));
+ {
+ gcc_assert (coverage_node_map_initialized_p ());
+ elt.ident = cgraph_get_node (f->decl)->profile_id;
+ }
elt.ctr = counter;
entry = counts_hash.find (&elt);
if (!entry)
@@ -1325,8 +1342,15 @@ coverage_compute_lineno_checksum (void)
/* Note: it is a bad design that C++ FE associate the convertion function type
with the name of the decl. This leads to cross contamination between different
conversion operators in different modules (If conv_type_names map is cleared
- at the end of parsing of each module). */
- if (flag_dyn_ipa && lang_hooks.user_conv_function_p (current_function_decl))
+ at the end of parsing of each module).
+
+ For LIPO always use the full mangled name to help disambiguate different
+ template instantiations. This is important for LIPO because we use the
+ checksums to identify matching copies of the same COMDAT to handle
+ missing profiles in the copies not selected by the linker, and to update
+ indirect call profiles when the target COMDAT is a copy that is not
+ in the module group. */
+ if (flag_dyn_ipa)
name = DECL_ASSEMBLER_NAME (current_function_decl);
else
name = DECL_NAME (current_function_decl);
@@ -1411,8 +1435,11 @@ coverage_begin_function (unsigned lineno_checksum, unsigned cfg_checksum)
if (PARAM_VALUE (PARAM_PROFILE_FUNC_INTERNAL_ID))
gcov_write_unsigned (FUNC_DECL_FUNC_ID (cfun));
else
- gcov_write_unsigned (coverage_compute_profile_id (
- cgraph_get_node (cfun->decl)));
+ {
+ gcc_assert (coverage_node_map_initialized_p ());
+ gcov_write_unsigned (
+ cgraph_get_node (current_function_decl)->profile_id);
+ }
gcov_write_unsigned (lineno_checksum);
gcov_write_unsigned (cfg_checksum);
@@ -1458,8 +1485,9 @@ coverage_end_function (unsigned lineno_checksum, unsigned cfg_checksum)
if (flag_dyn_ipa)
error ("param=profile-func-internal-id=0 is not"
" supported in LIPO mode. ");
- item->ident = coverage_compute_profile_id (
- cgraph_get_node (cfun->decl));
+ gcc_assert (coverage_node_map_initialized_p ());
+ item->ident = cgraph_get_node (cfun->decl)->profile_id;
+
}
item->lineno_checksum = lineno_checksum;
item->cfg_checksum = cfg_checksum;