From patchwork Fri Feb 28 16:34:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 1246619 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-520322-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=n875iEXj; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YR6HgSWd; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48TZs71CpQz9sSH for ; Sat, 29 Feb 2020 03:35:21 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=E9bs46QGm67bi8Tt Ofor0Zy0C3zC8t8r1SXCDBJVzSYYIYKZSNlN8hkgAsYcD+TJkhVDPinepuCZUEOt 1Jyw+CXWTpVfIsW6H9c3bVjVG/i/3dpE1JjJFAlEJLGpfQXon1sCibsGkSdfJusO dcg4dHQg1X75QW9pNct/ui2Q0Fg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=k32C4mMn9siaS9wK/fuoup GIFGY=; b=n875iEXjBt/d0saqbacp93wRenIQyvGLAsjrD13+LKq89DPi0jJtZB 6dw6GIBYqXdVyyVpKsqe+U7/9SWSugBpqHX2dh3LribfjYlUfEuXV4AqOJUvfZlN 6p5hunQvhTUfFRcEvEd1fCConclW/lSzHvVNrs58a++27XpugKZTw= Received: (qmail 31384 invoked by alias); 28 Feb 2020 16:35:12 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 31337 invoked by uid 89); 28 Feb 2020 16:35:12 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 spammy= X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-1.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (205.139.110.61) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 28 Feb 2020 16:35:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582907707; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Hkp2VRpnOFBGd8zCGZ0vYiNBw19E4SvPf9i59bu2ruM=; b=YR6HgSWdviPFL1//ad6A6QBvFkKkK1oI4ny5PAOwVq/kZSP1RNXAS7COQMTlwakNXuxz77 v/kql4jCFgWwSK+R79gapyjmW1H1wSxEzU0Qe8ZqXY8sWyKDzUo9mz92YYdwYtN/wxtAQ7 PbEsoke9ctBWKAFxk2DTK9uRq97gBts= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-434-DbypoHpLO4-NElvlCYQRkg-1; Fri, 28 Feb 2020 11:35:02 -0500 Received: by mail-qv1-f69.google.com with SMTP id u5so3006874qvj.10 for ; Fri, 28 Feb 2020 08:35:01 -0800 (PST) Received: from localhost.localdomain (ool-457d493a.dyn.optonline.net. [69.125.73.58]) by smtp.gmail.com with ESMTPSA id x3sm5412543qts.35.2020.02.28.08.35.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2020 08:35:00 -0800 (PST) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Patrick Palka Subject: [PATCH] libstdc++: Also disable caching of reverse_view::begin() for common_ranges Date: Fri, 28 Feb 2020 11:34:59 -0500 Message-Id: <20200228163459.1815748-1-ppalka@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-IsSubscribed: yes When the underlying range models common_range, then reverse_view::begin() is O(1) without caching. So we should disable the cache in this case too. libstdc++-v3/ChangeLog: * include/std/ranges (reverse_view::_S_needs_cached_begin): Set to false whenever the underlying range models common_range. --- libstdc++-v3/include/std/ranges | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges index 2f773130979..19d3da950e7 100644 --- a/libstdc++-v3/include/std/ranges +++ b/libstdc++-v3/include/std/ranges @@ -3177,7 +3177,8 @@ namespace views private: _Vp _M_base = _Vp(); - static constexpr bool _S_needs_cached_begin = !random_access_range<_Vp>; + static constexpr bool _S_needs_cached_begin + = !common_range<_Vp> && !random_access_range<_Vp>; [[no_unique_address]] __detail::__maybe_empty_t<_S_needs_cached_begin, __detail::_CachedPosition<_Vp>> _M_cached_begin;