public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Question on -fopt-info-inline
@ 2018-07-03 16:01 Qing Zhao
  2018-07-03 16:49 ` Richard Biener
  0 siblings, 1 reply; 11+ messages in thread
From: Qing Zhao @ 2018-07-03 16:01 UTC (permalink / raw)
  To: gcc

Hi,

In order to collect complete information on all the inlining transformation that GCC applies on a given program,
I searched online, and found that the option -fopt-info-inline might be the right option to use:

https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html <https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html>

in which, it mentioned:

"As another example,
gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
outputs information about missed optimizations as well as optimized locations from all the inlining passes into inline.txt. 

“

Then I checked a very small testcase with GCC9 as following:

[qinzhao@localhost inline_report]$ cat inline_1.c
static int foo (int a)
{
  return a + 10;
}

static int bar (int b)
{
  return b - 20;
}

static int boo (int a, int b)
{
  return foo (a) + bar (b);
}

extern int v_a, v_b;
extern int result;

int compute ()
{
  result = boo (v_a, v_b);
  return result; 
}

[qinzhao@localhost inline_report]$ /home/qinzhao/Install/latest/bin/gcc -O3 -fopt-info-inline-optimized-missed=inline.txt inline_1.c -S
[qinzhao@localhost inline_report]$ ls -l inline.txt
-rw-rw-r--. 1 qinzhao qinzhao 0 Jul  3 11:25 inline.txt
[qinzhao@localhost inline_report]$ cat inline_1.s
	.file	"inline_1.c"
	.text
	.p2align 4,,15
	.globl	compute
	.type	compute, @function
compute:
.LFB3:
	.cfi_startproc
	movl	v_a(%rip), %edx
	movl	v_b(%rip), %eax
	leal	-10(%rdx,%rax), %eax
	movl	%eax, result(%rip)
	ret
	.cfi_endproc
.LFE3:
	.size	compute, .-compute
	.ident	"GCC: (GNU) 9.0.0 20180702 (experimental)"
	.section	.note.GNU-stack,"",@progbits

From the above, we can see:
1. the call chains to —>“boo”->”foo”, “bar” in the routine “compute” are completely inlined into “compute”;
2. However, there is NO any inline information is dumped into “inline.txt”.


So, My questions are:

1. Is the option -fopt-info-inline  the right option to use to get the complete inlining transformation info from GCC?
2. is this a bug that the current -fopt-info-inline cannot dump anything for this testing case?


Thanks a lot for your help.

Qing

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

* Re: Question on -fopt-info-inline
  2018-07-03 16:01 Question on -fopt-info-inline Qing Zhao
@ 2018-07-03 16:49 ` Richard Biener
  2018-07-03 17:32   ` Qing Zhao
  0 siblings, 1 reply; 11+ messages in thread
From: Richard Biener @ 2018-07-03 16:49 UTC (permalink / raw)
  To: gcc, Qing Zhao

On July 3, 2018 6:01:19 PM GMT+02:00, Qing Zhao <qing.zhao@oracle.com> wrote:
>Hi,
>
>In order to collect complete information on all the inlining
>transformation that GCC applies on a given program,
>I searched online, and found that the option -fopt-info-inline might be
>the right option to use:
>
>https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html
><https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html>
>
>in which, it mentioned:
>
>"As another example,
>gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
>outputs information about missed optimizations as well as optimized
>locations from all the inlining passes into inline.txt. 
>
>“
>
>Then I checked a very small testcase with GCC9 as following:
>
>[qinzhao@localhost inline_report]$ cat inline_1.c
>static int foo (int a)
>{
>  return a + 10;
>}
>
>static int bar (int b)
>{
>  return b - 20;
>}
>
>static int boo (int a, int b)
>{
>  return foo (a) + bar (b);
>}
>
>extern int v_a, v_b;
>extern int result;
>
>int compute ()
>{
>  result = boo (v_a, v_b);
>  return result; 
>}
>
>[qinzhao@localhost inline_report]$ /home/qinzhao/Install/latest/bin/gcc
>-O3 -fopt-info-inline-optimized-missed=inline.txt inline_1.c -S
>[qinzhao@localhost inline_report]$ ls -l inline.txt
>-rw-rw-r--. 1 qinzhao qinzhao 0 Jul  3 11:25 inline.txt
>[qinzhao@localhost inline_report]$ cat inline_1.s
>	.file	"inline_1.c"
>	.text
>	.p2align 4,,15
>	.globl	compute
>	.type	compute, @function
>compute:
>.LFB3:
>	.cfi_startproc
>	movl	v_a(%rip), %edx
>	movl	v_b(%rip), %eax
>	leal	-10(%rdx,%rax), %eax
>	movl	%eax, result(%rip)
>	ret
>	.cfi_endproc
>.LFE3:
>	.size	compute, .-compute
>	.ident	"GCC: (GNU) 9.0.0 20180702 (experimental)"
>	.section	.note.GNU-stack,"",@progbits
>
From the above, we can see:
>1. the call chains to —>“boo”->”foo”, “bar” in the routine “compute”
>are completely inlined into “compute”;
>2. However, there is NO any inline information is dumped into
>“inline.txt”.
>
>
>So, My questions are:
>
>1. Is the option -fopt-info-inline  the right option to use to get the
>complete inlining transformation info from GCC?
>2. is this a bug that the current -fopt-info-inline cannot dump
>anything for this testing case?

I think the early inliner doesn't use opt-info yet. 

Richard. 

>
>Thanks a lot for your help.
>
>Qing

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

* Re: Question on -fopt-info-inline
  2018-07-03 16:49 ` Richard Biener
