From patchwork Tue Jul 13 13:25:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Sayle X-Patchwork-Id: 1504610 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=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nextmovesoftware.com header.i=@nextmovesoftware.com header.a=rsa-sha256 header.s=default header.b=qsWFHIRI; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GPLxX1pn7z9sW8 for ; Tue, 13 Jul 2021 23:26:06 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6A5ED395543B for ; Tue, 13 Jul 2021 13:26:03 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from server.nextmovesoftware.com (server.nextmovesoftware.com [162.254.253.69]) by sourceware.org (Postfix) with ESMTPS id 091F63955406 for ; Tue, 13 Jul 2021 13:25:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 091F63955406 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nextmovesoftware.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nextmovesoftware.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nextmovesoftware.com; s=default; h=Content-Type:MIME-Version:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=0VRNrJj9x5I+BX2vIAsg58QPtfvlvmQRUavRo00sF0I=; b=qsWFHIRIEMlnFUp2HfcLngkSub mV6/SD+CIDdUjmbRyjf5KP5xYWJBd+QU6ovLQMlzOhyNMqivtL2xktowirrV2eNhMay8ky51/Y+5s cQzrXlCpCyyQEa9L0+RQHjbn6FE4u2mMnGs5x4J8rmjMHvq+KBQaI9mV3Fld4qwuz4pU4pA1t5E9W b2fE0arg/Z2Gl+UKhfhr1SgQt7bOZlmVYRt1UWuCTAuqogg4+g+ACn9MM8p2oHxafPD+nu8EeJ3GZ reyCZr5jZXizPgPLRGBYsKjwBlIrZ+6RbJgIZueUbJZNhcIrSM7QAwx8r34R00AixkZ8SQcVZ+UvJ eOuAza3g==; Received: from host86-169-60-32.range86-169.btcentralplus.com ([86.169.60.32]:64110 helo=Dell) by server.nextmovesoftware.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1m3IPc-0001PB-9x; Tue, 13 Jul 2021 09:25:24 -0400 From: "Roger Sayle" To: "'GCC Patches'" Subject: [Committed] Make gimple_could_trap_p const-safe. Date: Tue, 13 Jul 2021 14:25:21 +0100 Message-ID: <00e201d777ea$88e96a10$9abc3e30$@nextmovesoftware.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: Add36Xs+MzR08fS8RLCoV/Br3rNTPw== Content-Language: en-gb X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server.nextmovesoftware.com X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - nextmovesoftware.com X-Get-Message-Sender-Via: server.nextmovesoftware.com: authenticated_id: roger@nextmovesoftware.com X-Authenticated-Sender: server.nextmovesoftware.com: roger@nextmovesoftware.com X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 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 Sender: "Gcc-patches" On Mon, Jul 12, 2021 Richard Biener wrote: > There's const-correctness pieces in your patch - those are OK under the obvious rule and you might want to push them separately. Allow gimple_could_trap_p (which previously took a non-const gimple) to be called from functions that take a const gimple (such as gimple_has_side_effects), and update its prototypes. These chunks have been (re)tested on x86_64-pc-linux-gnu with a "make bootstrap" and "make -k check" with no new failures. Committed to mainline as obvious/pre-approved. 2021-07-13 Roger Sayle Richard Biener gcc/ChangeLog * gimple.c (gimple_could_trap_p_1): Make S argument a "const gimple*". Preserve constness in call to gimple_asm_volatile_p. (gimple_could_trap_p): Make S argument a "const gimple*". * gimple.h (gimple_could_trap_p_1, gimple_could_trap_p): Update function prototypes. Thanks, Roger diff --git a/gcc/gimple.c b/gcc/gimple.c index f1044e9..66edc1e 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -2129,7 +2136,7 @@ gimple_has_side_effects (const gimple *s) S is a GIMPLE_ASSIGN, the LHS of the assignment is also checked. */ bool -gimple_could_trap_p_1 (gimple *s, bool include_mem, bool include_stores) +gimple_could_trap_p_1 (const gimple *s, bool include_mem, bool include_stores) { tree t, div = NULL_TREE; enum tree_code op; @@ -2146,7 +2153,7 @@ gimple_could_trap_p_1 (gimple *s, bool include_mem, bool include_stores) switch (gimple_code (s)) { case GIMPLE_ASM: - return gimple_asm_volatile_p (as_a (s)); + return gimple_asm_volatile_p (as_a (s)); case GIMPLE_CALL: t = gimple_call_fndecl (s); @@ -2192,7 +2199,7 @@ gimple_could_trap_p_1 (gimple *s, bool include_mem, bool include_stores) /* Return true if statement S can trap. */ bool -gimple_could_trap_p (gimple *s) +gimple_could_trap_p (const gimple *s) { return gimple_could_trap_p_1 (s, true, true); } diff --git a/gcc/gimple.h b/gcc/gimple.h index e7dc2a4..1a2e120 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -1601,8 +1601,8 @@ void gimple_set_lhs (gimple *, tree); gimple *gimple_copy (gimple *); void gimple_move_vops (gimple *, gimple *); bool gimple_has_side_effects (const gimple *); -bool gimple_could_trap_p_1 (gimple *, bool, bool); -bool gimple_could_trap_p (gimple *); +bool gimple_could_trap_p_1 (const gimple *, bool, bool); +bool gimple_could_trap_p (const gimple *); bool gimple_assign_rhs_could_trap_p (gimple *); extern void dump_gimple_statistics (void); unsigned get_gimple_rhs_num_ops (enum tree_code);