public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Do not declare artificial variables in tree-profile.c to have a definition (PR lto/69188).
@ 2017-01-13 15:08 Martin Liška
  2017-01-13 17:21 ` Jeff Law
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Liška @ 2017-01-13 15:08 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jan Hubicka

[-- Attachment #1: Type: text/plain, Size: 578 bytes --]

Hello.

Nice example provided in the PR causes ICE as we have an artificial symbol
created in tree-profile.c once being removed by remove unreachable nodes (-O0)
and once not (-O1). Well, difference is in process_references where following hunk
prevent removal:

	      || (((before_inlining_p
		    && ((TREE_CODE (node->decl) != FUNCTION_DECL
			 && optimize)

Anyway, these artificial symbols really should be just declarations as they are defined
in libgcov library.

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?
Martin

[-- Attachment #2: 0001-Do-not-declare-artificial-variables-in-tree-profile..patch --]
[-- Type: text/x-patch, Size: 2800 bytes --]

From 87262b1b60009381fd943fb433bc38f5d5685ac9 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Fri, 13 Jan 2017 13:12:57 +0100
Subject: [PATCH] Do not declare artificial variables in tree-profile.c to have
 a definition (PR lto/69188).

gcc/testsuite/ChangeLog:

2017-01-13  Martin Liska  <mliska@suse.cz>

	PR lto/69188
	* gcc.dg/lto/pr69188_0.c: New test.
	* gcc.dg/lto/pr69188_1.c: New test.

gcc/ChangeLog:

2017-01-13  Martin Liska  <mliska@suse.cz>

	PR lto/69188
	* tree-profile.c (init_ic_make_global_vars): Do not call
	finalize_decl.
	(gimple_init_gcov_profiler): Likewise.
---
 gcc/testsuite/gcc.dg/lto/pr69188_0.c |  7 +++++++
 gcc/testsuite/gcc.dg/lto/pr69188_1.c | 10 ++++++++++
 gcc/tree-profile.c                   |  6 ------
 3 files changed, 17 insertions(+), 6 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/lto/pr69188_0.c
 create mode 100644 gcc/testsuite/gcc.dg/lto/pr69188_1.c

diff --git a/gcc/testsuite/gcc.dg/lto/pr69188_0.c b/gcc/testsuite/gcc.dg/lto/pr69188_0.c
new file mode 100644
index 00000000000..8bee874a65b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr69188_0.c
@@ -0,0 +1,7 @@
+/* PR ipa/69188 */
+/* { dg-lto-do link } */
+/* { dg-lto-options { { -flto -O0 -fprofile-generate } } } */
+
+void fn1(void) 
+{ 
+}
diff --git a/gcc/testsuite/gcc.dg/lto/pr69188_1.c b/gcc/testsuite/gcc.dg/lto/pr69188_1.c
new file mode 100644
index 00000000000..3ed9d5560c6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr69188_1.c
@@ -0,0 +1,10 @@
+/* PR ipa/69188 */
+/* { dg-options "-flto -O1 -fprofile-generate" } */
+
+extern void fn1(void);
+
+int main() {
+  fn1();
+  return 0;
+}
+
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index 186cfdf7929..a49ec37f8bb 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -94,8 +94,6 @@ init_ic_make_global_vars (void)
   if (targetm.have_tls)
     set_decl_tls_model (ic_void_ptr_var, decl_default_tls_model (ic_void_ptr_var));
 
-  varpool_node::finalize_decl (ic_void_ptr_var);
-
   gcov_type_ptr = build_pointer_type (get_gcov_type ());
 
   ic_gcov_type_ptr_var
@@ -112,8 +110,6 @@ init_ic_make_global_vars (void)
   DECL_INITIAL (ic_gcov_type_ptr_var) = NULL;
   if (targetm.have_tls)
     set_decl_tls_model (ic_gcov_type_ptr_var, decl_default_tls_model (ic_gcov_type_ptr_var));
-
-  varpool_node::finalize_decl (ic_gcov_type_ptr_var);
 }
 
 /* Create the type and function decls for the interface with gcov.  */
@@ -210,8 +206,6 @@ gimple_init_gcov_profiler (void)
       DECL_ARTIFICIAL (tree_time_profiler_counter) = 1;
       DECL_INITIAL (tree_time_profiler_counter) = NULL;
 
-      varpool_node::finalize_decl (tree_time_profiler_counter);
-
       /* void (*) (gcov_type *, gcov_type)  */
       average_profiler_fn_type
 	      = build_function_type_list (void_type_node,
-- 
2.11.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Do not declare artificial variables in tree-profile.c to have a definition (PR lto/69188).
  2017-01-13 15:08 [PATCH] Do not declare artificial variables in tree-profile.c to have a definition (PR lto/69188) Martin Liška
@ 2017-01-13 17:21 ` Jeff Law
  2017-01-20 10:11   ` Martin Liška
  2017-01-23 10:03   ` Christophe Lyon
  0 siblings, 2 replies; 8+ messages in thread
