From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 955B938A814B for ; Fri, 16 Sep 2022 16:18:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 955B938A814B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663345099; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XShNPri7G+JfXll9nxlKAzIpKF5owYhpZjzaU9KKXrE=; b=aJT6j97GPVwE+Mbd9/lA7JoumUSWnjyLw/rhDZB5Q+aoNHcUVo/nvQfrDk97otiIpMbQJ1 LGxiS6OTXM7DN2ppFIXj9KR1C1EQHz5Z3coJ7vqd5vBnLwmQqSJR2tci0VX0D4w9h3bngF LrykyKI9w24Dwa/hGGbxbooQ4WNOujA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-209-mv2veHMzPRGBkauWTbFsLA-1; Fri, 16 Sep 2022 12:18:16 -0400 X-MC-Unique: mv2veHMzPRGBkauWTbFsLA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C9784801231; Fri, 16 Sep 2022 16:18:15 +0000 (UTC) Received: from localhost (unknown [10.33.36.214]) by smtp.corp.redhat.com (Postfix) with ESMTP id 93987140EBF3; Fri, 16 Sep 2022 16:18:15 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Remove __alloc_neq helper Date: Fri, 16 Sep 2022 17:18:14 +0100 Message-Id: <20220916161814.510563-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Tested x86_64-linux, pushed to trunk. -- >8 -- This class template and partial specialization were added 15 years ago to optimize allocator equality comparisons in std::list. I think it's safe to assume that GCC is now capable of optimizing an inline operator!= that just returns false at least as well as an inline member function that just returns false. libstdc++-v3/ChangeLog: * include/bits/allocator.h (__alloc_neq): Remove. * include/bits/stl_list.h (list::_M_check_equal_allocators): Compare allocators directly, without __alloc_neq. --- libstdc++-v3/include/bits/allocator.h | 17 ----------------- libstdc++-v3/include/bits/stl_list.h | 5 ++--- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/libstdc++-v3/include/bits/allocator.h b/libstdc++-v3/include/bits/allocator.h index 28abf13eba9..c39166e24fe 100644 --- a/libstdc++-v3/include/bits/allocator.h +++ b/libstdc++-v3/include/bits/allocator.h @@ -298,23 +298,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } }; - // Optimize for stateless allocators. - template - struct __alloc_neq - { - static bool - _S_do_it(const _Alloc&, const _Alloc&) - { return false; } - }; - - template - struct __alloc_neq<_Alloc, false> - { - static bool - _S_do_it(const _Alloc& __one, const _Alloc& __two) - { return __one != __two; } - }; - #if __cplusplus >= 201103L template, diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h index b8bd46191fc..a73ca60df5a 100644 --- a/libstdc++-v3/include/bits/stl_list.h +++ b/libstdc++-v3/include/bits/stl_list.h @@ -2026,10 +2026,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 // To implement the splice (and merge) bits of N1599. void - _M_check_equal_allocators(list& __x) _GLIBCXX_NOEXCEPT + _M_check_equal_allocators(const list& __x) _GLIBCXX_NOEXCEPT { - if (std::__alloc_neq:: - _S_do_it(_M_get_Node_allocator(), __x._M_get_Node_allocator())) + if (_M_get_Node_allocator() != __x._M_get_Node_allocator()) __builtin_abort(); } -- 2.37.3