@ 2018-07-03 17:32   ` Qing Zhao
  2018-07-03 18:28     ` Qing Zhao
  0 siblings, 1 reply; 11+ messages in thread
From: Qing Zhao @ 2018-07-03 17:32 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc


> On Jul 3, 2018, at 11:48 AM, Richard Biener <richard.guenther@gmail.com> wrote:
> 
> On July 3, 2018 6:01:19 PM GMT+02:00, Qing Zhao <qing.zhao@oracle.com <mailto:qing.zhao@oracle.com>> wrote:
>> Hi,
>> 
>> In order to collect complete information on all the inlining
>> transformation that GCC applies on a given program,
>> I searched online, and found that the option -fopt-info-inline might be
>> the right option to use:
>> 
>> https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html <https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html>
>> <https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html <https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html>>
>> 
>> in which, it mentioned:
>> 
>> "As another example,
>> gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
>> outputs information about missed optimizations as well as optimized
>> locations from all the inlining passes into inline.txt. 
>> 
>> “
>> 
>> Then I checked a very small testcase with GCC9 as following:
>> 
>> [qinzhao@localhost inline_report]$ cat inline_1.c
>> static int foo (int a)
>> {
>> return a + 10;
>> }
>> 
>> static int bar (int b)
>> {
>> return b - 20;
>> }
>> 
>> static int boo (int a, int b)
>> {
>> return foo (a) + bar (b);
>> }
>> 
>> extern int v_a, v_b;
>> extern int result;
>> 
>> int compute ()
>> {
>> result = boo (v_a, v_b);
>> return result; 
>> }
>> 
>> [qinzhao@localhost inline_report]$ /home/qinzhao/Install/latest/bin/gcc
>> -O3 -fopt-info-inline-optimized-missed=inline.txt inline_1.c -S
>> [qinzhao@localhost inline_report]$ ls -l inline.txt
>> -rw-rw-r--. 1 qinzhao qinzhao 0 Jul  3 11:25 inline.txt
>> [qinzhao@localhost inline_report]$ cat inline_1.s
>> 	.file	"inline_1.c"
>> 	.text
>> 	.p2align 4,,15
>> 	.globl	compute
>> 	.type	compute, @function
>> compute:
>> .LFB3:
>> 	.cfi_startproc
>> 	movl	v_a(%rip), %edx
>> 	movl	v_b(%rip), %eax
>> 	leal	-10(%rdx,%rax), %eax
>> 	movl	%eax, result(%rip)
>> 	ret
>> 	.cfi_endproc
>> .LFE3:
>> 	.size	compute, .-compute
>> 	.ident	"GCC: (GNU) 9.0.0 20180702 (experimental)"
>> 	.section	.note.GNU-stack,"",@progbits
>> 
>> From the above, we can see:
>> 1. the call chains to —>“boo”->”foo”, “bar” in the routine “compute”
>> are completely inlined into “compute”;
>> 2. However, there is NO any inline information is dumped into
>> “inline.txt”.
>> 
>> 
>> So, My questions are:
>> 
>> 1. Is the option -fopt-info-inline  the right option to use to get the
>> complete inlining transformation info from GCC?
>> 2. is this a bug that the current -fopt-info-inline cannot dump
>> anything for this testing case?
> 
> I think the early inliner doesn't use opt-info yet. 

so, shall we add the opt-info support to early inliner?

Qing
> 
> Richard. 
> 
>> 
>> Thanks a lot for your help.
>> 
>> Qing

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