From: Jeff Law @ 2017-01-13 17:21 UTC (permalink / raw)
  To: Martin Liška, GCC Patches; +Cc: Jan Hubicka

On 01/13/2017 08:08 AM, Martin Liška wrote:
> Hello.
>
> Nice example provided in the PR causes ICE as we have an artificial symbol
> created in tree-profile.c once being removed by remove unreachable nodes (-O0)
> and once not (-O1). Well, difference is in process_references where following hunk
> prevent removal:
>
> 	      || (((before_inlining_p
> 		    && ((TREE_CODE (node->decl) != FUNCTION_DECL
> 			 && optimize)
>
> Anyway, these artificial symbols really should be just declarations as they are defined
> in libgcov library.
>
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>
> Ready to be installed?
> Martin
>
>
> 0001-Do-not-declare-artificial-variables-in-tree-profile..patch
>
>
> From 87262b1b60009381fd943fb433bc38f5d5685ac9 Mon Sep 17 00:00:00 2001
> From: marxin <mliska@suse.cz>
> Date: Fri, 13 Jan 2017 13:12:57 +0100
> Subject: [PATCH] Do not declare artificial variables in tree-profile.c to have
>  a definition (PR lto/69188).
>
> gcc/testsuite/ChangeLog:
>
> 2017-01-13  Martin Liska  <mliska@suse.cz>
>
> 	PR lto/69188
> 	* gcc.dg/lto/pr69188_0.c: New test.
> 	* gcc.dg/lto/pr69188_1.c: New test.
>
> gcc/ChangeLog:
>
> 2017-01-13  Martin Liska  <mliska@suse.cz>
>
> 	PR lto/69188
> 	* tree-profile.c (init_ic_make_global_vars): Do not call
> 	finalize_decl.
> 	(gimple_init_gcov_profiler): Likewise.
OK.
jeff

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Do not declare artificial variables in tree-profile.c to have a definition (PR lto/69188).
  2017-01-13 17:21 ` Jeff Law
@ 2017-01-20 10:11   ` Martin Liška
  2017-01-20 19:24     ` Jeff Law
  2017-01-23 10:03   ` Christophe Lyon
  1 sibling, 1 reply; 8+ messages in thread
From: Martin Liška @ 2017-01-20 10:11 UTC (permalink / raw)
  To: Jeff Law, GCC Patches; +Cc: Jan Hubicka

On 01/13/2017 06:21 PM, Jeff Law wrote:
> On 01/13/2017 08:08 AM, Martin Liška wrote:
>> Hello.
>>
>> Nice example provided in the PR causes ICE as we have an artificial symbol
>> created in tree-profile.c once being removed by remove unreachable nodes (-O0)
>> and once not (-O1). Well, difference is in process_references where following hunk
>> prevent removal:
>>
>>           || (((before_inlining_p
>>             && ((TREE_CODE (node->decl) != FUNCTION_DECL
>>              && optimize)
>>
>> Anyway, these artificial symbols really should be just declarations as they are defined
>> in libgcov library.
>>
>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>>
>> Ready to be installed?
>> Martin
>>
>>
>> 0001-Do-not-declare-artificial-variables-in-tree-profile..patch
>>
>>
>> From 87262b1b60009381fd943fb433bc38f5d5685ac9 Mon Sep 17 00:00:00 2001
>> From: marxin <mliska@suse.cz>
>> Date: Fri, 13 Jan 2017 13:12:57 +0100
>> Subject: [PATCH] Do not declare artificial variables in tree-profile.c to have
>>  a definition (PR lto/69188).
>>
>> gcc/testsuite/ChangeLog:
>>
>> 2017-01-13  Martin Liska  <mliska@suse.cz>
>>
>>     PR lto/69188
>>     * gcc.dg/lto/pr69188_0.c: New test.
>>     * gcc.dg/lto/pr69188_1.c: New test.
>>
>> gcc/ChangeLog:
>>
>> 2017-01-13  Martin Liska  <mliska@suse.cz>
>>
>>     PR lto/69188
>>     * tree-profile.c (init_ic_make_global_vars): Do not call
>>     finalize_decl.
>>     (gimple_init_gcov_profiler): Likewise.
> OK.
> jeff
> 

May I install the same patch to both active branches after it survives regression tests?

Thanks,
Martin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Do not declare artificial variables in tree-profile.c to have a definition (PR lto/69188).
  2017-01-20 10:11   ` Martin Liška
@ 2017-01-20 19:24     ` Jeff Law
  0 siblings, 0 replies; 8+ messages in thread
From: Jeff Law @ 2017-01-20 19:24 UTC (permalink / raw)
  To: Martin Liška, GCC Patches; +Cc: Jan Hubicka

On 01/20/2017 02:46 AM, Martin Liška wrote:
> On 01/13/2017 06:21 PM, Jeff Law wrote:
>> On 01/13/2017 08:08 AM, Martin Liška wrote:
>>> Hello.
>>>
>>> Nice example provided in the PR causes ICE as we have an artificial symbol
>>> created in tree-profile.c once being removed by remove unreachable nodes (-O0)
>>> and once not (-O1). Well, difference is in process_references where following hunk
>>> prevent removal:
>>>
>>>           || (((before_inlining_p
>>>             && ((TREE_CODE (node->decl) != FUNCTION_DECL
>>>              && optimize)
>>>
>>> Anyway, these artificial symbols really should be just declarations as they are defined
>>> in libgcov library.
>>>
>>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>>>
>>> Ready to be installed?
>>> Martin
>>>
>>>
>>> 0001-Do-not-declare-artificial-variables-in-tree-profile..patch
>>>
>>>
>>> From 87262b1b60009381fd943fb433bc38f5d5685ac9 Mon Sep 17 00:00:00 2001
>>> From: marxin <mliska@suse.cz>
>>> Date: Fri, 13 Jan 2017 13:12:57 +0100
>>> Subject: [PATCH] Do not declare artificial variables in tree-profile.c to have
>>>  a definition (PR lto/69188).
>>>
>>> gcc/testsuite/ChangeLog:
>>>
>>> 2017-01-13  Martin Liska  <mliska@suse.cz>
>>>
>>>     PR lto/69188
>>>     * gcc.dg/lto/pr69188_0.c: New test.
>>>     * gcc.dg/lto/pr69188_1.c: New test.
>>>
>>> gcc/ChangeLog:
>>>
>>> 2017-01-13  Martin Liska  <mliska@suse.cz>
>>>
>>>     PR lto/69188
>>>     * tree-profile.c (init_ic_make_global_vars): Do not call
>>>     finalize_decl.
>>>     (gimple_init_gcov_profiler): Likewise.
>> OK.
>> jeff
>>
>
> May I install the same patch to both active branches after it survives regression tests?
Yes.

jeff

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Do not declare artificial variables in tree-profile.c to have a definition (PR lto/69188).
  2017-01-13 17:21 ` Jeff Law
  2017-01-20 10:11   ` Martin Liška
@ 2017-01-23 10:03   ` Christophe Lyon
  2017-01-23 10:07     ` Kyrill Tkachov
  1 sibling, 1 reply; 8+ messages in thread
From: Christophe Lyon @ 2017-01-23 10:03 UTC (permalink / raw)
  To: Jeff Law; +Cc: Martin Liška, GCC Patches, Jan Hubicka

On 13 January 2017 at 18:21, Jeff Law <law@redhat.com> wrote:
> On 01/13/2017 08:08 AM, Martin Liška wrote:
>>
>> Hello.
>>
>> Nice example provided in the PR causes ICE as we have an artificial symbol
>> created in tree-profile.c once being removed by remove unreachable nodes
>> (-O0)
>> and once not (-O1). Well, difference is in process_references where
>> following hunk
>> prevent removal:
>>
>>               || (((before_inlining_p
>>                     && ((TREE_CODE (node->decl) != FUNCTION_DECL
>>                          && optimize)
>>
>> Anyway, these artificial symbols really should be just declarations as
>> they are defined
>> in libgcov library.
>>
>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>>
>> Ready to be installed?
>> Martin
>>
>>
>> 0001-Do-not-declare-artificial-variables-in-tree-profile..patch
>>
>>
>> From 87262b1b60009381fd943fb433bc38f5d5685ac9 Mon Sep 17 00:00:00 2001
>> From: marxin <mliska@suse.cz>
>> Date: Fri, 13 Jan 2017 13:12:57 +0100
>> Subject: [PATCH] Do not declare artificial variables in tree-profile.c to
>> have
>>  a definition (PR lto/69188).
>>
>> gcc/testsuite/ChangeLog:
>>
>> 2017-01-13  Martin Liska  <mliska@suse.cz>
>>
>>         PR lto/69188
>>         * gcc.dg/lto/pr69188_0.c: New test.
>>         * gcc.dg/lto/pr69188_1.c: New test.
>>
>> gcc/ChangeLog:
>>
>> 2017-01-13  Martin Liska  <mliska@suse.cz>
>>
>>         PR lto/69188
>>         * tree-profile.c (init_ic_make_global_vars): Do not call
>>         finalize_decl.
>>         (gimple_init_gcov_profiler): Likewise.
>
> OK.
> jeff
>

Hi,

The new test fails on arm-none-eabi:
/cc6RcpEu.ltrans0.ltrans.o: In function `fn1':
<artificial>:(.text+0x18): undefined reference to
`__gcov_indirect_call_profiler_v2'
<artificial>:(.text+0x1c): undefined reference to `__gcov_indirect_call_callee'
<artificial>:(.text+0x20): undefined reference to `__gcov_indirect_call_callee'
<artificial>:(.text+0x60): undefined reference to `__gcov_time_profiler_counter'
<artificial>:(.text+0x64): undefined reference to `__gcov_time_profiler_counter'
<artificial>:(.text+0x80): undefined reference to `__gcov_time_profiler_counter'
<artificial>:(.text+0x84): undefined reference to `__gcov_time_profiler_counter'
/cc6RcpEu.ltrans0.ltrans.o: In function `_GLOBAL__sub_D_00100_1_fn1':
<artificial>:(.text+0xb8): undefined reference to `__gcov_exit'
/cc6RcpEu.ltrans0.ltrans.o: In function `main':
<artificial>:(.text+0xd4): undefined reference to
`__gcov_indirect_call_profiler_v2'
<artificial>:(.text+0xd8): undefined reference to `__gcov_indirect_call_callee'
<artificial>:(.text+0xdc): undefined reference to `__gcov_indirect_call_callee'
<artificial>:(.text+0x10c): undefined reference to
`__gcov_time_profiler_counter'
<artificial>:(.text+0x110): undefined reference to
`__gcov_time_profiler_counter'
/cc6RcpEu.ltrans0.ltrans.o: In function `_GLOBAL__sub_D_00100_1_main':
<artificial>:(.text+0x180): undefined reference to `__gcov_exit'
/cc6RcpEu.ltrans0.ltrans.o:(.data+0x4c): undefined reference to
`__gcov_merge_time_profile'
/cc6RcpEu.ltrans0.ltrans.o:(.data+0xac): undefined reference to
`__gcov_merge_time_profile'
collect2: error: ld returned 1 exit status

FAIL: gcc.dg/lto/pr69188 c_lto_pr69188_0.o-c_lto_pr69188_1.o link,
-flto -O0 -fprofile-generate

It works on arm-linux*.

Christophe

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Do not declare artificial variables in tree-profile.c to have a definition (PR lto/69188).
  2017-01-23 10:03   ` Christophe Lyon
@ 2017-01-23 10:07     ` Kyrill Tkachov
  2017-01-23 11:17       ` Martin Liška
  2017-01-23 16:25       ` Jeff Law
  0 siblings, 2 replies; 8+ messages in thread
From: Kyrill Tkachov @ 2017-01-23 10:07 UTC (permalink / raw)
  To: Christophe Lyon, Jeff Law; +Cc: Martin Liška, GCC Patches, Jan Hubicka

[-- Attachment #1: Type: text/plain, Size: 3967 bytes --]


On 23/01/17 09:58, Christophe Lyon wrote:
> On 13 January 2017 at 18:21, Jeff Law <law@redhat.com> wrote:
>> On 01/13/2017 08:08 AM, Martin Liška wrote:
>>> Hello.
>>>
>>> Nice example provided in the PR causes ICE as we have an artificial symbol
>>> created in tree-profile.c once being removed by remove unreachable nodes
>>> (-O0)
>>> and once not (-O1). Well, difference is in process_references where
>>> following hunk
>>> prevent removal:
>>>
>>>                || (((before_inlining_p
>>>                      && ((TREE_CODE (node->decl) != FUNCTION_DECL
>>>                           && optimize)
>>>
>>> Anyway, these artificial symbols really should be just declarations as
>>> they are defined
>>> in libgcov library.
>>>
>>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>>>
>>> Ready to be installed?
>>> Martin
>>>
>>>
>>> 0001-Do-not-declare-artificial-variables-in-tree-profile..patch
>>>
>>>
>>>  From 87262b1b60009381fd943fb433bc38f5d5685ac9 Mon Sep 17 00:00:00 2001
>>> From: marxin <mliska@suse.cz>
>>> Date: Fri, 13 Jan 2017 13:12:57 +0100
>>> Subject: [PATCH] Do not declare artificial variables in tree-profile.c to
>>> have
>>>   a definition (PR lto/69188).
>>>
>>> gcc/testsuite/ChangeLog:
>>>
>>> 2017-01-13  Martin Liska  <mliska@suse.cz>
>>>
>>>          PR lto/69188
>>>          * gcc.dg/lto/pr69188_0.c: New test.
>>>          * gcc.dg/lto/pr69188_1.c: New test.
>>>
>>> gcc/ChangeLog:
>>>
>>> 2017-01-13  Martin Liska  <mliska@suse.cz>
>>>
>>>          PR lto/69188
>>>          * tree-profile.c (init_ic_make_global_vars): Do not call
>>>          finalize_decl.
>>>          (gimple_init_gcov_profiler): Likewise.
>> OK.
>> jeff
>>
> Hi,
>
> The new test fails on arm-none-eabi:
> /cc6RcpEu.ltrans0.ltrans.o: In function `fn1':
> <artificial>:(.text+0x18): undefined reference to
> `__gcov_indirect_call_profiler_v2'
> <artificial>:(.text+0x1c): undefined reference to `__gcov_indirect_call_callee'
> <artificial>:(.text+0x20): undefined reference to `__gcov_indirect_call_callee'
> <artificial>:(.text+0x60): undefined reference to `__gcov_time_profiler_counter'
> <artificial>:(.text+0x64): undefined reference to `__gcov_time_profiler_counter'
> <artificial>:(.text+0x80): undefined reference to `__gcov_time_profiler_counter'
> <artificial>:(.text+0x84): undefined reference to `__gcov_time_profiler_counter'
> /cc6RcpEu.ltrans0.ltrans.o: In function `_GLOBAL__sub_D_00100_1_fn1':
> <artificial>:(.text+0xb8): undefined reference to `__gcov_exit'
> /cc6RcpEu.ltrans0.ltrans.o: In function `main':
> <artificial>:(.text+0xd4): undefined reference to
> `__gcov_indirect_call_profiler_v2'
> <artificial>:(.text+0xd8): undefined reference to `__gcov_indirect_call_callee'
> <artificial>:(.text+0xdc): undefined reference to `__gcov_indirect_call_callee'
> <artificial>:(.text+0x10c): undefined reference to
> `__gcov_time_profiler_counter'
> <artificial>:(.text+0x110): undefined reference to
> `__gcov_time_profiler_counter'
> /cc6RcpEu.ltrans0.ltrans.o: In function `_GLOBAL__sub_D_00100_1_main':
> <artificial>:(.text+0x180): undefined reference to `__gcov_exit'
> /cc6RcpEu.ltrans0.ltrans.o:(.data+0x4c): undefined reference to
> `__gcov_merge_time_profile'
> /cc6RcpEu.ltrans0.ltrans.o:(.data+0xac): undefined reference to
> `__gcov_merge_time_profile'
> collect2: error: ld returned 1 exit status
>
> FAIL: gcc.dg/lto/pr69188 c_lto_pr69188_0.o-c_lto_pr69188_1.o link,
> -flto -O0 -fprofile-generate
>
> It works on arm-linux*.

Hi,

The testcase fails on bare-metal targets that don't support profiling.
I believe it needs to be guarded with dg-require-profiling (I grepped around the testsuite for similar directives).
With this patch the testcase appears unsupported on aarch64-none-elf where I observed the failure.

Ok to commit?

Thanks,
Kyrill

2016-01-23  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * gcc.dg/lto/pr69188_0.c: Require profiling support for testcase.


> Christophe


[-- Attachment #2: lto-prof.patch --]
[-- Type: text/x-patch, Size: 406 bytes --]

diff --git a/gcc/testsuite/gcc.dg/lto/pr69188_0.c b/gcc/testsuite/gcc.dg/lto/pr69188_0.c
index 8bee874..a0b6ad9 100644
--- a/gcc/testsuite/gcc.dg/lto/pr69188_0.c
+++ b/gcc/testsuite/gcc.dg/lto/pr69188_0.c
@@ -1,6 +1,7 @@
 /* PR ipa/69188 */
 /* { dg-lto-do link } */
 /* { dg-lto-options { { -flto -O0 -fprofile-generate } } } */
+/* { dg-require-profiling "-fprofile-generate" } */
 
 void fn1(void) 
 { 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Do not declare artificial variables in tree-profile.c to have a definition (PR lto/69188).
  2017-01-23 10:07     ` Kyrill Tkachov
@ 2017-01-23 11:17       ` Martin Liška
  2017-01-23 16:25       ` Jeff Law
  1 sibling, 0 replies; 8+ messages in thread
From: Martin Liška @ 2017-01-23 11:17 UTC (permalink / raw)
  To: Kyrill Tkachov, Christophe Lyon, Jeff Law; +Cc: GCC Patches, Jan Hubicka

On 01/23/2017 11:05 AM, Kyrill Tkachov wrote:
> 
> On 23/01/17 09:58, Christophe Lyon wrote:
>> On 13 January 2017 at 18:21, Jeff Law <law@redhat.com> wrote:
>>> On 01/13/2017 08:08 AM, Martin Liška wrote:
>>>> Hello.
>>>>
>>>> Nice example provided in the PR causes ICE as we have an artificial symbol
>>>> created in tree-profile.c once being removed by remove unreachable nodes
>>>> (-O0)
>>>> and once not (-O1). Well, difference is in process_references where
>>>> following hunk
>>>> prevent removal:
>>>>
>>>>                || (((before_inlining_p
>>>>                      && ((TREE_CODE (node->decl) != FUNCTION_DECL
>>>>                           && optimize)
>>>>
>>>> Anyway, these artificial symbols really should be just declarations as
>>>> they are defined
>>>> in libgcov library.
>>>>
>>>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>>>>
>>>> Ready to be installed?
>>>> Martin
>>>>
>>>>
>>>> 0001-Do-not-declare-artificial-variables-in-tree-profile..patch
>>>>
>>>>
>>>>  From 87262b1b60009381fd943fb433bc38f5d5685ac9 Mon Sep 17 00:00:00 2001
>>>> From: marxin <mliska@suse.cz>
>>>> Date: Fri, 13 Jan 2017 13:12:57 +0100
>>>> Subject: [PATCH] Do not declare artificial variables in tree-profile.c to
>>>> have
>>>>   a definition (PR lto/69188).
>>>>
>>>> gcc/testsuite/ChangeLog:
>>>>
>>>> 2017-01-13  Martin Liska  <mliska@suse.cz>
>>>>
>>>>          PR lto/69188
>>>>          * gcc.dg/lto/pr69188_0.c: New test.
>>>>          * gcc.dg/lto/pr69188_1.c: New test.
>>>>
>>>> gcc/ChangeLog:
>>>>
>>>> 2017-01-13  Martin Liska  <mliska@suse.cz>
>>>>
>>>>          PR lto/69188
>>>>          * tree-profile.c (init_ic_make_global_vars): Do not call
>>>>          finalize_decl.
>>>>          (gimple_init_gcov_profiler): Likewise.
>>> OK.
>>> jeff
>>>
>> Hi,
>>
>> The new test fails on arm-none-eabi:
>> /cc6RcpEu.ltrans0.ltrans.o: In function `fn1':
>> <artificial>:(.text+0x18): undefined reference to
>> `__gcov_indirect_call_profiler_v2'
>> <artificial>:(.text+0x1c): undefined reference to `__gcov_indirect_call_callee'
>> <artificial>:(.text+0x20): undefined reference to `__gcov_indirect_call_callee'
>> <artificial>:(.text+0x60): undefined reference to `__gcov_time_profiler_counter'
>> <artificial>:(.text+0x64): undefined reference to `__gcov_time_profiler_counter'
>> <artificial>:(.text+0x80): undefined reference to `__gcov_time_profiler_counter'
>> <artificial>:(.text+0x84): undefined reference to `__gcov_time_profiler_counter'
>> /cc6RcpEu.ltrans0.ltrans.o: In function `_GLOBAL__sub_D_00100_1_fn1':
>> <artificial>:(.text+0xb8): undefined reference to `__gcov_exit'
>> /cc6RcpEu.ltrans0.ltrans.o: In function `main':
>> <artificial>:(.text+0xd4): undefined reference to
>> `__gcov_indirect_call_profiler_v2'
>> <artificial>:(.text+0xd8): undefined reference to `__gcov_indirect_call_callee'
>> <artificial>:(.text+0xdc): undefined reference to `__gcov_indirect_call_callee'
>> <artificial>:(.text+0x10c): undefined reference to
>> `__gcov_time_profiler_counter'
>> <artificial>:(.text+0x110): undefined reference to
>> `__gcov_time_profiler_counter'
>> /cc6RcpEu.ltrans0.ltrans.o: In function `_GLOBAL__sub_D_00100_1_main':
>> <artificial>:(.text+0x180): undefined reference to `__gcov_exit'
>> /cc6RcpEu.ltrans0.ltrans.o:(.data+0x4c): undefined reference to
>> `__gcov_merge_time_profile'
>> /cc6RcpEu.ltrans0.ltrans.o:(.data+0xac): undefined reference to
>> `__gcov_merge_time_profile'
>> collect2: error: ld returned 1 exit status
>>
>> FAIL: gcc.dg/lto/pr69188 c_lto_pr69188_0.o-c_lto_pr69188_1.o link,
>> -flto -O0 -fprofile-generate
>>
>> It works on arm-linux*.
> 
> Hi,
> 
> The testcase fails on bare-metal targets that don't support profiling.
> I believe it needs to be guarded with dg-require-profiling (I grepped around the testsuite for similar directives).
> With this patch the testcase appears unsupported on aarch64-none-elf where I observed the failure.
> 
> Ok to commit?
> 
> Thanks,
> Kyrill

Hi Kyrill.

Thanks for the patch.

Martin

> 
> 2016-01-23  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
> 
>     * gcc.dg/lto/pr69188_0.c: Require profiling support for testcase.
> 
> 
>> Christophe
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Do not declare artificial variables in tree-profile.c to have a definition (PR lto/69188).
  2017-01-23 10:07     ` Kyrill Tkachov
  2017-01-23 11:17       ` Martin Liška
@ 2017-01-23 16:25       ` Jeff Law
  1 sibling, 0 replies; 8+ messages in thread
From: Jeff Law @ 2017-01-23 16:25 UTC (permalink / raw)
  To: Kyrill Tkachov, Christophe Lyon
  Cc: Martin Liška, GCC Patches, Jan Hubicka

On 01/23/2017 03:05 AM, Kyrill Tkachov wrote:
>
> On 23/01/17 09:58, Christophe Lyon wrote:
>> On 13 January 2017 at 18:21, Jeff Law <law@redhat.com> wrote:
>>> On 01/13/2017 08:08 AM, Martin Liška wrote:
>>>> Hello.
>>>>
>>>> Nice example provided in the PR causes ICE as we have an artificial
>>>> symbol
>>>> created in tree-profile.c once being removed by remove unreachable
>>>> nodes
>>>> (-O0)
>>>> and once not (-O1). Well, difference is in process_references where
>>>> following hunk
>>>> prevent removal:
>>>>
>>>>                || (((before_inlining_p
>>>>                      && ((TREE_CODE (node->decl) != FUNCTION_DECL
>>>>                           && optimize)
>>>>
>>>> Anyway, these artificial symbols really should be just declarations as
>>>> they are defined
>>>> in libgcov library.
>>>>
>>>> Patch can bootstrap on ppc64le-redhat-linux and survives regression
>>>> tests.
>>>>
>>>> Ready to be installed?
>>>> Martin
>>>>
>>>>
>>>> 0001-Do-not-declare-artificial-variables-in-tree-profile..patch
>>>>
>>>>
>>>>  From 87262b1b60009381fd943fb433bc38f5d5685ac9 Mon Sep 17 00:00:00 2001
>>>> From: marxin <mliska@suse.cz>
>>>> Date: Fri, 13 Jan 2017 13:12:57 +0100
>>>> Subject: [PATCH] Do not declare artificial variables in
>>>> tree-profile.c to
>>>> have
>>>>   a definition (PR lto/69188).
>>>>
>>>> gcc/testsuite/ChangeLog:
>>>>
>>>> 2017-01-13  Martin Liska  <mliska@suse.cz>
>>>>
>>>>          PR lto/69188
>>>>          * gcc.dg/lto/pr69188_0.c: New test.
>>>>          * gcc.dg/lto/pr69188_1.c: New test.
>>>>
>>>> gcc/ChangeLog:
>>>>
>>>> 2017-01-13  Martin Liska  <mliska@suse.cz>
>>>>
>>>>          PR lto/69188
>>>>          * tree-profile.c (init_ic_make_global_vars): Do not call
>>>>          finalize_decl.
>>>>          (gimple_init_gcov_profiler): Likewise.
>>> OK.
>>> jeff
>>>
>> Hi,
>>
>> The new test fails on arm-none-eabi:
>> /cc6RcpEu.ltrans0.ltrans.o: In function `fn1':
>> <artificial>:(.text+0x18): undefined reference to
>> `__gcov_indirect_call_profiler_v2'
>> <artificial>:(.text+0x1c): undefined reference to
>> `__gcov_indirect_call_callee'
>> <artificial>:(.text+0x20): undefined reference to
>> `__gcov_indirect_call_callee'
>> <artificial>:(.text+0x60): undefined reference to
>> `__gcov_time_profiler_counter'
>> <artificial>:(.text+0x64): undefined reference to
>> `__gcov_time_profiler_counter'
>> <artificial>:(.text+0x80): undefined reference to
>> `__gcov_time_profiler_counter'
>> <artificial>:(.text+0x84): undefined reference to
>> `__gcov_time_profiler_counter'
>> /cc6RcpEu.ltrans0.ltrans.o: In function `_GLOBAL__sub_D_00100_1_fn1':
>> <artificial>:(.text+0xb8): undefined reference to `__gcov_exit'
>> /cc6RcpEu.ltrans0.ltrans.o: In function `main':
>> <artificial>:(.text+0xd4): undefined reference to
>> `__gcov_indirect_call_profiler_v2'
>> <artificial>:(.text+0xd8): undefined reference to
>> `__gcov_indirect_call_callee'
>> <artificial>:(.text+0xdc): undefined reference to
>> `__gcov_indirect_call_callee'
>> <artificial>:(.text+0x10c): undefined reference to
>> `__gcov_time_profiler_counter'
>> <artificial>:(.text+0x110): undefined reference to
>> `__gcov_time_profiler_counter'
>> /cc6RcpEu.ltrans0.ltrans.o: In function `_GLOBAL__sub_D_00100_1_main':
>> <artificial>:(.text+0x180): undefined reference to `__gcov_exit'
>> /cc6RcpEu.ltrans0.ltrans.o:(.data+0x4c): undefined reference to
>> `__gcov_merge_time_profile'
>> /cc6RcpEu.ltrans0.ltrans.o:(.data+0xac): undefined reference to
>> `__gcov_merge_time_profile'
>> collect2: error: ld returned 1 exit status
>>
>> FAIL: gcc.dg/lto/pr69188 c_lto_pr69188_0.o-c_lto_pr69188_1.o link,
>> -flto -O0 -fprofile-generate
>>
>> It works on arm-linux*.
>
> Hi,
>
> The testcase fails on bare-metal targets that don't support profiling.
> I believe it needs to be guarded with dg-require-profiling (I grepped
> around the testsuite for similar directives).
> With this patch the testcase appears unsupported on aarch64-none-elf
> where I observed the failure.
>
> Ok to commit?
>
> Thanks,
> Kyrill
>
> 2016-01-23  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>
>     * gcc.dg/lto/pr69188_0.c: Require profiling support for testcase.
OK.
jeff

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-01-23 16:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-13 15:08 [PATCH] Do not declare artificial variables in tree-profile.c to have a definition (PR lto/69188) Martin Liška
2017-01-13 17:21 ` Jeff Law
2017-01-20 10:11   ` Martin Liška
2017-01-20 19:24     ` Jeff Law
2017-01-23 10:03   ` Christophe Lyon
2017-01-23 10:07     ` Kyrill Tkachov
2017-01-23 11:17       ` Martin Liška
2017-01-23 16:25       ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).