From patchwork Tue Aug 6 16:09:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Polacek X-Patchwork-Id: 1969631 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=R26NRSRA; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WddZH21Ccz1ybS for ; Wed, 7 Aug 2024 02:10:31 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 152E93858420 for ; Tue, 6 Aug 2024 16:10:29 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 8CF733858C56 for ; Tue, 6 Aug 2024 16:10:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8CF733858C56 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8CF733858C56 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722960609; cv=none; b=MQOUC7o0hQblKTcAGIVjpGxHWEYqcg41JLKJVt4iY1WtZKdvTQfGQeF8h8SMwUiSxwmUcuKk6VEVDC8pUowhcIGZGmXQ0GobSkVRLsakBA/84aOnGegpdRo6iAEmupzGIwcBN9JOI+sywQGbSX7TZLAJfBfIFXcQ5RadB9vClSk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722960609; c=relaxed/simple; bh=Gyi6iGVYHt1/5qmsEV8o+VrsVbH6DcnHaJIlYSomIx0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=i4HyYmpSwn3zjBQwm7MccHtWLn+LTkheak1k8HxUD4t0U2GnC4HrvQH/aI6+DwttxMIep6VyteyVehKN2TBSjKJ/Uq/mUfpvLqRWZNWMgVctAeTmpkZAM7wIkxd8D6nX2Nge9pHn++vYXPrbHwhy1nZ5V/3BNRxD6o47P84sWzo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722960607; 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=cQTVdPspW6Bl2TL43t1GHgRtnqmCDNQDQXOi8iGCSwM=; b=R26NRSRAIMsdpf2xyPQwtSeBp570g1lb2/7P/2blaLtcI5RMCCIeTcC1VhN3MTeATOOEbj blHW3k5Tbmrad14AveOO511Tly42qbXRCtHtYq8euzobmCEKzbKQt3gXr35Z9VClpMaU6R FLls6LlFHpDHv3YsYjNcNz6J43pCeYI= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-633-UOTsPBkyPoCdDe4XCScDOA-1; Tue, 06 Aug 2024 12:10:00 -0400 X-MC-Unique: UOTsPBkyPoCdDe4XCScDOA-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CA0931955D48 for ; Tue, 6 Aug 2024 16:09:58 +0000 (UTC) Received: from pdp-11.lan (unknown [10.22.33.44]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D16B2300019B; Tue, 6 Aug 2024 16:09:57 +0000 (UTC) From: Marek Polacek To: GCC Patches , Jason Merrill , Patrick Palka Subject: [PATCH] c++: further concept_check_p clean-up Date: Tue, 6 Aug 2024 12:09:51 -0400 Message-ID: <20240806160951.860249-1-polacek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.2 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_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- Patrick noticed a few more concept_check_p checks that can be removed now. gcc/cp/ChangeLog: * constexpr.cc (cxx_eval_call_expression): Remove concept_check_p check. (cxx_eval_outermost_constant_expr): Likewise. * cp-gimplify.cc (cp_genericize_r) : Likewise. * except.cc (check_noexcept_r): Likewise. --- gcc/cp/constexpr.cc | 20 ++++++-------------- gcc/cp/cp-gimplify.cc | 9 --------- gcc/cp/except.cc | 2 -- 3 files changed, 6 insertions(+), 25 deletions(-) base-commit: 180625ae72b3f733813a360fae4f0d6ce79eccdc diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc index 8d994f0ee53..b0adbb9036d 100644 --- a/gcc/cp/constexpr.cc +++ b/gcc/cp/constexpr.cc @@ -2797,10 +2797,6 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t, value_cat lval, bool *non_constant_p, bool *overflow_p) { - /* Handle concept checks separately. */ - if (concept_check_p (t)) - return evaluate_concept_check (t); - location_t loc = cp_expr_loc_or_input_loc (t); tree fun = get_function_named_in_call (t); constexpr_call new_call @@ -8774,16 +8770,12 @@ cxx_eval_outermost_constant_expr (tree t, bool allow_non_constant, || TREE_CODE (t) == AGGR_INIT_EXPR || TREE_CODE (t) == TARGET_EXPR)) { - /* For non-concept checks, determine if it is consteval. */ - if (!concept_check_p (t)) - { - tree x = t; - if (TREE_CODE (x) == TARGET_EXPR) - x = TARGET_EXPR_INITIAL (x); - tree fndecl = cp_get_callee_fndecl_nofold (x); - if (fndecl && DECL_IMMEDIATE_FUNCTION_P (fndecl)) - is_consteval = true; - } + tree x = t; + if (TREE_CODE (x) == TARGET_EXPR) + x = TARGET_EXPR_INITIAL (x); + tree fndecl = cp_get_callee_fndecl_nofold (x); + if (fndecl && DECL_IMMEDIATE_FUNCTION_P (fndecl)) + is_consteval = true; } if (AGGREGATE_TYPE_P (type) || VECTOR_TYPE_P (type)) { diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc index 0c589eeaaec..003e68f1ea7 100644 --- a/gcc/cp/cp-gimplify.cc +++ b/gcc/cp/cp-gimplify.cc @@ -2092,15 +2092,6 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data) break; case CALL_EXPR: - /* Evaluate function concept checks instead of treating them as - normal functions. */ - if (concept_check_p (stmt)) - { - *stmt_p = evaluate_concept_check (stmt); - * walk_subtrees = 0; - break; - } - if (!wtd->no_sanitize_p && sanitize_flags_p ((SANITIZE_NULL | SANITIZE_ALIGNMENT | SANITIZE_VPTR))) diff --git a/gcc/cp/except.cc b/gcc/cp/except.cc index 3c69ab69502..0231bd2507d 100644 --- a/gcc/cp/except.cc +++ b/gcc/cp/except.cc @@ -1074,8 +1074,6 @@ check_noexcept_r (tree *tp, int *walk_subtrees, void *) We could use TREE_NOTHROW (t) for !TREE_PUBLIC fns, though... */ tree fn = cp_get_callee (t); - if (concept_check_p (fn)) - return NULL_TREE; tree type = TREE_TYPE (fn); gcc_assert (INDIRECT_TYPE_P (type)); type = TREE_TYPE (type);