From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 794933858D33; Tue, 3 Oct 2023 09:41:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 794933858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696326106; bh=9WsI66mR2wD//XUr0Nup3MltNE1Jwu8kooWLFCM/+Q0=; h=From:To:Subject:Date:From; b=LEphmZMIB0rQpFZZ8SMJpNwAYHWbBHszrSjzOY/6IvDMtBk3Mx2B7YSDYGGk/Vnkc YZ1t3aXiJw8jAJAXgRrsNisRXxJ31Bn1FPdKMCzHESBKsRgOwTE77b2HB7cDI8ldlF x2iR/plPcTrOfBsBcyRUBjgiAUuRYCNyd/NO/LiM= From: "hkzhang455 at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 12.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hkzhang455 at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111672 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=3D56034&action=3Dedit 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 follo= wing command, and look at the gimple corresponding to the generated fnsplit to f= ind 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=3Dxxx/install/bin/gcc COLLECT_LTO_WRAPPER=3Dxxx/install/libexec/gcc/x86_64-pc-linux-gnu/12.3.0/lt= o-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure --prefix=3Dxxx/install --enable-threads=3Dpos= ix --disable-checking --disable-multilib --disable-bootstrap --enable-languages=3Dc,c++,lto Thread model: posix Supported LTO compression algorithms: zlib gcc version 12.3.0 (GCC)=