| Message ID | 20260805141722.3769280-2-aldy@quesejoda.com |
|---|---|
| Headers |
Return-Path: <gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 317E34BAE7DE for <patchwork@sourceware.org>; Wed, 5 Aug 2026 14:18:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 317E34BAE7DE Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=quesejoda.com header.i=@quesejoda.com header.a=rsa-sha256 header.s=dreamhost header.b=ppeQueEv X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from poodle.tulip.relay.mailchannels.net (poodle.tulip.relay.mailchannels.net [23.83.218.249]) by sourceware.org (Postfix) with ESMTPS id 5A84C4BA79BB for <gcc-patches@gcc.gnu.org>; Wed, 5 Aug 2026 14:17:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5A84C4BA79BB Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=quesejoda.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=quesejoda.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5A84C4BA79BB Authentication-Results: sourceware.org; arc=none smtp.remote-ip=23.83.218.249 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1785939468; cv=none; b=vKEigP1AUFV7J0zfqkLfO0foTRs3xwdKDZCgZPTZbyhMvRnczhBU2FuAWjIwpIQl6PbtTjL2ym0mdBIDJKtYn2iivOokrj96T1gGr8z7lzMDrT177g/G7PdJ+/8dPcfCJqf1fH7X9OBgxLoTxFE6Kn9jyDWN+btqY3xXrmPooLQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1785939468; c=relaxed/simple; bh=zt+yTeGyyvGLVsDmkEZ1rvLVu2jnd74puHcRoqc7FFk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=enJ4VwlGs3xS1eZNpAn7ECtvjJVDAl7cs5NqLN0RX3823OkrjzSq4Xw8eRDlNL1QVfurew6TqqU/ELDdx6PBI508kqCoDop/MlodcCd9slsZRiOdgsgahnyQuay96A92D9QiBcQRnICP5F+kN/rOsynlv7YS18dI9R8HQbjhOMA= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=quesejoda.com header.i=@quesejoda.com header.a=rsa-sha256 header.s=dreamhost header.b=ppeQueEv DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5A84C4BA79BB X-Sender-Id: dreamhost|x-authsender|aldy@quesejoda.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 35FFF94297D; Wed, 05 Aug 2026 14:17:47 +0000 (UTC) Received: from pdx1-sub0-mail-a205.dreamhost.com (100-111-241-177.trex-nlb.outbound.svc.cluster.local [100.111.241.177]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id D1D409425D9; Wed, 05 Aug 2026 14:17:46 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|aldy@quesejoda.com X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|aldy@quesejoda.com X-MailChannels-Auth-Id: dreamhost X-Absorbed-Supply: 568a91dd526d89d9_1785939467031_1030262167 X-MC-Loop-Signature: 1785939467031:612070479 X-MC-Ingress-Time: 1785939467031 Received: from pdx1-sub0-mail-a205.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.111.241.177 (trex/8.0.2); Wed, 05 Aug 2026 14:17:47 +0000 Received: from vesper.quesejoda.com (224.85-85-184.dynamic.clientes.euskaltel.es [85.85.184.224]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: aldy@quesejoda.com) by pdx1-sub0-mail-a205.dreamhost.com (Postfix) with ESMTPSA id 4hFXYj3yJmz1R; Wed, 5 Aug 2026 07:17:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quesejoda.com; s=dreamhost; t=1785939466; bh=Ezo9eAKFlnfa5Qi8jaxeJ3tem1fReegBeWap86YzJ5U=; h=From:To:Cc:Subject:Date:Content-Transfer-Encoding; b=ppeQueEvWwX2eMOBSRf7SEFHqEWk9Gmt7GyDsoXPrqz4ERzvAlUjY2mVXr4yCafAe 0AGYPzlBua4qEttPh8RCdMGhpsiaDfKQEVcbtIZfsGBpIaBiwqbyha8mGO08bMuH/v 8OGFBzHfQ7FDwf2TCr2oWPSNYNZUEGtJgToTByp8+HJWP03WJWejKmnGs1SAQTLuNo HsxMgiENTcFbBLfTLR9p8HD/A97zRu0hA9u45E6/tREvER863i9S2oV8e5YoR5dRKT +VMtKiGqJJPCceSO4HXxRNn4q+162oWBzLKT6wQnQ8RKJxCC2Hyo72u6IXEIfWx5Db 75AO4L8noH3vQ== From: Aldy Hernandez <aldy@quesejoda.com> To: gcc-patches@gcc.gnu.org Cc: jakub@redhat.com, amacleod@redhat.com, rguenther@suse.de, Aldy Hernandez <aldy@quesejoda.com> Subject: [PATCH 0/4] Replace nonzero_p with contains_zero_p Date: Wed, 5 Aug 2026 16:17:19 +0200 Message-ID: <20260805141722.3769280-2-aldy@quesejoda.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_PBL, SPF_HELO_NONE, SPF_PASS, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on 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> Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org |
| Series | Replace nonzero_p with contains_zero_p | |
Message
Aldy Hernandez
Aug. 5, 2026, 2:17 p.m. UTC
Per our discussion, nonzero_p() has always been a bit insane. It only returns true for ~[0,0] so even [13,13] is considered false. Introduce contains_zero_p(), which from the looks of it, we've already been hand crafting, as direct nonzero_p() calls were few. How does this look? Aldy *** BLURB HERE *** Aldy Hernandez (4): Add contains_zero_p to the vrange hierarchy. Use !contains_zero_p for known nonzero tests instead of nonzero_p. Implement the exact nonzero-set test without nonzero_p. Remove nonzero_p. gcc/analyzer/region-model.cc | 2 +- gcc/gimple-range-path.cc | 2 +- gcc/range-op.cc | 2 +- gcc/tree-ssa-structalias.cc | 2 +- gcc/tree-ssanames.cc | 2 +- gcc/tree-vrp.cc | 2 +- gcc/value-range-storage.cc | 21 +++++++++++++-- gcc/value-range.cc | 51 +++++++++++++----------------------- gcc/value-range.h | 24 ++++++++++------- 9 files changed, 57 insertions(+), 51 deletions(-)
Comments
On Wed, Aug 05, 2026 at 04:17:19PM +0200, Aldy Hernandez wrote: > Per our discussion, nonzero_p() has always been a bit insane. It only > returns true for ~[0,0] so even [13,13] is considered false. > Introduce contains_zero_p(), which from the looks of it, we've already > been hand crafting, as direct nonzero_p() calls were few. > > How does this look? BTW, I ran my usual LAPACK source files through each patch independently, and there are no changes to assembly, so in theory this whole set is surprisingly a non-functional change. Aldy
On Wed, 5 Aug 2026, Aldy Hernandez wrote: > On Wed, Aug 05, 2026 at 04:17:19PM +0200, Aldy Hernandez wrote: > > Per our discussion, nonzero_p() has always been a bit insane. It only > > returns true for ~[0,0] so even [13,13] is considered false. > > Introduce contains_zero_p(), which from the looks of it, we've already > > been hand crafting, as direct nonzero_p() calls were few. > > > > How does this look? > > BTW, I ran my usual LAPACK source files through each patch > independently, and there are no changes to assembly, so in theory this > whole set is surprisingly a non-functional change. You also add contains_zero_p for frange, but what does this actually mean there? irange already had contains_zero_p. I suppose we can document contains_zero_p to mean that for a value with the range val == T(0) may evaluate true? So for frange this means either -0.0 or 0.0? irange implements it in terms of contains_p which is already there for frange and that implements it as >= && <=. So I think it's all sound. OK from my side. Thanks, Richard.
On Thu, Aug 06, 2026 at 10:28:29AM +0200, Richard Biener wrote: > On Wed, 5 Aug 2026, Aldy Hernandez wrote: > > > On Wed, Aug 05, 2026 at 04:17:19PM +0200, Aldy Hernandez wrote: > > > Per our discussion, nonzero_p() has always been a bit insane. It only > > > returns true for ~[0,0] so even [13,13] is considered false. > > > Introduce contains_zero_p(), which from the looks of it, we've already > > > been hand crafting, as direct nonzero_p() calls were few. > > > > > > How does this look? > > > > BTW, I ran my usual LAPACK source files through each patch > > independently, and there are no changes to assembly, so in theory this > > whole set is surprisingly a non-functional change. > > You also add contains_zero_p for frange, but what does this actually > mean there? irange already had contains_zero_p. I meant to remove the free-standing contains_zero_p(&irange) as a follow-up, replacing all uses of it with r.contains_zero_p(). > I suppose we can document contains_zero_p to mean that > for a value with the range val == T(0) may evaluate true? So for > frange this means either -0.0 or 0.0? irange implements > it in terms of contains_p which is already there for frange > and that implements it as >= && <=. Good call. I'm adding: + // True if val == 0 may hold for some value in the range; for a float + // range that means +0.0 or -0.0. + virtual bool contains_zero_p () const = 0; Thanks. Aldy