public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/111672] New: Inappropriate function splitting during pass_split_functions
@ 2023-10-03  9:41 hkzhang455 at gmail dot com
  2023-10-03 16:37 ` [Bug ipa/111672] " pinskia at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: hkzhang455 at gmail dot com @ 2023-10-03  9:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111672

            Bug ID: 111672
           Summary: Inappropriate function splitting during
                    pass_split_functions
           Product: gcc
           Version: 12.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hkzhang455 at gmail dot com
  Target Milestone: ---

Created attachment 56034
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56034&action=edit
example C file that can trigger inappropriate function splitting

When the GCC compiler performs function splitting optimization, the shorter and
closer path is split into a new function, while the remaining more complex and
expensive code is retained, resulting in the complexity of the original
function being increased after the split, and the split new function only
performs simple operations (such as 'printf()').

You can compile the source code file I put in the attachment with the following
command, and look at the gimple corresponding to the generated fnsplit to find
the phenomenon I described.

  gcc test.c -O3 -flto -fdump-tree-fnsplit -Wall -Wextra

Of course, this is only sample code, so the resulting executable does not
reflect the efficiency gap due to the problem of inline. But in more complex
code, efficiency decreases.

Hardware: 12th Gen Intel(R) Core(TM) i9-12900KF
System: Ubuntu 22.04
Output of `gcc -v`:

Using built-in specs.
COLLECT_GCC=xxx/install/bin/gcc
COLLECT_LTO_WRAPPER=xxx/install/libexec/gcc/x86_64-pc-linux-gnu/12.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=xxx/install --enable-threads=posix
--disable-checking --disable-multilib --disable-bootstrap
--enable-languages=c,c++,lto
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.3.0 (GCC)

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

end of thread, other threads:[~2023-10-06 16:16 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-03  9:41 [Bug c/111672] New: Inappropriate function splitting during pass_split_functions hkzhang455 at gmail dot com
2023-10-03 16:37 ` [Bug ipa/111672] " pinskia at gcc dot gnu.org
2023-10-04  2:00 ` hkzhang455 at gmail dot com
2023-10-04  2:04 ` pinskia at gcc dot gnu.org
2023-10-04  2:08 ` hkzhang455 at gmail dot com
2023-10-04  5:24 ` pinskia at gcc dot gnu.org
2023-10-04  5:25 ` pinskia at gcc dot gnu.org
2023-10-04 13:48 ` hkzhang455 at gmail dot com
2023-10-04 13:49 ` hkzhang455 at gmail dot com
2023-10-04 23:58 ` pinskia at gcc dot gnu.org
2023-10-05  0:03 ` pinskia at gcc dot gnu.org
2023-10-06  2:48 ` hkzhang455 at gmail dot com
2023-10-06  2:59 ` pinskia at gcc dot gnu.org
2023-10-06 16:16 ` hkzhang455 at gmail dot com

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