From patchwork Wed Apr 26 08:33:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 1773943 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=FB4kYcZs; dkim-atps=neutral Received: from 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5sfl1Dnrz23vG for ; Wed, 26 Apr 2023 18:36:47 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1291938768B9 for ; Wed, 26 Apr 2023 08:36:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1291938768B9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682498205; bh=7KZtKOGcjevaDA++B6kHJviyO5rBqBAPsZ+TgSssMUQ=; 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=FB4kYcZsvsSjqTsjgaESRD5eFgIx2j/FuTBtDdZrdmCykl6Dob+vrvqmLmbhj1Ooy KsslaTwS8LaWVghDnaz9HK4okwoBci94tuJ1WI5w2tR8iIYvLQ429HnNHmEnT4frvq CC1P5lKN7XUQ+WdlqVogrQilyK/ZczKNWENXmohE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 3827D3857736 for ; Wed, 26 Apr 2023 08:34:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3827D3857736 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-368-9QHIT39JPmSazvDzlxgt0w-1; Wed, 26 Apr 2023 04:34:21 -0400 X-MC-Unique: 9QHIT39JPmSazvDzlxgt0w-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3719F1C0896B for ; Wed, 26 Apr 2023 08:34:21 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.195.54]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C2B564C82F; Wed, 26 Apr 2023 08:34:20 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.17.1/8.17.1) with ESMTPS id 33Q8YIra313630 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 26 Apr 2023 10:34:18 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 33Q8YIY7313629; Wed, 26 Apr 2023 10:34:18 +0200 To: GCC patches Cc: Andrew MacLeod , Aldy Hernandez Subject: [COMMITTED] Remove irange::constant_p. Date: Wed, 26 Apr 2023 10:33:27 +0200 Message-Id: <20230426083328.313566-8-aldyh@redhat.com> In-Reply-To: <20230426083328.313566-1-aldyh@redhat.com> References: <20230426083328.313566-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Aldy Hernandez via Gcc-patches From: Aldy Hernandez Reply-To: Aldy Hernandez Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" gcc/ChangeLog: * value-range-pretty-print.cc (vrange_printer::visit): Remove constant_p use. * value-range.cc (irange::constant_p): Remove. (irange::get_nonzero_bits_from_range): Remove constant_p use. * value-range.h (class irange): Remove constant_p. (irange::num_pairs): Remove constant_p use. --- gcc/value-range-pretty-print.cc | 13 ------------- gcc/value-range.cc | 14 -------------- gcc/value-range.h | 8 ++++++-- 3 files changed, 6 insertions(+), 29 deletions(-) diff --git a/gcc/value-range-pretty-print.cc b/gcc/value-range-pretty-print.cc index d20e2562431..a11c5a621f8 100644 --- a/gcc/value-range-pretty-print.cc +++ b/gcc/value-range-pretty-print.cc @@ -63,19 +63,6 @@ vrange_printer::visit (const irange &r) const pp_string (pp, "VARYING"); return; } - // Handle legacy symbolics. - if (!r.constant_p ()) - { - if (r.kind () == VR_ANTI_RANGE) - pp_character (pp, '~'); - pp_character (pp, '['); - dump_generic_node (pp, r.min (), 0, TDF_NONE, false); - pp_string (pp, ", "); - dump_generic_node (pp, r.max (), 0, TDF_NONE, false); - pp_character (pp, ']'); - print_irange_bitmasks (r); - return; - } for (unsigned i = 0; i < r.num_pairs (); ++i) { pp_character (pp, '['); diff --git a/gcc/value-range.cc b/gcc/value-range.cc index ebadea8b917..58ae2c157db 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -1351,16 +1351,6 @@ irange::operator== (const irange &other) const return nz1 == nz2; } -/* Return TRUE if this is a constant range. */ - -bool -irange::constant_p () const -{ - return (m_num_ranges > 0 - && TREE_CODE (min ()) == INTEGER_CST - && TREE_CODE (max ()) == INTEGER_CST); -} - /* If range is a singleton, place it in RESULT and return TRUE. Note: A singleton can be any gimple invariant, not just constants. So, [&x, &x] counts as a singleton. */ @@ -2835,10 +2825,6 @@ irange::invert () wide_int irange::get_nonzero_bits_from_range () const { - // For legacy symbolics. - if (!constant_p ()) - return wi::shwi (-1, TYPE_PRECISION (type ())); - wide_int min = lower_bound (); wide_int max = upper_bound (); wide_int xorv = min ^ max; diff --git a/gcc/value-range.h b/gcc/value-range.h index 1012d007261..2442f8eed70 100644 --- a/gcc/value-range.h +++ b/gcc/value-range.h @@ -169,7 +169,6 @@ public: // Deprecated legacy public methods. tree min () const; // DEPRECATED tree max () const; // DEPRECATED - bool constant_p () const; // DEPRECATED bool legacy_verbose_union_ (const class irange *); // DEPRECATED bool legacy_verbose_intersect (const irange *); // DEPRECATED @@ -692,7 +691,12 @@ inline unsigned irange::num_pairs () const { if (m_kind == VR_ANTI_RANGE) - return constant_p () ? 2 : 1; + { + bool constant_p = (TREE_CODE (min ()) == INTEGER_CST + && TREE_CODE (max ()) == INTEGER_CST); + gcc_checking_assert (constant_p); + return 2; + } else return m_num_ranges; }