* Re: Question on -fopt-info-inline
  2018-07-03 17:32   ` Qing Zhao
@ 2018-07-03 18:28     ` Qing Zhao
  2018-07-04  0:19       ` Jeff Law
  0 siblings, 1 reply; 11+ messages in thread
From: Qing Zhao @ 2018-07-03 18:28 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc


>> 
>>> 
>>> In order to collect complete information on all the inlining
>>> transformation that GCC applies on a given program,
>>> I searched online, and found that the option -fopt-info-inline might be
>>> the right option to use:
>>> 
>>> https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html <https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html> <https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html <https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html>>
>>> <https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html <https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html>>
>>> 
>>> in which, it mentioned:
>>> 
>>> "As another example,
>>> gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
>>> outputs information about missed optimizations as well as optimized
>>> locations from all the inlining passes into inline.txt. 
>>> 
>>> “
>>> 
>>> Then I checked a very small testcase with GCC9 as following:
>>> 
>>> [qinzhao@localhost inline_report]$ cat inline_1.c
>>> static int foo (int a)
>>> {
>>> return a + 10;
>>> }
>>> 
>>> static int bar (int b)
>>> {
>>> return b - 20;
>>> }
>>> 
>>> static int boo (int a, int b)
>>> {
>>> return foo (a) + bar (b);
>>> }
>>> 
>>> extern int v_a, v_b;
>>> extern int result;
>>> 
>>> int compute ()
>>> {
>>> result = boo (v_a, v_b);
>>> return result; 
>>> }
>>> 
>>> [qinzhao@localhost inline_report]$ /home/qinzhao/Install/latest/bin/gcc
>>> -O3 -fopt-info-inline-optimized-missed=inline.txt inline_1.c -S
>>> [qinzhao@localhost inline_report]$ ls -l inline.txt
>>> -rw-rw-r--. 1 qinzhao qinzhao 0 Jul  3 11:25 inline.txt
>>> [qinzhao@localhost inline_report]$ cat inline_1.s
>>> 	.file	"inline_1.c"
>>> 	.text
>>> 	.p2align 4,,15
>>> 	.globl	compute
>>> 	.type	compute, @function
>>> compute:
>>> .LFB3:
>>> 	.cfi_startproc
>>> 	movl	v_a(%rip), %edx
>>> 	movl	v_b(%rip), %eax
>>> 	leal	-10(%rdx,%rax), %eax
>>> 	movl	%eax, result(%rip)
>>> 	ret
>>> 	.cfi_endproc
>>> .LFE3:
>>> 	.size	compute, .-compute
>>> 	.ident	"GCC: (GNU) 9.0.0 20180702 (experimental)"
>>> 	.section	.note.GNU-stack,"",@progbits
>>> 
>>> From the above, we can see:
>>> 1. the call chains to —>“boo”->”foo”, “bar” in the routine “compute”
>>> are completely inlined into “compute”;
>>> 2. However, there is NO any inline information is dumped into
>>> “inline.txt”.
>>> 
>>> 
>>> So, My questions are:
>>> 
>>> 1. Is the option -fopt-info-inline  the right option to use to get the
>>> complete inlining transformation info from GCC?
>>> 2. is this a bug that the current -fopt-info-inline cannot dump
>>> anything for this testing case?
>> 
>> I think the early inliner doesn't use opt-info yet. 
> 
> so, shall we add the opt-info support to early inliner?

I just created the following PR to record this work:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86395 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86395>

let me know if I missed anything.

thanks.

Qing


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

* Re: Question on -fopt-info-inline
  2018-07-03 18:28     ` Qing Zhao
@ 2018-07-04  0:19       ` Jeff Law
  2018-07-05 15:28         ` Qing Zhao
  0 siblings, 1 reply; 11+ messages in thread
From: Jeff Law @ 2018-07-04  0:19 UTC (permalink / raw)
  To: Qing Zhao, Richard Biener; +Cc: gcc

On 07/03/2018 12:28 PM, Qing Zhao wrote:
> 
>>>
>>>>
>>>> In order to collect complete information on all the inlining
>>>> transformation that GCC applies on a given program,
>>>> I searched online, and found that the option -fopt-info-inline might be
>>>> the right option to use:
>>>>
>>>> https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html <https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html> <https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html <https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html>>
>>>> <https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html <https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html>>
>>>>
>>>> in which, it mentioned:
>>>>
>>>> "As another example,
>>>> gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
>>>> outputs information about missed optimizations as well as optimized
>>>> locations from all the inlining passes into inline.txt. 
>>>>
>>>> “
>>>>
>>>> Then I checked a very small testcase with GCC9 as following:
>>>>
>>>> [qinzhao@localhost inline_report]$ cat inline_1.c
>>>> static int foo (int a)
>>>> {
>>>> return a + 10;
>>>> }
>>>>
>>>> static int bar (int b)
>>>> {
>>>> return b - 20;
>>>> }
>>>>
>>>> static int boo (int a, int b)
>>>> {
>>>> return foo (a) + bar (b);
>>>> }
>>>>
>>>> extern int v_a, v_b;
>>>> extern int result;
>>>>
>>>> int compute ()
>>>> {
>>>> result = boo (v_a, v_b);
>>>> return result; 
>>>> }
>>>>
>>>> [qinzhao@localhost inline_report]$ /home/qinzhao/Install/latest/bin/gcc
>>>> -O3 -fopt-info-inline-optimized-missed=inline.txt inline_1.c -S
>>>> [qinzhao@localhost inline_report]$ ls -l inline.txt
>>>> -rw-rw-r--. 1 qinzhao qinzhao 0 Jul  3 11:25 inline.txt
>>>> [qinzhao@localhost inline_report]$ cat inline_1.s
>>>> 	.file	"inline_1.c"
>>>> 	.text
>>>> 	.p2align 4,,15
>>>> 	.globl	compute
>>>> 	.type	compute, @function
>>>> compute:
>>>> .LFB3:
>>>> 	.cfi_startproc
>>>> 	movl	v_a(%rip), %edx
>>>> 	movl	v_b(%rip), %eax
>>>> 	leal	-10(%rdx,%rax), %eax
>>>> 	movl	%eax, result(%rip)
>>>> 	ret
>>>> 	.cfi_endproc
>>>> .LFE3:
>>>> 	.size	compute, .-compute
>>>> 	.ident	"GCC: (GNU) 9.0.0 20180702 (experimental)"
>>>> 	.section	.note.GNU-stack,"",@progbits
>>>>
>>>> From the above, we can see:
>>>> 1. the call chains to —>“boo”->”foo”, “bar” in the routine “compute”
>>>> are completely inlined into “compute”;
>>>> 2. However, there is NO any inline information is dumped into
>>>> “inline.txt”.
>>>>
>>>>
>>>> So, My questions are:
>>>>
>>>> 1. Is the option -fopt-info-inline  the right option to use to get the
>>>> complete inlining transformation info from GCC?
>>>> 2. is this a bug that the current -fopt-info-inline cannot dump
>>>> anything for this testing case?
>>>
>>> I think the early inliner doesn't use opt-info yet. 
>>
>> so, shall we add the opt-info support to early inliner?
> 
> I just created the following PR to record this work:
> 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86395 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86395>
> 
> let me know if I missed anything.
I'm hoping that the work David is doing WRT optimization information
will be usable for the inliner as well.  In fact, inlining and
vectorization are the two use cases we identified internally as the
first targets.


