From patchwork Sat May 4 08:30:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 1931245 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=dhMuEboD; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; 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 [8.43.85.97]) (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 4VWgvt0xpYz1xnS for ; Sat, 4 May 2024 18:34:50 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5FF87386F43B for ; Sat, 4 May 2024 08:34:48 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-44.mimecast.com (us-smtp-delivery-44.mimecast.com [207.211.30.44]) by sourceware.org (Postfix) with ESMTPS id 910263844073 for ; Sat, 4 May 2024 08:31:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 910263844073 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=localhost.redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 910263844073 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=207.211.30.44 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714811477; cv=none; b=rxzikeF5ATnqvLApVyzzKEgFwuRqe/D7aeY9N2conOIN4twQFLriwzh2ft2X/NSeDJ6rwam+iaKffWB9yVezipM4YTBAlStZJIrrmelYuIhsJroaMlc3IE/0V4T/punzJxRqWsewhn/o54vADxI6XX4Ud29al2k+aL5gz4pRq8I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714811477; c=relaxed/simple; bh=IZ5U1+XAKIMHm/Ntt2dq7mTYJUWPvyWUljjW+Y7As2g=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=W/liiF7D7dZ8Cm89iE8IudFymjuL8oXmNibmBijxnrqlQS2w1otNiSnvRYC4gaWy3g5W6GuJ7jtMVIjGsd0zfKJTnJtSF8o3S88NXHlo7kRxv2uubn/aVw1mGz/zh2ArmEfAt+hsM9Yt9D/2YQQ4/UVYvL25wdz7unbezakaFXY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714811465; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=03+mfPUS/IKtFUJo3B9fl13ZJdAS1hguDQgTasgvfzI=; b=dhMuEboDnB6/nfEgplQyRu2rz9DGpNJfI1WEPUxUVlc7/KXyayuO/Km8fwpKcajZBVNDV9 AI9RHEX++qR4njUfN2Oh1tdnJYtyb89kNbx5Y6Xgf5PAjNiWP2O6ZukX7ymbmTPYiEkk+f Te8lb7hs3zREk4qtFud3SnhNyt5S8sU= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-37-IneKZV3ANPSISjEs50eh2Q-1; Sat, 04 May 2024 04:31:01 -0400 X-MC-Unique: IneKZV3ANPSISjEs50eh2Q-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 389CC3C1014E for ; Sat, 4 May 2024 08:31:01 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.192.71]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E57DA1121312; Sat, 4 May 2024 08:31:00 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.18.1/8.17.1) with ESMTPS id 4448UxXi139808 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Sat, 4 May 2024 10:30:59 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.18.1/8.18.1/Submit) id 4448UxVm139807; Sat, 4 May 2024 10:30:59 +0200 From: Aldy Hernandez To: GCC patches Cc: Andrew MacLeod , Aldy Hernandez Subject: [COMMITTED 06/23] Add prange implementation for get_legacy_range. Date: Sat, 4 May 2024 10:30:34 +0200 Message-ID: <20240504083056.139719-7-aldyh@redhat.com> In-Reply-To: <20240504083056.139719-1-aldyh@redhat.com> References: <20240504083056.139719-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NO_DNS_FOR_FROM, 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 gcc/ChangeLog: * value-range.cc (get_legacy_range): New version for prange. --- gcc/value-range.cc | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/gcc/value-range.cc b/gcc/value-range.cc index 62170a438bf..3e1ecf69517 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -1377,6 +1377,38 @@ get_legacy_range (const irange &r, tree &min, tree &max) return VR_RANGE; } +static value_range_kind +get_legacy_range (const prange &r, tree &min, tree &max) +{ + if (r.undefined_p ()) + { + min = NULL_TREE; + max = NULL_TREE; + return VR_UNDEFINED; + } + + tree type = r.type (); + if (r.varying_p ()) + { + min = r.lbound (); + max = r.ubound (); + return VR_VARYING; + } + if (r.zero_p ()) + { + min = max = r.lbound (); + return VR_RANGE; + } + if (r.nonzero_p ()) + { + min = max = build_zero_cst (type); + return VR_ANTI_RANGE; + } + min = r.lbound (); + max = r.ubound (); + return VR_RANGE; +} + // Given a range in V, return an old-style legacy range consisting of // a value_range_kind with a MIN/MAX. This is to maintain // compatibility with passes that still depend on VR_ANTI_RANGE, and @@ -1388,8 +1420,7 @@ get_legacy_range (const vrange &v, tree &min, tree &max) if (is_a (v)) return get_legacy_range (as_a (v), min, max); - gcc_unreachable (); - return VR_UNDEFINED; + return get_legacy_range (as_a (v), min, max); } /* Set value range to the canonical form of {VRTYPE, MIN, MAX, EQUIV}.