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