jeff

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

* Re: Question on -fopt-info-inline
  2018-07-04  0:19       ` Jeff Law
@ 2018-07-05 15:28         ` Qing Zhao
  2018-07-05 19:04           ` Jeff Law
  0 siblings, 1 reply; 11+ messages in thread
From: Qing Zhao @ 2018-07-05 15:28 UTC (permalink / raw)
  To: Jeff Law; +Cc: Richard Biener, gcc


> On Jul 3, 2018, at 7:19 PM, Jeff Law <law@redhat.com> wrote:
> 
> On 07/03/2018 12:28 PM, Qing Zhao wrote:
>> 
>>>> 
>>>>> 
>>>>> In order to collect complete information on all the inlining
>>>>> transformation that GCC applies on a given program,
>>>>> I searched online, and found that the option -fopt-info-inline might be
>>>>> the right option to use:
>>>>> 
>>>>> in which, it mentioned:
>>>>> 
>>>>> "As another example,
>>>>> gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
>>>>> outputs information about missed optimizations as well as optimized
>>>>> locations from all the inlining passes into inline.txt. 
>>>>> 
>>>>> “
>>>>> 
>>>>> Then I checked a very small testcase with GCC9 as following:
>>>>> 
>>>>> [qinzhao@localhost inline_report]$ cat inline_1.c
>>>>> static int foo (int a)
>>>>> {
>>>>> return a + 10;
>>>>> }
>>>>> 
>>>>> static int bar (int b)
>>>>> {
>>>>> return b - 20;
>>>>> }
>>>>> 
>>>>> static int boo (int a, int b)
>>>>> {
>>>>> return foo (a) + bar (b);
>>>>> }
>>>>> 
>>>>> extern int v_a, v_b;
>>>>> extern int result;
>>>>> 
>>>>> int compute ()
>>>>> {
>>>>> result = boo (v_a, v_b);
>>>>> return result; 
>>>>> }
>>>>> 
>>>>> [qinzhao@localhost inline_report]$ /home/qinzhao/Install/latest/bin/gcc
>>>>> -O3 -fopt-info-inline-optimized-missed=inline.txt inline_1.c -S
>>>>> [qinzhao@localhost inline_report]$ ls -l inline.txt
>>>>> -rw-rw-r--. 1 qinzhao qinzhao 0 Jul  3 11:25 inline.txt
>>>>> [qinzhao@localhost inline_report]$ cat inline_1.s
>>>>> 	.file	"inline_1.c"
>>>>> 	.text
>>>>> 	.p2align 4,,15
>>>>> 	.globl	compute
>>>>> 	.type	compute, @function
>>>>> compute:
>>>>> .LFB3:
>>>>> 	.cfi_startproc
>>>>> 	movl	v_a(%rip), %edx
>>>>> 	movl	v_b(%rip), %eax
>>>>> 	leal	-10(%rdx,%rax), %eax
>>>>> 	movl	%eax, result(%rip)
>>>>> 	ret
>>>>> 	.cfi_endproc
>>>>> .LFE3:
>>>>> 	.size	compute, .-compute
>>>>> 	.ident	"GCC: (GNU) 9.0.0 20180702 (experimental)"
>>>>> 	.section	.note.GNU-stack,"",@progbits
>>>>> 
>>>>> From the above, we can see:
>>>>> 1. the call chains to —>“boo”->”foo”, “bar” in the routine “compute”
>>>>> are completely inlined into “compute”;
>>>>> 2. However, there is NO any inline information is dumped into
>>>>> “inline.txt”.
>>>>> 
>>>>> 
>>>>> So, My questions are:
>>>>> 
>>>>> 1. Is the option -fopt-info-inline  the right option to use to get the
>>>>> complete inlining transformation info from GCC?
>>>>> 2. is this a bug that the current -fopt-info-inline cannot dump
>>>>> anything for this testing case?
>>>> 
>>>> I think the early inliner doesn't use opt-info yet. 
>>> 
>>> so, shall we add the opt-info support to early inliner?
>> 
>> I just created the following PR to record this work:
>> 
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86395 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86395> 
>> let me know if I missed anything.
> I'm hoping that the work David is doing WRT optimization information
> will be usable for the inliner as well.

where can I find more details of David’s work?

>  In fact, inlining and
> vectorization are the two use cases we identified internally as the
> first targets.

actually, during my study, I noticed that vectorization, some loop transformation, and OMP
are all generating information for -fopt-info (might not be complete yet, though). But inliner
is generating Nothing for -fopt-info.

Qing
> 
> 
> jeff

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

* Re: Question on -fopt-info-inline
  2018-07-05 15:28         ` Qing Zhao
