diff mbox

Make direct emission of time profiler counter

Message ID a6cbb256-6df3-ed33-9c53-56f7d9bbba64@suse.cz
State New
Headers show

Commit Message

Martin Liška Nov. 4, 2016, 10:14 a.m. UTC
On 11/04/2016 10:18 AM, Christophe Lyon wrote:
> On 3 November 2016 at 16:11, Jan Hubicka <hubicka@ucw.cz> wrote:

>>>

>>> 2016-10-31  Martin Liska  <mliska@suse.cz>

>>>

>>>       * libgcov-profiler.c (__gcov_time_profiler): Remove.

>>>       (__gcov_time_profiler_atomic): Likewise.

>>>

>>> gcc/ChangeLog:

>>>

>>> 2016-10-31  Martin Liska  <mliska@suse.cz>

>>>

>>>       * profile.c (instrument_values): Fix coding style.

>>>       (branch_prob): Use renamed function.

>>>       * tree-profile.c (init_ic_make_global_vars): Likewise.

>>>       (gimple_init_edge_profiler): Rename to

>>>       gimple_init_gcov_profiler.

>>>       tree_time_profiler_counter variable declaration.

>>>       (gimple_gen_time_profiler): Rewrite to do a direct gimple code

>>>       emission.

>>>       * value-prof.h: Remove an argument.

>>>

>>> gcc/testsuite/ChangeLog:

>>>

>>> 2016-11-03  Martin Liska  <mliska@suse.cz>

>>>

>>>       * gcc.dg/no_profile_instrument_function-attr-1.c: Update scanned

>>>       output.

>>>       * gcc.dg/tree-prof/time-profiler-3.c: New test.

>>

>> OK,

>> Thanks!

>> Honza

> 

> Hi,

> 

> It seems this patch causes an ICE when compiling

> gcc.dg/gomp/pr27573.c

> for instance on arm-linux-gnueabi --wtih-cpu=cortex-a9


Hello.

Sorry for the breakage, I'm attaching untested patch which fixes that.
I'm going to trigger regression tests.

Martin

> 

> The backtrace is:

> /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/testsuite/gcc.dg/gomp/pr27573.c:

> In function 'main._omp_fn.0':

> /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/testsuite/gcc.dg/gomp/pr27573.c:12:9:

> internal compiler error: in convert_memory_address_addr_sp

> ace_1, at explow.c:284

> 0x79b19e convert_memory_address_addr_space_1(machine_mode, rtx_def*,

> unsigned char, bool, bool)

>         /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/explow.c:284

> 0x670903 get_builtin_sync_mem

>         /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/builtins.c:4933

> 0x671fef expand_builtin_atomic_fetch_op

>         /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/builtins.c:5452

> 0x674aa4 expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int)

>         /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/builtins.c:6859

> 0x7b729a expand_expr_real_1(tree_node*, rtx_def*, machine_mode,

> expand_modifier, rtx_def**, bool)

>         /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/expr.c:10773

> 0x7c1460 store_expr_with_bounds(tree_node*, rtx_def*, int, bool, bool,

> tree_node*)

>         /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/expr.c:5551

> 0x7c7451 expand_assignment(tree_node*, tree_node*, bool)

>         /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/expr.c:5317

> 0x69a0de expand_call_stmt

>         /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/cfgexpand.c:2666

> 0x69b264 expand_gimple_stmt_1

>         /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/cfgexpand.c:3581

> 0x69b264 expand_gimple_stmt

>         /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/cfgexpand.c:3747

> 0x69cc8a expand_gimple_basic_block

>         /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/cfgexpand.c:5754

> 0x69fefe execute

>         /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/cfgexpand.c:6368

> Please submit a full bug report,

> 

> Christophe

>

Comments

Martin Liška Nov. 4, 2016, 11:54 a.m. UTC | #1
On 11/04/2016 11:14 AM, Martin Liška wrote:
> Hello.

> 

> Sorry for the breakage, I'm attaching untested patch which fixes that.

> I'm going to trigger regression tests.

> 

> Martin


Regression tests have finished on ppc64le-redhat-linux.

