From patchwork Tue Aug 6 21:27:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 1969680 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=quicinc.com header.i=@quicinc.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=W5NNsamM; 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 4WdmcX3th9z1yfM for ; Wed, 7 Aug 2024 07:27:56 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 51CFF385B50D for ; Tue, 6 Aug 2024 21:27:54 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by sourceware.org (Postfix) with ESMTPS id 27C093858C56 for ; Tue, 6 Aug 2024 21:27:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 27C093858C56 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=quicinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 27C093858C56 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722979649; cv=none; b=rMJh1gv1OPenS9rHMroXN/k+I4oroR1W+gXkwE1TyyppIFYCZ+JfMJAfJq23kZs1nt8qf6oeRk4lVGZ6zIXWlAw4wXrM8Oo0RYHUly39xwRmvqMPqMKFdAO7RGiacMrcWYOTrSk0X2vlE4suHqqqayzo6dSQoGue4DsaC4i0aDY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722979649; c=relaxed/simple; bh=wp24D37+hGeLKwRd4fp+l0/NLwKk78MbCatZyXYBFjg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=FzKEL1cxYMPCZksVBWXV+89UtMhT9Lq22i5fOsGuaiMI5I5bBWuLF9l8Fj4xxcWVZfDkrbACBrt4t64KPVJ5AuYIK/LEST0QhyR4++fIJupZaD/4PhuW65e6CLUlvTN0CM51BN+z1dfGMPH4Gk+1CyjuNxgAiBTym47hQ6ufzx4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 476H6Xid023103 for ; Tue, 6 Aug 2024 21:27:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= YbwjhiVGj6RvWYAnHGhDc5Ew/zj7cghtEWOK53MbmD8=; b=W5NNsamM/pZYq9hY StjCqH4uXdek4PSQQSThYKgx9zO7GhPntXW0VLskVWWEhV0mbh+te4kwBTu3wIhU 3OP0wcXFSdcSKxfr7aW4Sq1CPk22JtXDqDPmbc3JJuPT41eK9dZvDCd/o+NFqBSJ FFEPPIUpxK+X08lAnJhgZ2u81LrK1Rnano0kG8ljsfe81TcfGRyl8IVYOoTwNKcu t0ZK8G5Z+Gcqe1baaaSRpd3/CJBvWm3bPYdHeLedtXY/Ojw0z3xBpobJ2NpqNu4Q uKW5Qu5fYH3f7MqJ12BdieCVzL9N4ESLGckGW6RlUhIEZdlW79WKZQgeerX4OFkx kaCCzw== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 40sbvggtc1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Aug 2024 21:27:26 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA03.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 476LRPrI010478 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 6 Aug 2024 21:27:25 GMT Received: from hu-apinski-lv.qualcomm.com (10.49.16.6) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 6 Aug 2024 14:27:25 -0700 From: Andrew Pinski To: CC: Andrew Pinski Subject: [PATCH 1/5] range: Make range_op_table class final Date: Tue, 6 Aug 2024 14:27:10 -0700 Message-ID: <20240806212714.308434-2-quic_apinski@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240806212714.308434-1-quic_apinski@quicinc.com> References: <20240806212714.308434-1-quic_apinski@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: i7jamqsELc7n__kbkm-xuMNxWKsw5yFJ X-Proofpoint-ORIG-GUID: i7jamqsELc7n__kbkm-xuMNxWKsw5yFJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-06_17,2024-08-06_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 mlxscore=0 mlxlogscore=798 adultscore=0 malwarescore=0 clxscore=1015 phishscore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2408060150 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 Since there will be only one instance of this class alive at any time, it is better to declare this class as final. Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * range-op.h (class range_op_table): Declare as a final class. Signed-off-by: Andrew Pinski --- gcc/range-op.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/range-op.h b/gcc/range-op.h index e415f87d7e6..8edf967a445 100644 --- a/gcc/range-op.h +++ b/gcc/range-op.h @@ -388,7 +388,7 @@ extern void wi_set_zero_nonzero_bits (tree type, // This implements the range operator tables as local objects. -class range_op_table +class range_op_table final { public: range_op_table (); From patchwork Tue Aug 6 21:27:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 1969683 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=quicinc.com header.i=@quicinc.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=ILGQDdOc; 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 4Wdmdg72n9z1yfC for ; Wed, 7 Aug 2024 07:28:55 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C89E9385C6CD for ; Tue, 6 Aug 2024 21:28:53 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by sourceware.org (Postfix) with ESMTPS id 818B63858C35 for ; Tue, 6 Aug 2024 21:27:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 818B63858C35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=quicinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 818B63858C35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722979650; cv=none; b=NNnfAI9167HmXVgf9zW/dI5g9RF3RkigzHuhr7iqDCvmCoGh1DKu0tya6Di3FitvkgjcbAncoaz0snmtsEz3+68LkDBgx+9ttVm6PmsMPzbJ21gDAT/o7x0G9KKPKhrvP1naH4N6XH9bOTkU23M6UJ6mypUAuWAp0b3sUuZXFJI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722979650; c=relaxed/simple; bh=g8JwS8eOiRgoqNwXaN+LQoLCgZUNVdN4Bgnf2rhGh6o=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=W38bASphrgGQfBNYNgB/eZt/epFOXRlVl/wCNPtLFtCr3HYIQkeDShVA3PiF6gvtWb+Y5AQw3/g0DjObMV+X7dqL7yNABKMFNXqJqIGWjmFJsFgbMcWdjzWOwMajYvVqqchYd4E0u+utcvr7rypbAN0Bl/Qzq3eU+gncaN7e/Xk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 476H6Wui012190 for ; Tue, 6 Aug 2024 21:27:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= XaoS5xQwcgUn/VquH/t6bqCToOZIBNcydgla2dstWDI=; b=ILGQDdOcBIo+5u1/ RYDSpWFFbedz+CtdJErBgyQdNWITKXLT93sOlb8Gov22/QPAU+pKVAeR0z6mvJWT tnrN7KfJDb9lurK0jPT9cXbUeJq1R2FGCQB3G/w8JCez9p0ptKNujrPouj4/Jmrk 2voRbQZlXOjWkckN2wGITyMr+97EMe8CWIjJj8Ilwo81IFnz3zIq1Pl3wDVypOaM QpQRuufcpurgUUsL5G4XVrFxVNYvuUhOevyZB0H6B43L6wpk+/gNIJFtB8HrPm/F VosWFIJwBLJ0H5BAIrJ9FDLp8LFhUQ0puA6Hfz2VP47ZGIc/mjftaKSOQQOzoILY 6pks9g== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 40sbj6rsxm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Aug 2024 21:27:26 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA01.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 476LRPct027767 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 6 Aug 2024 21:27:25 GMT Received: from hu-apinski-lv.qualcomm.com (10.49.16.6) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 6 Aug 2024 14:27:25 -0700 From: Andrew Pinski To: CC: Andrew Pinski Subject: [PATCH 2/5] range: Make range_op_table a true singleton class [PR116209] Date: Tue, 6 Aug 2024 14:27:11 -0700 Message-ID: <20240806212714.308434-3-quic_apinski@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240806212714.308434-1-quic_apinski@quicinc.com> References: <20240806212714.308434-1-quic_apinski@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: Ith1dTHDTnQ4CiDYsqPke62YSYbEnsHI X-Proofpoint-GUID: Ith1dTHDTnQ4CiDYsqPke62YSYbEnsHI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-06_17,2024-08-06_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 priorityscore=1501 adultscore=0 mlxscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 clxscore=1015 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2408060150 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 This is a small cleanup with respect to the ranger_op_table class. There should only ever be one instance of ranger_op_table so this adds a static member function which returns the instance. A few variables that are defined in range-op.cc should be local to the file so wrap them with an anonymous namespace. Also change operator_table into a reference that is initialized to the singelton. This has a small extra overhead at intiialization time of the operator_table; could be improved if we used C++20's consteval. Since this happens only once, there it should be ok. Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/116209 gcc/ChangeLog: * range-op.cc (op_equal, op_not_equal, op_lt, op_le, op_gt, op_ge, op_ident, op_cst, op_cast, op_plus, op_abs, op_minus, op_negate, op_mult, op_addr, op_bitwise_not, op_bitwise_xor, op_bitwise_and, op_bitwise_or, op_min, op_max, default_operator): Wrap with anonymous namespace. (operator_table): Change to reference and initialize with range_op_table::singleton. (range_op_table::singleton): New function. * range-op.h (range_op_table): New method, singleton. Make most functions private (rather than protected). Make ctor private. Signed-off-by: Andrew Pinski --- gcc/range-op.cc | 19 ++++++++++++++----- gcc/range-op.h | 5 +++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/gcc/range-op.cc b/gcc/range-op.cc index c576f688221..56a014e99bc 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -49,8 +49,9 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa-ccp.h" #include "range-op-mixed.h" -// Instantiate the operators which apply to multiple types here. +namespace { +// Instantiate the operators which apply to multiple types here. operator_equal op_equal; operator_not_equal op_not_equal; operator_lt op_lt; @@ -74,7 +75,12 @@ operator_min op_min; operator_max op_max; // Instantaite a range operator table. -range_op_table operator_table; +range_op_table &operator_table = range_op_table::singleton(); + +// Instantiate a default range operator for opcodes with no entry. +range_operator default_operator; + +} // Invoke the initialization routines for each class of range. @@ -111,9 +117,12 @@ range_op_table::range_op_table () set (MAX_EXPR, op_max); } -// Instantiate a default range operator for opcodes with no entry. - -range_operator default_operator; +// Returns the singleton instance of the table. +range_op_table &range_op_table::singleton() +{ + static range_op_table single; + return single; +} // Create a default range_op_handler. diff --git a/gcc/range-op.h b/gcc/range-op.h index 8edf967a445..e4e11f89624 100644 --- a/gcc/range-op.h +++ b/gcc/range-op.h @@ -391,13 +391,13 @@ extern void wi_set_zero_nonzero_bits (tree type, class range_op_table final { public: - range_op_table (); inline range_operator *operator[] (unsigned code) { gcc_checking_assert (code < RANGE_OP_TABLE_SIZE); return m_range_tree[code]; } -protected: + static range_op_table &singleton(); +private: inline void set (unsigned code, range_operator &op) { gcc_checking_assert (code < RANGE_OP_TABLE_SIZE); @@ -408,6 +408,7 @@ protected: void initialize_integral_ops (); void initialize_pointer_ops (); void initialize_float_ops (); + range_op_table (); }; #endif // GCC_RANGE_OP_H From patchwork Tue Aug 6 21:27:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 1969681 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=quicinc.com header.i=@quicinc.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=Ls15wH+X; 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 4Wdmcc0gYhz1yfC for ; Wed, 7 Aug 2024 07:28:00 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EF27A385DC20 for ; Tue, 6 Aug 2024 21:27:57 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by sourceware.org (Postfix) with ESMTPS id 8F8CC3858402 for ; Tue, 6 Aug 2024 21:27:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8F8CC3858402 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=quicinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8F8CC3858402 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722979650; cv=none; b=PjUOsois8yuxT7CMbTcPX+hdFaVuJH/lcvKcXTX0UoR6j5B4yatBoKGxRMtbRAYGdmwAbLlTxW5vIl4apjL8uWb049QkUUl/gsTd7f7Ji9WITEeK3JLSaf7L7WdUyz0/YiilYKInc6nSeLxmWtCDnUomqqAAu2WOX561H+K8NMY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722979650; c=relaxed/simple; bh=5NajqrTaOsuNcXV45YIhNZZD1ai2WwBGF9HwK8zm4Ag=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Jvela+aw8N9lKuEtwWogiaJ32OZhy96UQfBoQ2Sq4d114hbsRKThLmsMSkIU9QL/OiROo53qRcuBOBJ4E+xyYx0jZ5tPVAWyqROkOo3ipEz5c6mxoNKETe5ZipAaZXBYxFTeABYlb4yEc/tx9yGrzqVGtelrVySYcGE3TN6KfZY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 476H6WRW023013 for ; Tue, 6 Aug 2024 21:27:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= vzI0k1mSUi3a/+ucf2tO71v8PZ+ZqcV82QAWkt7L8+s=; b=Ls15wH+XWH0JhhWo Y9qjpcCTgBcYvLEgq1jMcdSIRYAKEmi0EoGbdjbpnuMhfnzr7angr1xlRDij27QK 5KQ8KodqzitnNy6QR6FOw8VVrE3QRQlxFQSyNsyTIrfJvHgr5It/8DSdu1SZrQeR +PWtT0+BOnFhIpz05evJvrjNzkiMIlPBawv0TV9ofqy08HQ03CWiHpISToTDSi8V Z+s5gYdQTfIc+4olkIu9VhS454kjXFVgi97BMkl1qjrllqE/s28Yyk7WexjKghRT BpED1/YshdeojZrpubf5hBSqUjTFxBz/A7YpUcSJd2KJfwKcsrH4S+ZIe029y+E3 Jy9srQ== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 40sbvggtc2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Aug 2024 21:27:27 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA05.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 476LRP3F008579 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 6 Aug 2024 21:27:25 GMT Received: from hu-apinski-lv.qualcomm.com (10.49.16.6) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 6 Aug 2024 14:27:25 -0700 From: Andrew Pinski To: CC: Andrew Pinski Subject: [PATCH 3/5] ranger: constify range_op_table class Date: Tue, 6 Aug 2024 14:27:12 -0700 Message-ID: <20240806212714.308434-4-quic_apinski@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240806212714.308434-1-quic_apinski@quicinc.com> References: <20240806212714.308434-1-quic_apinski@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: Ob9Q1v0PCv-PSw05k_W0n5jfaQpdow-x X-Proofpoint-ORIG-GUID: Ob9Q1v0PCv-PSw05k_W0n5jfaQpdow-x X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-06_17,2024-08-06_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 mlxscore=0 mlxlogscore=966 adultscore=0 malwarescore=0 clxscore=1015 phishscore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2408060150 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 While making range_op_table a singleton, I noticed that constification should be done to `operator[]` and that operator_table could be made as const as it does not get changed after it is initialized. Bootstrapped and tested on x86_64-linux. gcc/ChangeLog: * range-op.h (range_op_table): Make operator[] const. Have singleton return const reference. * range-op.cc (range_op_table::singleton): Update return type. (operator_table): Make const. Signed-off-by: Andrew Pinski --- gcc/range-op.cc | 4 ++-- gcc/range-op.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 56a014e99bc..9a889ea4bb4 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -75,7 +75,7 @@ operator_min op_min; operator_max op_max; // Instantaite a range operator table. -range_op_table &operator_table = range_op_table::singleton(); +const range_op_table &operator_table = range_op_table::singleton(); // Instantiate a default range operator for opcodes with no entry. range_operator default_operator; @@ -118,7 +118,7 @@ range_op_table::range_op_table () } // Returns the singleton instance of the table. -range_op_table &range_op_table::singleton() +const range_op_table &range_op_table::singleton() { static range_op_table single; return single; diff --git a/gcc/range-op.h b/gcc/range-op.h index e4e11f89624..f7ecc660fb9 100644 --- a/gcc/range-op.h +++ b/gcc/range-op.h @@ -391,12 +391,12 @@ extern void wi_set_zero_nonzero_bits (tree type, class range_op_table final { public: - inline range_operator *operator[] (unsigned code) + inline range_operator *operator[] (unsigned code) const { gcc_checking_assert (code < RANGE_OP_TABLE_SIZE); return m_range_tree[code]; } - static range_op_table &singleton(); + static const range_op_table &singleton(); private: inline void set (unsigned code, range_operator &op) { From patchwork Tue Aug 6 21:27:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 1969684 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=quicinc.com header.i=@quicinc.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=ixcH4u09; 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 4Wdmdl4JsRz1yfC for ; Wed, 7 Aug 2024 07:28:59 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5E7293858402 for ; Tue, 6 Aug 2024 21:28:57 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by sourceware.org (Postfix) with ESMTPS id 12F0E385840F for ; Tue, 6 Aug 2024 21:27:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 12F0E385840F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=quicinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 12F0E385840F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722979650; cv=none; b=gJ9+GFLg7nVFM8HJRq9OncxyF04oxaaYAzKizBJqMEMTnXtFSSYWBCTD5BDQbKydRlFa52+T5ls7NsImGozY/Mvgs3k17un4ArCSfVXpvA0eZX2mDGxEx0NyaXoJ/Bqj3nhoFuJYzkj1GfgSSe7B8QfAyz/SJybEpvvkyCAcDWg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722979650; c=relaxed/simple; bh=JExkefDsjVZwvDA4v/F3ULVO0FlKuOIsG/u7+J8Na1s=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=pDWGPZZa8/QCjsPKhaabjbNHicjAj/LMrK5ymU2pGyyE2LpydV2Ifwy8EMbuwtBXFZYK4u4J9rFe/+RLfrLka+lKGZDdMssp15ISHbNypstWWuAGGdDHyFNuUl5C47xFiidzdQEcYUGb7J5uZn6u5xUEP0V1iQxugAN1WoZfPzc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 476H6Q5T007104 for ; Tue, 6 Aug 2024 21:27:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= iv6eRUfCJAiuZcbNJE1tH73PSkC++l0FmHNvCxW2vso=; b=ixcH4u091BD3nY/5 UvrbzIJaTf0ihZtzy0+LbpMKYRqHC6fKOufQ8w4GUXthfS4wqSozsDWpUnidLrJt u2XL9dSdlfLlTkciuaWEba6O/c3I3zsAc/UlNAt4lb+tiwh5oySCEktL8AyT7nsq 5e49R3XSwVRIvlfVojkSfhXEEB++DEIX96RjEvNr4be0M8YtlAibXNUryV6megrj 8CUejma3cPhH8FO06uNaVQ8KaDzcnVzw6jp7zd19Myv+X0t7URfsnr+Az10DaeIJ FeQo424tmhKsFLWoamUavO2Cwdi8flmLwvr9zPjbmc+U/YA42S3qUrjnGkHl1Xx3 174sDQ== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 40scx6rv8a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Aug 2024 21:27:27 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA02.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 476LRQDl025283 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 6 Aug 2024 21:27:26 GMT Received: from hu-apinski-lv.qualcomm.com (10.49.16.6) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 6 Aug 2024 14:27:25 -0700 From: Andrew Pinski To: CC: Andrew Pinski Subject: [PATCH 4/5] ranger: Make some classes local to the TU Date: Tue, 6 Aug 2024 14:27:13 -0700 Message-ID: <20240806212714.308434-5-quic_apinski@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240806212714.308434-1-quic_apinski@quicinc.com> References: <20240806212714.308434-1-quic_apinski@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: gpcXRvevEjgnbHijlS3x7MheEru3L5Gd X-Proofpoint-GUID: gpcXRvevEjgnbHijlS3x7MheEru3L5Gd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-06_17,2024-08-06_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 bulkscore=0 clxscore=1015 suspectscore=0 phishscore=0 spamscore=0 adultscore=0 lowpriorityscore=0 mlxscore=0 priorityscore=1501 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2408060150 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 This is another small cleanup in the ranger code, since these classes and the instance of them are local to the sources already, make them final classes and make them local by wrapping them with an anonymous namespace. Note some classes/instances were unused in the first place so I didn't deleted them but `#if 0` them out. I don't know if they are being planned to be used in the future or not but still having them be compiled in is wrong and would cause an unused variable warnings now with them being in an anonymous namespace. Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * range-op-float.cc (class foperator_unordered): Wrap with anonymous namespace and mark as final. (class foperator_ordered): Likewise. (class foperator_unordered_lt): Likewise. (class foperator_unordered_le): Likewise. (class foperator_unordered_gt): Likewise. (class foperator_unordered_ge): Likewise. (class foperator_unordered_equal): Likewise. (class foperator_ltgt): Likewise. * range-op-ptr.cc (class pointer_plus_operator): Wrap with anonymous namespace and mark as final. (class pointer_min_max_operator): #if out and mark as final. (class pointer_and_operator): Likewise. (class pointer_or_operator): Likewise. (class operator_pointer_diff): Wrap with anonymous namespace and mark as final. Signed-off-by: Andrew Pinski --- gcc/range-op-float.cc | 27 +++++++++++++++++++-------- gcc/range-op-ptr.cc | 20 +++++++++++++++----- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index 2754dd87568..e8e06d5fec3 100644 --- a/gcc/range-op-float.cc +++ b/gcc/range-op-float.cc @@ -1333,9 +1333,11 @@ operator_ge::op1_op2_relation (const irange &lhs, const frange &, return VREL_VARYING; } +namespace { + // UNORDERED_EXPR comparison. -class foperator_unordered : public range_operator +class foperator_unordered final : public range_operator { using range_operator::fold_range; using range_operator::op1_range; @@ -1409,7 +1411,7 @@ foperator_unordered::op1_range (frange &r, tree type, // ORDERED_EXPR comparison. -class foperator_ordered : public range_operator +class foperator_ordered final : public range_operator { using range_operator::fold_range; using range_operator::op1_range; @@ -1478,6 +1480,8 @@ foperator_ordered::op1_range (frange &r, tree type, return true; } +} // anonymous namespace + bool operator_negate::fold_range (frange &r, tree type, const frange &op1, const frange &op2, @@ -1607,7 +1611,9 @@ operator_abs::op1_range (frange &r, tree type, return true; } -class foperator_unordered_lt : public range_operator +namespace { + +class foperator_unordered_lt final : public range_operator { using range_operator::fold_range; using range_operator::op1_range; @@ -1719,7 +1725,7 @@ foperator_unordered_lt::op2_range (frange &r, tree type, return true; } -class foperator_unordered_le : public range_operator +class foperator_unordered_le final : public range_operator { using range_operator::fold_range; using range_operator::op1_range; @@ -1827,7 +1833,7 @@ foperator_unordered_le::op2_range (frange &r, return true; } -class foperator_unordered_gt : public range_operator +class foperator_unordered_gt final : public range_operator { using range_operator::fold_range; using range_operator::op1_range; @@ -1939,7 +1945,7 @@ foperator_unordered_gt::op2_range (frange &r, return true; } -class foperator_unordered_ge : public range_operator +class foperator_unordered_ge final : public range_operator { using range_operator::fold_range; using range_operator::op1_range; @@ -2050,7 +2056,7 @@ foperator_unordered_ge::op2_range (frange &r, tree type, return true; } -class foperator_unordered_equal : public range_operator +class foperator_unordered_equal final : public range_operator { using range_operator::fold_range; using range_operator::op1_range; @@ -2132,7 +2138,7 @@ foperator_unordered_equal::op1_range (frange &r, tree type, return true; } -class foperator_ltgt : public range_operator +class foperator_ltgt final : public range_operator { using range_operator::fold_range; using range_operator::op1_range; @@ -2214,6 +2220,8 @@ foperator_ltgt::op1_range (frange &r, tree type, return true; } +} // anonymous namespace + // Final tweaks for float binary op op1_range/op2_range. // Return TRUE if the operation is performed and a valid range is available. @@ -2729,6 +2737,7 @@ operator_mult::rv_fold (frange &r, tree type, r.set (type, lb, ub, nan_state (maybe_nan)); } +namespace { class foperator_div : public range_operator { @@ -2899,6 +2908,8 @@ private: } } fop_div; +} + // Initialize any float operators to the primary table diff --git a/gcc/range-op-ptr.cc b/gcc/range-op-ptr.cc index 24e206c00cd..e5b496eaac2 100644 --- a/gcc/range-op-ptr.cc +++ b/gcc/range-op-ptr.cc @@ -288,7 +288,9 @@ build_ge (prange &r, tree type, const prange &val) r.set (type, val.lower_bound (), max_limit (type)); } -class pointer_plus_operator : public range_operator +namespace { + +class pointer_plus_operator final : public range_operator { using range_operator::update_bitmask; using range_operator::fold_range; @@ -451,7 +453,11 @@ pointer_plus_operator::op2_range (irange &r, tree type, return true; } -class pointer_min_max_operator : public range_operator +#if 0 + +/* These are not used currently. Since we are in an + anonymous namespace, they are needed to be #if'ed out. */ +class pointer_min_max_operator final : public range_operator { public: virtual void wi_fold (irange & r, tree type, @@ -479,7 +485,7 @@ pointer_min_max_operator::wi_fold (irange &r, tree type, r.set_varying (type); } -class pointer_and_operator : public range_operator +class pointer_and_operator final : public range_operator { public: virtual void wi_fold (irange &r, tree type, @@ -503,7 +509,7 @@ pointer_and_operator::wi_fold (irange &r, tree type, } -class pointer_or_operator : public range_operator +class pointer_or_operator final : public range_operator { public: using range_operator::op1_range; @@ -565,7 +571,9 @@ pointer_or_operator::wi_fold (irange &r, tree type, r.set_varying (type); } -class operator_pointer_diff : public range_operator +#endif + +class operator_pointer_diff final : public range_operator { using range_operator::update_bitmask; using range_operator::op1_op2_relation_effect; @@ -612,6 +620,8 @@ operator_pointer_diff::op1_op2_relation_effect (irange &lhs_range, tree type, rel); } +} // anonymous namespace + bool operator_identity::fold_range (prange &r, tree type ATTRIBUTE_UNUSED, const prange &lh ATTRIBUTE_UNUSED, From patchwork Tue Aug 6 21:27:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 1969682 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=quicinc.com header.i=@quicinc.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=o6Mfk0aB; 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 4Wdmcj57v2z1yfC for ; Wed, 7 Aug 2024 07:28:05 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 84EB8385DDD7 for ; Tue, 6 Aug 2024 21:28:03 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by sourceware.org (Postfix) with ESMTPS id 5C1B13858416 for ; Tue, 6 Aug 2024 21:27:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5C1B13858416 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=quicinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5C1B13858416 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722979651; cv=none; b=lML80cDihNxw7kS06cXBdQ4CJxgk/+mmJEqhyRCJSGhXc9946Zjpfq230OqAc7vlk+MsU8PZP8i/E2oLK0sFsHZRvyueG/y/lhk6tmFncxznqnIvxEHzHME3Z9a19X8cl/LL6bwAYh7+vn+To9UgI7/+TcXdyOAY4byDF2net4c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722979651; c=relaxed/simple; bh=ztT3bvnYjEGPZws9WxYlneKoswDqr1N3hi8C93W5x5s=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=qAkvucVSMptrkFCosLUmt432kxLIOFfDkldAWZLTacFKVZNpVokKmDR/EYnDSSW4odZzQtTvICkUltIGyRtvSyH8B+kpAIySWI7JmS/lCd2Y4S7/pvw5cwRFOTJu+rGoe5bPthW/xQXLfE+uQyNGmXLB0t1mWzAfb4ujhaa6mDA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 476H6QlZ021566 for ; Tue, 6 Aug 2024 21:27:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= vDr7uei2Z0Kt2lVknkAHwENLHW+T1E1ze3NIo/cTCuo=; b=o6Mfk0aBd2wtBPYx 6zNs6WKfrDl9fiiYRzfHTQjqSkTcuowiBfUOw7TjUuQThGrocV1h6faAGfeLW4Y4 3mGa4Vh20S88TMue9o5+T5Yv5kgpJv5JSmbmybcSzm5dBPGqXHTCJPNEAY0of06c 8mrati+TwXOUh/GZTqhfTKk9HtciXqG/ot7cUP2uvmdJtscaW2/bfHIjRgnsxAmE ub3Xq9PUEiDHdR8cF9upeyRju0fgKIQDmUGvNqP1/xrBPhPqpTIWvSUi6LgcsT2I PxNM2tvE9iBUtwoNwCQX1SyxmlAAuxc5Xm7r/+IR9R1o9bwWkVAVKhNUhx3DGtpR ua2d0w== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 40sbgs0r1d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Aug 2024 21:27:27 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA02.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 476LRQcC025286 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 6 Aug 2024 21:27:26 GMT Received: from hu-apinski-lv.qualcomm.com (10.49.16.6) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 6 Aug 2024 14:27:26 -0700 From: Andrew Pinski To: CC: Andrew Pinski Subject: [PATCH 5/5] ranger: Fix LTO uninitialized variable warning about m_range_tree Date: Tue, 6 Aug 2024 14:27:14 -0700 Message-ID: <20240806212714.308434-6-quic_apinski@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240806212714.308434-1-quic_apinski@quicinc.com> References: <20240806212714.308434-1-quic_apinski@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: ohWLtFMuYfdwaad_wfHy596iMzCWjXjZ X-Proofpoint-GUID: ohWLtFMuYfdwaad_wfHy596iMzCWjXjZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-06_17,2024-08-06_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 impostorscore=0 malwarescore=0 suspectscore=0 phishscore=0 mlxscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 adultscore=0 spamscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2408060150 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 With LTO, initialize_integral_ops, initialize_integral_ops and initialize_float_ops are all inlined into the constructor of range_op_table, so you get an uninitialized warning about m_range_tree not being initialized due to it having a clobber at the begining of the constructor. This adds a value initialization for m_range_tree to have it initialized inside the constructor. This has a small startup cost since we are zeroing the whole array a second time though since we setting it later on to be, the cost of pulling it into the cache is going to be small. Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: * range-op.h (class range_op_table): Value initialize m_range_tree. Signed-off-by: Andrew Pinski --- gcc/range-op.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/range-op.h b/gcc/range-op.h index f7ecc660fb9..265d3c21691 100644 --- a/gcc/range-op.h +++ b/gcc/range-op.h @@ -404,7 +404,12 @@ private: gcc_checking_assert (m_range_tree[code] == NULL); m_range_tree[code] = &op; } - range_operator *m_range_tree[RANGE_OP_TABLE_SIZE]; + + /* m_range_tree needs to be value initialized instead + of default initialized; otherwise it could be considered + as unitialized even though it is zero initialized due to + being a static variable, there is a clobber in the ctor. */ + range_operator *m_range_tree[RANGE_OP_TABLE_SIZE]{}; void initialize_integral_ops (); void initialize_pointer_ops (); void initialize_float_ops ();