@ 2018-07-05 19:04           ` Jeff Law
  2018-07-05 20:55             ` David Malcolm
  0 siblings, 1 reply; 11+ messages in thread
From: Jeff Law @ 2018-07-05 19:04 UTC (permalink / raw)
  To: Qing Zhao; +Cc: Richard Biener, gcc

On 07/05/2018 09:27 AM, Qing Zhao wrote:
> 
>> On Jul 3, 2018, at 7:19 PM, Jeff Law <law@redhat.com
>> <mailto:law@redhat.com>> wrote:
>>
>> On 07/03/2018 12:28 PM, Qing Zhao wrote:
>>>
>>>>>
>>>>>>
>>>>>> In order to collect complete information on all the inlining
>>>>>> transformation that GCC applies on a given program,
>>>>>> I searched online, and found that the option -fopt-info-inline
>>>>>> might be
>>>>>> the right option to use:
>>>>>>
>>>>>> in which, it mentioned:
>>>>>>
>>>>>> "As another example,
>>>>>> gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
>>>>>> outputs information about missed optimizations as well as optimized
>>>>>> locations from all the inlining passes into inline.txt. 
>>>>>>
>>>>>> “
>>>>>>
>>>>>> Then I checked a very small testcase with GCC9 as following:
>>>>>>
>>>>>> [qinzhao@localhost inline_report]$ cat inline_1.c
>>>>>> static int foo (int a)
>>>>>> {
>>>>>> return a + 10;
>>>>>> }
>>>>>>
>>>>>> static int bar (int b)
>>>>>> {
>>>>>> return b - 20;
>>>>>> }
>>>>>>
>>>>>> static int boo (int a, int b)
>>>>>> {
>>>>>> return foo (a) + bar (b);
>>>>>> }
>>>>>>
>>>>>> extern int v_a, v_b;
>>>>>> extern int result;
>>>>>>
>>>>>> int compute ()
>>>>>> {
>>>>>> result = boo (v_a, v_b);
>>>>>> return result; 
>>>>>> }
>>>>>>
>>>>>> [qinzhao@localhost inline_report]$
>>>>>> /home/qinzhao/Install/latest/bin/gcc
>>>>>> -O3 -fopt-info-inline-optimized-missed=inline.txt inline_1.c -S
>>>>>> [qinzhao@localhost inline_report]$ ls -l inline.txt
>>>>>> -rw-rw-r--. 1 qinzhao qinzhao 0 Jul  3 11:25 inline.txt
>>>>>> [qinzhao@localhost inline_report]$ cat inline_1.s
>>>>>> .file"inline_1.c"
>>>>>> .text
>>>>>> .p2align 4,,15
>>>>>> .globlcompute
>>>>>> .typecompute, @function
>>>>>> compute:
>>>>>> .LFB3:
>>>>>> .cfi_startproc
>>>>>> movlv_a(%rip), %edx
>>>>>> movlv_b(%rip), %eax
>>>>>> leal-10(%rdx,%rax), %eax
>>>>>> movl%eax, result(%rip)
>>>>>> ret
>>>>>> .cfi_endproc
>>>>>> .LFE3:
>>>>>> .sizecompute, .-compute
>>>>>> .ident"GCC: (GNU) 9.0.0 20180702 (experimental)"
>>>>>> .section.note.GNU-stack,"",@progbits
>>>>>>
>>>>>> From the above, we can see:
>>>>>> 1. the call chains to —>“boo”->”foo”, “bar” in the routine “compute”
>>>>>> are completely inlined into “compute”;
>>>>>> 2. However, there is NO any inline information is dumped into
>>>>>> “inline.txt”.
>>>>>>
>>>>>>
>>>>>> So, My questions are:
>>>>>>
>>>>>> 1. Is the option -fopt-info-inline  the right option to use to get the
>>>>>> complete inlining transformation info from GCC?
>>>>>> 2. is this a bug that the current -fopt-info-inline cannot dump
>>>>>> anything for this testing case?
>>>>>
>>>>> I think the early inliner doesn't use opt-info yet. 
>>>>
>>>> so, shall we add the opt-info support to early inliner?
>>>
>>> I just created the following PR to record this work:
>>>
>>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86395 
>>> let me know if I missed anything.
>> I'm hoping that the work David is doing WRT optimization information
>> will be usable for the inliner as well. 
> 
> where can I find more details of David’s work?
I don't have pointers to all the discussion handy.  BUt here's one of
the early messages:

