From patchwork Sat Sep 2 15:09:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 137424 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ab0a:0:b0:3f2:4152:657d with SMTP id m10csp203132vqo; Sat, 2 Sep 2023 08:11:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF0jzbMQuXFEPrsjbv7fOp50lFuP1QxQhQ2Ibrz4YrinVkHUgT5y9r8u5MNhxln4mBz6tlw X-Received: by 2002:a17:906:6a0d:b0:9a2:26fa:8752 with SMTP id qw13-20020a1709066a0d00b009a226fa8752mr9283811ejc.10.1693667485262; Sat, 02 Sep 2023 08:11:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693667485; cv=none; d=google.com; s=arc-20160816; b=DYbanFBePRK4BUeAw5R0k9NorIEjv71Mp0ASnqCx8RPsYiPAxrFNlhvn6N+nIN4Qks /9aGlzVTwq+I8v3dEP7PawCnWzpTJJ8l03VWVP8InBYwan7uih21bNYLQ6eYxVpvqZLb c6l3bYcVVs03jOx8q3+BUDUNV81jWja54mrZ/ch7wWHy19ZlIgFAFSKnruBPABwheFdy fJeqRb+FpAceFvuXFtgdTtdIYDtOL+IHF//SI503pLTt4ZDCXwZoJS2OcOXD4No0/0cP TTZOiEIUfjIs1cMrTbON3D/jOVdOd+iFZKwrHCH1A+EzklimGUq6FYI8rieYkAxatRfr fBSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=KZu4YcadqQln5Pw2E4OO92P6PgOEZbpOdC6Sqr1JSkg=; fh=XbcmRug6/SzczusyoNU1I7Lu5oY0AN2u0mWDzKoxdSs=; b=OCu6gF1dHR7nF1CWVrh6P5Sjm4LYCVH/xVMmAvbm0vkIwis0YzSXU37Miyr0M3c6z5 bO2ZetfxzAiATmfJzG5h/MNekZV5avp5euT0KSeyW4IhYxFb/n/YnKNU19HzAZkCJiL8 RN/bxTN0fNFsr5IadT/mvJfv15v24tlq5CtJARRJ054SjAAc4Ced9rQOyA9yn3OPVZv3 IeSImaNkfN7QMH9xKIg/3J2+LIMNkoQNoaxWwYtyoKeGpkh+2RI0BUqLtxjyMRe9HnnS LMOwrHlz+t9sdkkzC2rmrqJdrhXaE6+dpWuIzRTN5sdvOaTG+8nB53NCa++Ko9wKQiRm c4NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=HehQeaog; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id tk28-20020a170907c29c00b0099d61f05e05si3683707ejc.1023.2023.09.02.08.11.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Sep 2023 08:11:25 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=HehQeaog; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B7113385B512 for ; Sat, 2 Sep 2023 15:10:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B7113385B512 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1693667452; bh=KZu4YcadqQln5Pw2E4OO92P6PgOEZbpOdC6Sqr1JSkg=; h=To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=HehQeaog20tBQdpo3scjJhH+MQ2ZlZSLwq9uBoHvDeGz3wgBe0+cdObkHpjcf4ym6 nk7o+jDQSc6ZwAjksrAt/so1mZDloyUIv2e50oSR0sBsHff6xxaqlb5EpQW6HmLgqt enzJFQxmPR8MUo/Z21FghOiG2A/ZDpe0A2oyYM44= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by sourceware.org (Postfix) with ESMTPS id 622FB3858CDA for ; Sat, 2 Sep 2023 15:10:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 622FB3858CDA Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 382ErQQx011467 for ; Sat, 2 Sep 2023 08:10:07 -0700 Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3sv2dp0hsk-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Sat, 02 Sep 2023 08:10:07 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sat, 2 Sep 2023 08:10:05 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Sat, 2 Sep 2023 08:10:06 -0700 Received: from vpnclient.wrightpinski.org.com (unknown [10.69.242.187]) by maili.marvell.com (Postfix) with ESMTP id B5EC53F709F; Sat, 2 Sep 2023 08:10:05 -0700 (PDT) To: CC: Andrew Pinski Subject: [PATCH 2/3] MATCH: Improve zero_one_valued_p by using ssa_name_has_boolean_range Date: Sat, 2 Sep 2023 08:09:56 -0700 Message-ID: <20230902150957.845269-2-apinski@marvell.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230902150957.845269-1-apinski@marvell.com> References: <20230902150957.845269-1-apinski@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: el1J9dtrtQudbV1sonHMWW8dvTCnVapX X-Proofpoint-GUID: el1J9dtrtQudbV1sonHMWW8dvTCnVapX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-02_10,2023-08-31_01,2023-05-22_02 X-Spam-Status: No, score=-14.6 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_PASS, 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: , X-Patchwork-Original-From: Andrew Pinski via Gcc-patches From: Andrew Pinski Reply-To: Andrew Pinski Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1775939077043226173 X-GMAIL-MSGID: 1775939077043226173 Currently zero_one_valued_p uses tree_nonzero_bits which uses the global ranges of the SSA Names. We can improve this via using ssa_name_has_boolean_range which uses the local ranges which are used while handling folding during VRP and other passes. OK? Bootstrapped and tested on x86_64 with no regressions. gcc/ChangeLog: * match.pd (zero_one_valued_p): Match SSA_NAMES where ssa_name_has_boolean_range returns true. --- gcc/match.pd | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/match.pd b/gcc/match.pd index b94d71d2376..04033546fc1 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -2063,6 +2063,12 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) /* zero_one_valued_p will match when a value is known to be either 0 or 1 including constants 0 or 1. Signed 1-bits includes -1 so they cannot match here. */ +/* Note ssa_name_has_boolean_range uses + the current ranger while tree_nonzero_bits uses only + the global one. */ +(match zero_one_valued_p + SSA_NAME@0 + (if (ssa_name_has_boolean_range (@0)))) (match zero_one_valued_p @0 (if (INTEGRAL_TYPE_P (type)