Message ID | 20230902150957.845269-1-apinski@marvell.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ab0a:0:b0:3f2:4152:657d with SMTP id m10csp203173vqo; Sat, 2 Sep 2023 08:11:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGNsFQMmRliBIDslVeMT+Jff+ni9Lp21ZSxjgP8NN7/pmfUWMCDnBY1wPHxZqSQofBhT6cP X-Received: by 2002:a05:6512:b08:b0:4fe:279b:7603 with SMTP id w8-20020a0565120b0800b004fe279b7603mr4490515lfu.14.1693667488936; Sat, 02 Sep 2023 08:11:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693667488; cv=none; d=google.com; s=arc-20160816; b=ad6wLbfQLfpDp7i6gxgIwN51c+4Uk3plLE0O2Ns6w5xQYcdbzwzhmDAZ9dKSisVvWr 6OKWjXsKISzBnTZXj9sR1ipZVmxdfexJ+HuE4uzu1b2lZIVmWlNkV07RecvyBeKYyee1 XII6mB+PoZI4E0ZMMl3R74iDhrLGTL7qIXgoqbPiqKu5JV7qjsehxTobTid6BBj9jW4B vXGuwioOWtjXiglf5Q8TytOGxJQ5DzE2A0AAf7IiEOcD4c8pH5qRZlwL1mSegtE3PZ4d ArXFhZ+31eD4kWXkKUB3yu6BOlBFTImpudbIrkUIFVw5cVIsrAHPN+7mSYdhU6r3s1TI cKoA== 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:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=Qgci8hqJDp3fC7N1fgOgkHOOjdtY4Wvrg05dItgjvEk=; fh=XbcmRug6/SzczusyoNU1I7Lu5oY0AN2u0mWDzKoxdSs=; b=l4QJgHfKwXqpT6plFe0LULblcRyZMV/CncJgWEhGQLaN5PUwbxa23yzMZgUqRqDnDU KDS8qKSRbwrDO+e9WiqNFGV925u8LItRcDXy6UNcmC1NrVlSICehTNLxZ+AWb3xi4iHl sgYZXCiz3SPJXglv7uvehEchpGojYrvzj4Dkp30ycAp6IlunkhBe1EQc3XvmrFqFTCEV r13MMtjgDQNjPbTAmp78z0RnHTvHvnHQT7bJXogNwmBRFtZ3nhJ0+zTV/2xDl2Q4uJZE xUG5QCMxcDz6scj+8JAWSuHk3hvLuZqqZ5Xs4H48fUpXBjQITD3muzKRVLsdugrwyNkf +mpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=gtQa2RwC; 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 bf22-20020a0564021a5600b005254cb06c21si3820935edb.222.2023.09.02.08.11.28 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Sep 2023 08:11:28 -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=gtQa2RwC; 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 67D163856DD0 for <ouuuleilei@gmail.com>; Sat, 2 Sep 2023 15:10:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 67D163856DD0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1693667454; bh=Qgci8hqJDp3fC7N1fgOgkHOOjdtY4Wvrg05dItgjvEk=; h=To:CC:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=gtQa2RwC1AkGkdheEhqt+wxFz9Br75ruwaoOPcTFgDALsAb7BjruGIL2DDD6TjpAC g1+lL379+a4bTLZPUMqq9Uayqy8YOWgU+m7qSFiFo7jKxO8PhCJqrizR3sEd0sCZwm PZDdnUnlhfcMrp4RYaDWFBKfci8JzicdnVRujlxY= 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 622D73858CD1 for <gcc-patches@gcc.gnu.org>; Sat, 2 Sep 2023 15:10:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 622D73858CD1 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 382ErQQw011467 for <gcc-patches@gcc.gnu.org>; 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-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for <gcc-patches@gcc.gnu.org>; 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:05 -0700 Received: from vpnclient.wrightpinski.org.com (unknown [10.69.242.187]) by maili.marvell.com (Postfix) with ESMTP id 318DA3F7084; Sat, 2 Sep 2023 08:10:05 -0700 (PDT) To: <gcc-patches@gcc.gnu.org> CC: Andrew Pinski <apinski@marvell.com> Subject: [PATCH 1/3] Improve ssa_name_has_boolean_range slightly Date: Sat, 2 Sep 2023 08:09:55 -0700 Message-ID: <20230902150957.845269-1-apinski@marvell.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: ZrLPPN4xoNtOpjIsOTi3-AGR8iX9rJLr X-Proofpoint-GUID: ZrLPPN4xoNtOpjIsOTi3-AGR8iX9rJLr 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Andrew Pinski via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Andrew Pinski <apinski@marvell.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1775939081024700394 X-GMAIL-MSGID: 1775939081024700394 |
Series |
[1/3] Improve ssa_name_has_boolean_range slightly
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Andrew Pinski
Sept. 2, 2023, 3:09 p.m. UTC
Right now ssa_name_has_boolean_range compares the range to range_true_and_false but instead we would get the nonzero bits and compare that to 1 instead (<=u 1). The nonzerobits comparison can be done in similar fashion. Note I think get_nonzero_bits is redundant as the range queury will return a more accurate version or the same value. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: * tree-ssanames.cc (ssa_name_has_boolean_range): Improve using range's get_nonzero_bits and use `<=u 1`. --- gcc/tree-ssanames.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Comments
On 9/2/23 09:09, Andrew Pinski via Gcc-patches wrote: > Right now ssa_name_has_boolean_range compares the range to > range_true_and_false but instead we would get the nonzero bits and > compare that to 1 instead (<=u 1). > The nonzerobits comparison can be done in similar fashion. > Note I think get_nonzero_bits is redundant as the range queury will > return a more accurate version or the same value. > > OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. > > gcc/ChangeLog: > > * tree-ssanames.cc (ssa_name_has_boolean_range): Improve > using range's get_nonzero_bits and use `<=u 1`. OK jeff
diff --git a/gcc/tree-ssanames.cc b/gcc/tree-ssanames.cc index 6c362995c1a..7940d9954d8 100644 --- a/gcc/tree-ssanames.cc +++ b/gcc/tree-ssanames.cc @@ -535,10 +535,11 @@ ssa_name_has_boolean_range (tree op) { int_range<2> r; if (get_range_query (cfun)->range_of_expr (r, op) - && r == range_true_and_false (TREE_TYPE (op))) + && !r.undefined_p () + && wi::leu_p (r.get_nonzero_bits (), 1)) return true; - if (wi::eq_p (get_nonzero_bits (op), 1)) + if (wi::leu_p (get_nonzero_bits (op), 1)) return true; }