https://gcc.gnu.org/ml/gcc-patches/2018-05/msg01675.html
jeff

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

* Re: Question on -fopt-info-inline
  2018-07-05 19:04           ` Jeff Law
@ 2018-07-05 20:55             ` David Malcolm
  2018-07-10 15:42               ` Qing Zhao
  0 siblings, 1 reply; 11+ messages in thread
From: David Malcolm @ 2018-07-05 20:55 UTC (permalink / raw)
  To: Jeff Law, Qing Zhao; +Cc: Richard Biener, gcc

On Thu, 2018-07-05 at 13:04 -0600, Jeff Law wrote:
> On 07/05/2018 09:27 AM, Qing Zhao wrote:
> > 
> > > On Jul 3, 2018, at 7:19 PM, Jeff Law <law@redhat.com
> > > <mailto:law@redhat.com>> wrote:
> > > 
> > > On 07/03/2018 12:28 PM, Qing Zhao wrote:
> > > > 
> > > > > > 
> > > > > > > 
> > > > > > > In order to collect complete information on all the
> > > > > > > inlining
> > > > > > > transformation that GCC applies on a given program,
> > > > > > > I searched online, and found that the option -fopt-info-
> > > > > > > inline
> > > > > > > might be
> > > > > > > the right option to use:
> > > > > > > 
> > > > > > > in which, it mentioned:
> > > > > > > 
> > > > > > > "As another example,
> > > > > > > gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
> > > > > > > outputs information about missed optimizations as well as
> > > > > > > optimized
> > > > > > > locations from all the inlining passes into inline.txt. 
> > > > > > > 
> > > > > > > “
> > > > > > > 
> > > > > > > Then I checked a very small testcase with GCC9 as
> > > > > > > following:
> > > > > > > 
> > > > > > > [qinzhao@localhost inline_report]$ cat inline_1.c
> > > > > > > static int foo (int a)
> > > > > > > {
> > > > > > > return a + 10;
> > > > > > > }
> > > > > > > 
> > > > > > > static int bar (int b)
> > > > > > > {
> > > > > > > return b - 20;
> > > > > > > }
> > > > > > > 
> > > > > > > static int boo (int a, int b)
> > > > > > > {
> > > > > > > return foo (a) + bar (b);
> > > > > > > }
> > > > > > > 
> > > > > > > extern int v_a, v_b;
> > > > > > > extern int result;
> > > > > > > 
> > > > > > > int compute ()
> > > > > > > {
> > > > > > > result = boo (v_a, v_b);
> > > > > > > return result; 
> > > > > > > }
> > > > > > > 
> > > > > > > [qinzhao@localhost inline_report]$
> > > > > > > /home/qinzhao/Install/latest/bin/gcc
> > > > > > > -O3 -fopt-info-inline-optimized-missed=inline.txt
> > > > > > > inline_1.c -S
> > > > > > > [qinzhao@localhost inline_report]$ ls -l inline.txt
> > > > > > > -rw-rw-r--. 1 qinzhao qinzhao 0 Jul  3 11:25 inline.txt
> > > > > > > [qinzhao@localhost inline_report]$ cat inline_1.s
> > > > > > > .file"inline_1.c"
> > > > > > > .text
> > > > > > > .p2align 4,,15
> > > > > > > .globlcompute
> > > > > > > .typecompute, @function
> > > > > > > compute:
> > > > > > > .LFB3:
> > > > > > > .cfi_startproc
> > > > > > > movlv_a(%rip), %edx
> > > > > > > movlv_b(%rip), %eax
> > > > > > > leal-10(%rdx,%rax), %eax
> > > > > > > movl%eax, result(%rip)
> > > > > > > ret
> > > > > > > .cfi_endproc
> > > > > > > .LFE3:
> > > > > > > .sizecompute, .-compute
> > > > > > > .ident"GCC: (GNU) 9.0.0 20180702 (experimental)"
> > > > > > > .section.note.GNU-stack,"",@progbits
> > > > > > > 
> > > > > > > From the above, we can see:
> > > > > > > 1. the call chains to —>“boo”->”foo”, “bar” in the
> > > > > > > routine “compute”
> > > > > > > are completely inlined into “compute”;
> > > > > > > 2. However, there is NO any inline information is dumped
> > > > > > > into
> > > > > > > “inline.txt”.
> > > > > > > 
> > > > > > > 
> > > > > > > So, My questions are:
> > > > > > > 
> > > > > > > 1. Is the option -fopt-info-inline  the right option to
> > > > > > > use to get the
> > > > > > > complete inlining transformation info from GCC?
> > > > > > > 2. is this a bug that the current -fopt-info-inline
> > > > > > > cannot dump
> > > > > > > anything for this testing case?
> > > > > > 
> > > > > > I think the early inliner doesn't use opt-info yet. 
> > > > > 
> > > > > so, shall we add the opt-info support to early inliner?
> > > > 
> > > > I just created the following PR to record this work:
> > > > 
> > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86395 
> > > > let me know if I missed anything.
> > > 
> > > I'm hoping that the work David is doing WRT optimization
> > > information
> > > will be usable for the inliner as well. 
> > 
> > where can I find more details of David’s work?
> 
> I don't have pointers to all the discussion handy.  BUt here's one of
> the early messages:
> 
> https://gcc.gnu.org/ml/gcc-patches/2018-05/msg01675.html

I'm currently attacking the problem of "better optimization
information" from two directions:

(a) More destinations for the existing optimization reports: being able
to send them through the diagnostics subsystem, and to be able to save
them in a machine-readable format from which reports can be generated
(e.g. prioritized by code hotness). The initial patch kit Jeff linked
to above introduced a new API for doing that, but I'm no longer doing
that, instead working on using the existing "dump_*" API in dumpfile.h.
 Some of this work is now in trunk: dump messages are now tagged with
metadata about the hotness of the code being optimized, and where in
GCC's own code the messages was emitted from ...but this new metadata
is being dropped on the floor in dumpfile.c right now.  The latest
version of the patch kit for (a) is awaiting review at:
  "[PATCH 0/2] v4: optinfo framework and remarks"
     https://gcc.gnu.org/ml/gcc-patches/2018-07/msg00066.html

(b) I'm looking at new, improved optimization reports for
vectorization, by capturing higher-level information about why a loop
can't be vectorized, in a form that hopefully is useful to an end-user. 
See a (very rough) prototype here:

  * "[PATCH] [RFC] Higher-level reporting of vectorization problems"
    * https://gcc.gnu.org/ml/gcc-patches/2018-06/msg01462.html

I'm working on a less rough version of (b) and hope to post it to gcc-
patches soon.

Hope this sounds sane
Dave

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

* Re: Question on -fopt-info-inline
  2018-07-05 20:55             ` David Malcolm
