Question on -fopt-info-inline

Richard Biener richard.guenther@gmail.com
Tue Jul 3 16:49:00 GMT 2018


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



More information about the Gcc mailing list