Ready to be installed?
Martin
Jan Hubicka Nov. 5, 2016, 8:38 a.m. UTC | #2
> >From 531392d44eb195bd39cb49a169047f5bd898242f Mon Sep 17 00:00:00 2001

> From: marxin <mliska@suse.cz>

> Date: Fri, 4 Nov 2016 11:12:06 +0100

> Subject: [PATCH] time_profiler: Set proper type to time_profiler_counter_ptr.

> 

> gcc/ChangeLog:

> 

> 2016-11-04  Martin Liska  <mliska@suse.cz>

> 

> 	* tree-profile.c (gimple_gen_time_profiler): Set proper type

> 	to time_profiler_counter_ptr.


Looks OK if it passes.

Honza
> ---

>  gcc/tree-profile.c | 5 +++--

>  1 file changed, 3 insertions(+), 2 deletions(-)

> 

> diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c

> index 09a702f..d18b954 100644

> --- a/gcc/tree-profile.c

> +++ b/gcc/tree-profile.c

> @@ -489,8 +489,9 @@ gimple_gen_time_profiler (unsigned tag, unsigned base)

>    /* Emit: counters[0] = ++__gcov_time_profiler_counter.  */

>    if (flag_profile_update == PROFILE_UPDATE_ATOMIC)

>      {

> -      tree ptr = make_temp_ssa_name (type, NULL, "time_profiler_counter_ptr");

> -      tree addr = build1 (ADDR_EXPR, build_pointer_type (type),

> +      tree ptr = make_temp_ssa_name (build_pointer_type (type), NULL,

> +				     "time_profiler_counter_ptr");

> +      tree addr = build1 (ADDR_EXPR, TREE_TYPE (ptr),

>  			  tree_time_profiler_counter);

>        gassign *assign = gimple_build_assign (ptr, NOP_EXPR, addr);

>        gsi_insert_before (&gsi, assign, GSI_NEW_STMT);

> -- 

> 2.10.1

>
Martin Liška Nov. 7, 2016, 8:58 a.m. UTC | #3
On 11/05/2016 09:38 AM, Jan Hubicka wrote:
> Looks OK if it passes.

> 

> Honza


Thanks, fixed on trunk as r241894.
Martin
Christophe Lyon Nov. 7, 2016, 4:24 p.m. UTC | #4
On 7 November 2016 at 09:58, Martin Liška <mliska@suse.cz> wrote:
> On 11/05/2016 09:38 AM, Jan Hubicka wrote:

>> Looks OK if it passes.

>>

>> Honza

>

> Thanks, fixed on trunk as r241894.

> Martin


Thanks, this fixed the problems I reported.

Christophe
diff mbox

Patch

From 531392d44eb195bd39cb49a169047f5bd898242f Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Fri, 4 Nov 2016 11:12:06 +0100
Subject: [PATCH] time_profiler: Set proper type to time_profiler_counter_ptr.

gcc/ChangeLog:

2016-11-04  Martin Liska  <mliska@suse.cz>

	* tree-profile.c (gimple_gen_time_profiler): Set proper type
	to time_profiler_counter_ptr.
---
 gcc/tree-profile.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index 09a702f..d18b954 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -489,8 +489,9 @@  gimple_gen_time_profiler (unsigned tag, unsigned base)
   /* Emit: counters[0] = ++__gcov_time_profiler_counter.  */
   if (flag_profile_update == PROFILE_UPDATE_ATOMIC)
     {
-      tree ptr = make_temp_ssa_name (type, NULL, "time_profiler_counter_ptr");
-      tree addr = build1 (ADDR_EXPR, build_pointer_type (type),
+      tree ptr = make_temp_ssa_name (build_pointer_type (type), NULL,
+				     "time_profiler_counter_ptr");
+      tree addr = build1 (ADDR_EXPR, TREE_TYPE (ptr),
 			  tree_time_profiler_counter);
       gassign *assign = gimple_build_assign (ptr, NOP_EXPR, addr);
       gsi_insert_before (&gsi, assign, GSI_NEW_STMT);
-- 
2.10.1