@ 2018-07-10 15:42               ` Qing Zhao
  2018-07-10 16:32                 ` Richard Biener
  0 siblings, 1 reply; 11+ messages in thread
From: Qing Zhao @ 2018-07-10 15:42 UTC (permalink / raw)
  To: David Malcolm; +Cc: Jeff Law, Richard Biener, gcc

Hi, David,

thanks a lot for your information. very helpful.

specifically, I am mostly interested in the inline report part of the opt-info:

1. what’s the current status of inlining report through opt-info?  (with the upstream GCC last week,
the -fopt-info-inline report nothing)
2. what’s the plan for opt-info-inline? when will it be available?
3. is there any design available for the messages from opt-info-inline? will the call-chain info, profiling 
feedback info be available in the inlining report?

thanks.

Qing

> On Jul 5, 2018, at 3:55 PM, David Malcolm <dmalcolm@redhat.com> wrote:
>>> 
>>> where can I find more details of David’s work?
>> 
>> I don't have pointers to all the discussion handy.  BUt here's one of
>> the early messages:
>> 
>> https://gcc.gnu.org/ml/gcc-patches/2018-05/msg01675.html
> 
> I'm currently attacking the problem of "better optimization
> information" from two directions:
> 
> (a) More destinations for the existing optimization reports: being able
> to send them through the diagnostics subsystem, and to be able to save
> them in a machine-readable format from which reports can be generated
> (e.g. prioritized by code hotness). The initial patch kit Jeff linked
> to above introduced a new API for doing that, but I'm no longer doing
> that, instead working on using the existing "dump_*" API in dumpfile.h.
> Some of this work is now in trunk: dump messages are now tagged with
> metadata about the hotness of the code being optimized, and where in
> GCC's own code the messages was emitted from ...but this new metadata
> is being dropped on the floor in dumpfile.c right now.  The latest
> version of the patch kit for (a) is awaiting review at:
>  "[PATCH 0/2] v4: optinfo framework and remarks"
>     https://gcc.gnu.org/ml/gcc-patches/2018-07/msg00066.html <https://gcc.gnu.org/ml/gcc-patches/2018-07/msg00066.html>
> 
> (b) I'm looking at new, improved optimization reports for
> vectorization, by capturing higher-level information about why a loop
> can't be vectorized, in a form that hopefully is useful to an end-user. 
> See a (very rough) prototype here:
> 
>  * "[PATCH] [RFC] Higher-level reporting of vectorization problems"
>    * https://gcc.gnu.org/ml/gcc-patches/2018-06/msg01462.html <https://gcc.gnu.org/ml/gcc-patches/2018-06/msg01462.html>
> 
> I'm working on a less rough version of (b) and hope to post it to gcc-
> patches soon.
> 
> Hope this sounds sane
> Dave

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

