public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hkzhang455 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/111672] New: Inappropriate function splitting during pass_split_functions
Date: Tue, 03 Oct 2023 09:41:45 +0000	[thread overview]
Message-ID: <bug-111672-4@http.gcc.gnu.org/bugzilla/> (raw)

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)

             reply	other threads:[~2023-10-03  9:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-03  9:41 hkzhang455 at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-111672-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).