From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 384283858C27; Tue, 1 Feb 2022 03:47:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 384283858C27 From: "siarhei.siamashka at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug d/102765] [11 Regression] GDC11 stopped inlining library functions and lambdas used by a binary search one-liner code Date: Tue, 01 Feb 2022 03:47:18 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: d X-Bugzilla-Version: 11.2.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: siarhei.siamashka at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ibuclaw at gdcproject dot org X-Bugzilla-Target-Milestone: 11.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Feb 2022 03:47:18 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102765 --- Comment #4 from Siarhei Siamashka = --- First of all, it's my own fault for not just bisecting the GDC code from the day one to figure out all the relevant details many months earlier. The cod= e is large and takes a lot of time to compile, so I was lazy. And I apologise for this. Now comments from https://forum.dlang.org/thread/sspkdp$1m4n$1@digitalmars.= com provided some missing bits of important information. I may be still wrong, = so please correct me if necessary, but the root cause of this performance regression appears to be an attempt to fix the actual problem PR104317 in G= DC11 via some excessively invasive PR99914 that ended up evolving GDC in a wrong direction. Just imagine someone encountering something like the examples from https://stackoverflow.com/questions/3691835/why-uninitialized-global-variab= le-is-weak-symbol and then suddenly making a strange conclusion that all template functions should be non-inlineable in a C++ compiler (unless LTO is enabled). Looks l= ike that's exactly what happened to GDC. The D language standard documentation = is incomplete and this isn't helping. But the developers of the other D compil= ers seem to have an opinion that inlining template functions is okay (due to the same or at least similar ODR rules as in C++).=