* Re: Question on -fopt-info-inline
  2018-07-10 15:42               ` Qing Zhao
@ 2018-07-10 16:32                 ` Richard Biener
  2018-07-10 17:02                   ` Qing Zhao
  0 siblings, 1 reply; 11+ messages in thread
From: Richard Biener @ 2018-07-10 16:32 UTC (permalink / raw)
  To: Qing Zhao, David Malcolm; +Cc: Jeff Law, gcc

On July 10, 2018 5:42:40 PM GMT+02:00, Qing Zhao <qing.zhao@oracle.com> wrote:
>Hi, David,
>
>thanks a lot for your information. very helpful.
>
>specifically, I am mostly interested in the inline report part of the
>opt-info:
>
>1. what’s the current status of inlining report through opt-info? 
>(with the upstream GCC last week,
>the -fopt-info-inline report nothing)
>2. what’s the plan for opt-info-inline? when will it be available?

Just implement it yourself? There is already Winline you can look at. 

>3. is there any design available for the messages from opt-info-inline?
>will the call-chain info, profiling 
>feedback info be available in the inlining report?

What do you need the report for? With C++ too much inlining happens to be interesting. You can also always look at the ipa-inline and einline dumps. 

Richard. 

>
>thanks.
>
>Qing
>
>> On Jul 5, 2018, at 3:55 PM, David Malcolm <dmalcolm@redhat.com>
>wrote:
>>>> 
>>>> where can I find more details of David’s work?
>>> 
>>> I don't have pointers to all the discussion handy.  BUt here's one
>of
>>> the early messages:
>>> 
>>> https://gcc.gnu.org/ml/gcc-patches/2018-05/msg01675.html
>> 
>> I'm currently attacking the problem of "better optimization
>> information" from two directions:
>> 
>> (a) More destinations for the existing optimization reports: being
>able
>> to send them through the diagnostics subsystem, and to be able to
>save
>> them in a machine-readable format from which reports can be generated
>> (e.g. prioritized by code hotness). The initial patch kit Jeff linked
>> to above introduced a new API for doing that, but I'm no longer doing
>> that, instead working on using the existing "dump_*" API in
>dumpfile.h.
>> Some of this work is now in trunk: dump messages are now tagged with
>> metadata about the hotness of the code being optimized, and where in
>> GCC's own code the messages was emitted from ...but this new metadata
>> is being dropped on the floor in dumpfile.c right now.  The latest
>> version of the patch kit for (a) is awaiting review at:
>>  "[PATCH 0/2] v4: optinfo framework and remarks"
>>     https://gcc.gnu.org/ml/gcc-patches/2018-07/msg00066.html
><https://gcc.gnu.org/ml/gcc-patches/2018-07/msg00066.html>
>> 
>> (b) I'm looking at new, improved optimization reports for
>> vectorization, by capturing higher-level information about why a loop
>> can't be vectorized, in a form that hopefully is useful to an
>end-user. 
>> See a (very rough) prototype here:
>> 
>>  * "[PATCH] [RFC] Higher-level reporting of vectorization problems"
>>    * https://gcc.gnu.org/ml/gcc-patches/2018-06/msg01462.html
><https://gcc.gnu.org/ml/gcc-patches/2018-06/msg01462.html>
>> 
>> I'm working on a less rough version of (b) and hope to post it to
>gcc-
>> patches soon.
>> 
>> Hope this sounds sane
>> Dave

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

* Re: Question on -fopt-info-inline
  2018-07-10 16:32                 ` Richard Biener
@ 2018-07-10 17:02                   ` Qing Zhao
  0 siblings, 0 replies; 11+ messages in thread
From: Qing Zhao @ 2018-07-10 17:02 UTC (permalink / raw)
  To: Richard Biener; +Cc: David Malcolm, Jeff Law, gcc


> On Jul 10, 2018, at 11:32 AM, Richard Biener <richard.guenther@gmail.com> wrote:
> 
> On July 10, 2018 5:42:40 PM GMT+02:00, Qing Zhao <qing.zhao@oracle.com> wrote:
>> Hi, David,
>> 
>> thanks a lot for your information. very helpful.
>> 
>> specifically, I am mostly interested in the inline report part of the
>> opt-info:
>> 
>> 1. what’s the current status of inlining report through opt-info? 
>> (with the upstream GCC last week,
>> the -fopt-info-inline report nothing)
>> 2. what’s the plan for opt-info-inline? when will it be available?
> 
> Just implement it yourself? There is already Winline you can look at. 
Yes, I can definitely do that. Just want to be consistent with the current work David is doing, any specific requirement?
and also want to make sure no duplicated effort spent on this work. :-)

> 
>> 3. is there any design available for the messages from opt-info-inline?
>> will the call-chain info, profiling 
>> feedback info be available in the inlining report?
> 
> What do you need the report for? With C++ too much inlining happens to be interesting. You can also always look at the ipa-inline and einline dumps. 

we are mostly interested in C inlining report. mainly to find all the callers of a callee that is inlined. 

I will check the dump files of ipa-inline and einline to see whether they can be filtered to get enough info we want first.

thanks.

Qing
> 
> Richard. 

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

end of thread, other threads:[~2018-07-10 17:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-03 16:01 Question on -fopt-info-inline Qing Zhao
2018-07-03 16:49 ` Richard Biener
2018-07-03 17:32   ` Qing Zhao
2018-07-03 18:28     ` Qing Zhao
2018-07-04  0:19       ` Jeff Law
2018-07-05 15:28         ` Qing Zhao
2018-07-05 19:04           ` Jeff Law
2018-07-05 20:55             ` David Malcolm
2018-07-10 15:42               ` Qing Zhao
2018-07-10 16:32                 ` Richard Biener
2018-07-10 17:02                   ` Qing Zhao

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).