From patchwork Mon Sep 23 03:47:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 1988385 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=ZRtbF9IM; 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 4XBpr53k7Pz1xsp for ; Mon, 23 Sep 2024 13:48:37 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 45F1D385840A for ; Mon, 23 Sep 2024 03:48:35 +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 CA9ED3858D39 for ; Mon, 23 Sep 2024 03:48:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CA9ED3858D39 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 CA9ED3858D39 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=1727063287; cv=none; b=D5Bzd4harKGzazWhnHwxyUyDbQbWslsJGx73odd3BWPX5E2ORKb57HXKd1CkiW8gZaV2hYr18PeM1hnDN9OmDkNsW3FkpLcqmXK3Cm1MpcD7ci2ajs5UsB9XVJeYmH1Z5gRn0tOQy2M61RkqpxUa0jliKupHbsz9i9XUjsATqAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727063287; c=relaxed/simple; bh=qatwvu4YI5WB4REpORc2LN5WWNZLv1Hs4ddZvHxHzb0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=hHNRoVZRzWAYjV9B1zmGJ1mcgZ5or2ViSXLUCX//P9eqENqQMZXnXQwfvDGhYfLIXAr2LRYBNXPbFwX7T6mGVFb7WenIDUrsWBzDnLRJn+J3ixjEkeoQ7xLBK9h9GIkL1WadIyM3H1j29ZpNCd4v8Rhgq1vmCP+7CqlpmiWchOw= 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 48MNnQA2011775 for ; Mon, 23 Sep 2024 03:48:05 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= mCP471U26eoqU3hD12MTFnr5JXkTeENo+cal+2RMeNQ=; b=ZRtbF9IMHJuzUCv5 EV/PVwUC5o7Q3rmlTN8MB+OiRCz3SVMmSMlH/r7i1ctIom1NUlFO2R4qdY8FfhQe nzCPB+L0FL0iWvd6J1mQBKTdrzAfzZrc5TvbRWF5kDTzdifziBTieA63pXg52JY7 GW13eYLdI9h8kYn8aXl04Jqy5IRf5KzTZBR05eQg4Yj8mhsKIoC4XAphPDnf/tWT ad3Nqh//7DLWzBmWfouuQ1ejQ9BJEtqPb5BWCRq/D4QrSkS0rmKmPc6ObwR9AwRg /h5ENqwF294hxsWV++kUEcya9Br/1QwAaIPqdO8aoVf3eIIyXZ+1Q1b2ZGDPXovD zelCjw== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 41sph6kmht-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 23 Sep 2024 03:48:05 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA05.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 48N3m4xp013485 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 23 Sep 2024 03:48:04 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; Sun, 22 Sep 2024 20:48:03 -0700 From: Andrew Pinski To: CC: Andrew Pinski Subject: [PATCH 3/3] gimple: Simplify gimple_seq_nondebug_singleton_p Date: Sun, 22 Sep 2024 20:47:50 -0700 Message-ID: <20240923034750.718980-3-quic_apinski@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240923034750.718980-1-quic_apinski@quicinc.com> References: <20240923034750.718980-1-quic_apinski@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) 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: VpmF5tV288_mBnlyawBWaz_ueBnzLnuJ X-Proofpoint-ORIG-GUID: VpmF5tV288_mBnlyawBWaz_ueBnzLnuJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxlogscore=868 mlxscore=0 adultscore=0 phishscore=0 suspectscore=0 priorityscore=1501 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2408220000 definitions=main-2409230026 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, 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 The implementation of gimple_seq_nondebug_singleton_p was convoluted on how to determine if the sequence was a singleton (which could contain debug statements). This simplifies the function into two calls. One to get the start after all of the debug statements and then check to see if it is at the one before the end (or there is only debug statements afterwards). Bootstrapped and tested on x86_64-linux-gnu (including ada). gcc/ChangeLog: * gimple-iterator.h (gimple_seq_nondebug_singleton_p): Rewrite to be simplely, gsi_start_nondebug/gsi_one_nondebug_before_end_p. Signed-off-by: Andrew Pinski --- gcc/gimple-iterator.h | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/gcc/gimple-iterator.h b/gcc/gimple-iterator.h index 501f0549d92..97176d639d9 100644 --- a/gcc/gimple-iterator.h +++ b/gcc/gimple-iterator.h @@ -430,28 +430,9 @@ gsi_seq (gimple_stmt_iterator i) inline bool gimple_seq_nondebug_singleton_p (gimple_seq seq) { - gimple_stmt_iterator gsi; - - /* Find a nondebug gimple. */ - gsi.ptr = gimple_seq_first (seq); - gsi.seq = &seq; - gsi.bb = NULL; - while (!gsi_end_p (gsi) - && is_gimple_debug (gsi_stmt (gsi))) - gsi_next (&gsi); - - /* No nondebug gimple found, not a singleton. */ - if (gsi_end_p (gsi)) - return false; - - /* Find a next nondebug gimple. */ - gsi_next (&gsi); - while (!gsi_end_p (gsi) - && is_gimple_debug (gsi_stmt (gsi))) - gsi_next (&gsi); + gimple_stmt_iterator gsi = gsi_start_nondebug (seq); - /* Only a singleton if there's no next nondebug gimple. */ - return gsi_end_p (gsi); + return gsi_one_nondebug_before_end_p (gsi); } #endif /* GCC_GIMPLE_ITERATOR_H */