diff options
author | Martin Liska <mliska@suse.cz> | 2018-10-04 14:41:14 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2018-10-04 12:41:14 +0000 |
commit | 3edbcdbead288664d874dd3a2e0d8ada4c565af0 (patch) | |
tree | e312a412289bc88a481440b075cfa23d7989e321 /libgcc | |
parent | 668f8d452697359a150bd651149c75109f66eb06 (diff) | |
download | gcc-3edbcdbead288664d874dd3a2e0d8ada4c565af0.zip gcc-3edbcdbead288664d874dd3a2e0d8ada4c565af0.tar.gz gcc-3edbcdbead288664d874dd3a2e0d8ada4c565af0.tar.bz2 |
Fix divergence in indirect profiling (PR gcov-profile/84107).
2018-10-04 Martin Liska <mliska@suse.cz>
PR gcov-profile/84107
* tree-profile.c (init_ic_make_global_vars):
Remove ic_void_ptr_var and ic_gcov_type_ptr_var.
Come up with new ic_tuple* variables. Emit
__gcov_indirect_call{,_topn} variables.
(gimple_gen_ic_profiler): Access the variable
and emit gimple.
(gimple_gen_ic_func_profiler): Access
__gcov_indirect_call.callee field.
(gimple_init_gcov_profiler): Use ptr_type_node.
* value-prof.c (gimple_ic): Use ptr_type_node.
2018-10-04 Martin Liska <mliska@suse.cz>
PR gcov-profile/84107
* libgcov-profiler.c (__gcov_indirect_call):
Change type to indirect_call_tuple.
(struct indirect_call_tuple): New struct.
(__gcov_indirect_call_topn_profiler): Change type.
(__gcov_indirect_call_profiler_v2): Use the new
variables.
* libgcov.h (struct indirect_call_tuple): New struct
definition.
From-SVN: r264840
Diffstat (limited to 'libgcc')
-rw-r--r-- | libgcc/ChangeLog | 12 | ||||
-rw-r--r-- | libgcc/libgcov-profiler.c | 25 | ||||
-rw-r--r-- | libgcc/libgcov.h | 9 |
3 files changed, 29 insertions, 17 deletions
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index d4abb3b..7987129 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,15 @@ +2018-10-04 Martin Liska <mliska@suse.cz> + + PR gcov-profile/84107 + * libgcov-profiler.c (__gcov_indirect_call): + Change type to indirect_call_tuple. + (struct indirect_call_tuple): New struct. + (__gcov_indirect_call_topn_profiler): Change type. + (__gcov_indirect_call_profiler_v2): Use the new + variables. + * libgcov.h (struct indirect_call_tuple): New struct + definition. + 2018-10-03 Uros Bizjak <ubizjak@gmail.com> * libgcc2.c (isnan): Use __builtin_isnan. diff --git a/libgcc/libgcov-profiler.c b/libgcc/libgcov-profiler.c index 7e208d7..7a5e500 100644 --- a/libgcc/libgcov-profiler.c +++ b/libgcc/libgcov-profiler.c @@ -271,12 +271,7 @@ __gcov_topn_value_profiler_body (gcov_type *counters, gcov_type value) #if defined(HAVE_CC_TLS) && !defined (USE_EMUTLS) __thread #endif -gcov_type *__gcov_indirect_call_topn_counters ATTRIBUTE_HIDDEN; - -#if defined(HAVE_CC_TLS) && !defined (USE_EMUTLS) -__thread -#endif -void *__gcov_indirect_call_topn_callee ATTRIBUTE_HIDDEN; +struct indirect_call_tuple __gcov_indirect_call_topn; #ifdef TARGET_VTABLE_USES_DESCRIPTORS #define VTABLE_USES_DESCRIPTORS 1 @@ -290,14 +285,14 @@ void *__gcov_indirect_call_topn_callee ATTRIBUTE_HIDDEN; void __gcov_indirect_call_topn_profiler (gcov_type value, void* cur_func) { - void *callee_func = __gcov_indirect_call_topn_callee; + void *callee_func = __gcov_indirect_call_topn.callee; /* If the C++ virtual tables contain function descriptors then one function may have multiple descriptors and we need to dereference the descriptors to see if they point to the same function. */ if (cur_func == callee_func || (VTABLE_USES_DESCRIPTORS && callee_func && *(void **) cur_func == *(void **) callee_func)) - __gcov_topn_value_profiler_body (__gcov_indirect_call_topn_counters, value); + __gcov_topn_value_profiler_body (__gcov_indirect_call_topn.counters, value); } #endif @@ -311,11 +306,7 @@ __gcov_indirect_call_topn_profiler (gcov_type value, void* cur_func) #if defined(HAVE_CC_TLS) && !defined (USE_EMUTLS) __thread #endif -void * __gcov_indirect_call_callee; -#if defined(HAVE_CC_TLS) && !defined (USE_EMUTLS) -__thread -#endif -gcov_type * __gcov_indirect_call_counters; +struct indirect_call_tuple __gcov_indirect_call; /* By default, the C++ compiler will use function addresses in the vtable entries. Setting TARGET_VTABLE_USES_DESCRIPTORS to nonzero @@ -332,12 +323,12 @@ __gcov_indirect_call_profiler_v2 (gcov_type value, void* cur_func) /* If the C++ virtual tables contain function descriptors then one function may have multiple descriptors and we need to dereference the descriptors to see if they point to the same function. */ - if (cur_func == __gcov_indirect_call_callee + if (cur_func == __gcov_indirect_call.callee || (__LIBGCC_VTABLE_USES_DESCRIPTORS__ - && *(void **) cur_func == *(void **) __gcov_indirect_call_callee)) - __gcov_one_value_profiler_body (__gcov_indirect_call_counters, value, 0); + && *(void **) cur_func == *(void **) __gcov_indirect_call.callee)) + __gcov_one_value_profiler_body (__gcov_indirect_call.counters, value, 0); - __gcov_indirect_call_callee = NULL; + __gcov_indirect_call.callee = NULL; } #endif diff --git a/libgcc/libgcov.h b/libgcc/libgcov.h index 2142287..ee05a68 100644 --- a/libgcc/libgcov.h +++ b/libgcc/libgcov.h @@ -226,6 +226,15 @@ struct gcov_master gcov_unsigned_t version; struct gcov_root *root; }; + +struct indirect_call_tuple +{ + /* Callee function. */ + void *callee; + + /* Pointer to counters. */ + gcov_type *counters; +}; /* Exactly one of these will be active in the process. */ extern struct gcov_master __gcov_master; |