From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B25CC3885C14; Thu, 22 Jul 2021 13:43:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B25CC3885C14 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/94295] use __builtin_operator_new and __builtin_operator_delete when available Date: Thu, 22 Jul 2021 13:43:17 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: missed-optimization, patch X-Bugzilla-Severity: enhancement X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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: Thu, 22 Jul 2021 13:43:17 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94295 --- Comment #12 from CVS Commits --- The master branch has been updated by Jonathan Wakely : https://gcc.gnu.org/g:c9ca352186226ae757688e160e7c6f394c9f26aa commit r12-2470-gc9ca352186226ae757688e160e7c6f394c9f26aa Author: Jonathan Wakely Date: Thu Jul 22 14:38:34 2021 +0100 libstdc++: Use __builtin_operator_new when available [PR94295] Clang provides __builtin_operator_new and __builtin_operator_delete, which have the same semantics as ::operator new and ::operator delete except that the compiler is allowed to elide calls to them. This changes std::allocator to use those built-in functions so that memory allocated by std::allocator can be optimized away when using Clang. This avoids an abstraction penalty for using std::allocator to allocate storage rather than a new-expression. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: PR libstdc++/94295 * include/ext/new_allocator.h (_GLIBCXX_OPERATOR_NEW) (_GLIBCXX_OPERATOR_DELETE, _GLIBCXX_SIZED_DEALLOC): Define. (allocator::allocate, allocator::deallocate): Use new macros.=