From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 5B66B3858C33 for ; Wed, 3 May 2023 11:41:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5B66B3858C33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683114117; 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; bh=y+WV6UzXYzxxDTSeHyroF37/K3JCYtSY2zU/r+e4r9E=; b=DQlXHJfiPeTO7zQbr4XL9CZ2AyoeDBXDzSR9A5Vi3TAbPc4L8gHlRShAKn/2o75M0qK+Cc rWuMk5lnN9V0nbOcAMEJuPB0UvZKg7qkaNIbQzasPp7aEky9Lad0irsuwlUXfBDNoCCNyt EmpIwJR4BxXAETm+G8KD4yDaHr+gKh8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-639-g_r8xv1COCKPyUpsty20-A-1; Wed, 03 May 2023 07:41:55 -0400 X-MC-Unique: g_r8xv1COCKPyUpsty20-A-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 51E13800047 for ; Wed, 3 May 2023 11:41:55 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.195.103]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EF8B52026D16; Wed, 3 May 2023 11:41:54 +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 343Bfmee662949 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 3 May 2023 13:41:48 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 343Bflmf662948; Wed, 3 May 2023 13:41:47 +0200 From: Aldy Hernandez To: GCC patches Cc: Andrew MacLeod , Aldy Hernandez Subject: [PATCH] Remove type from vrange_storage::equal_p. Date: Wed, 3 May 2023 13:41:45 +0200 Message-Id: <20230503114145.662934-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.4 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 List-Id: [Andrew, since you suggested this, is this what you had in mind?]. The equal_p method in vrange_storage is only used to compare ranges that are the same type. No sense passing the type if it can be determined from the range being compared. gcc/ChangeLog: * gimple-range-cache.cc (sbr_sparse_bitmap::set_bb_range): Do not pass type to vrange_storage::equal_p. * value-range-storage.cc (vrange_storage::equal_p): Remove type. (irange_storage::equal_p): Same. (frange_storage::equal_p): Same. * value-range-storage.h (class frange_storage): Same. --- gcc/gimple-range-cache.cc | 2 +- gcc/value-range-storage.cc | 28 +++++++++++----------------- gcc/value-range-storage.h | 6 +++--- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc index 92622fc5000..07c69ef858a 100644 --- a/gcc/gimple-range-cache.cc +++ b/gcc/gimple-range-cache.cc @@ -320,7 +320,7 @@ sbr_sparse_bitmap::set_bb_range (const_basic_block bb, const vrange &r) // Loop thru the values to see if R is already present. for (int x = 0; x < SBR_NUM; x++) - if (!m_range[x] || m_range[x]->equal_p (r, m_type)) + if (!m_range[x] || m_range[x]->equal_p (r)) { if (!m_range[x]) m_range[x] = m_range_allocator->clone (r); diff --git a/gcc/value-range-storage.cc b/gcc/value-range-storage.cc index 7d2de5e8384..1e06a7acc8d 100644 --- a/gcc/value-range-storage.cc +++ b/gcc/value-range-storage.cc @@ -206,20 +206,22 @@ vrange_storage::fits_p (const vrange &r) const return false; } -// Return TRUE if the range in storage is equal to R. +// Return TRUE if the range in storage is equal to R. It is the +// caller's responsibility to verify that the type of the range in +// storage matches that of R. bool -vrange_storage::equal_p (const vrange &r, tree type) const +vrange_storage::equal_p (const vrange &r) const { if (is_a (r)) { const irange_storage *s = static_cast (this); - return s->equal_p (as_a (r), type); + return s->equal_p (as_a (r)); } if (is_a (r)) { const frange_storage *s = static_cast (this); - return s->equal_p (as_a (r), type); + return s->equal_p (as_a (r)); } gcc_unreachable (); } @@ -375,21 +377,17 @@ irange_storage::get_irange (irange &r, tree type) const } bool -irange_storage::equal_p (const irange &r, tree type) const +irange_storage::equal_p (const irange &r) const { if (m_kind == VR_UNDEFINED || r.undefined_p ()) return m_kind == r.m_kind; if (m_kind == VR_VARYING || r.varying_p ()) - return m_kind == r.m_kind && types_compatible_p (r.type (), type); - - tree rtype = r.type (); - if (!types_compatible_p (rtype, type)) - return false; + return m_kind == r.m_kind; // ?? We could make this faster by doing the comparison in place, // without going through get_irange. int_range_max tmp; - get_irange (tmp, rtype); + get_irange (tmp, r.type ()); return tmp == r; } @@ -526,17 +524,13 @@ frange_storage::get_frange (frange &r, tree type) const } bool -frange_storage::equal_p (const frange &r, tree type) const +frange_storage::equal_p (const frange &r) const { if (r.undefined_p ()) return m_kind == VR_UNDEFINED; - tree rtype = type; - if (!types_compatible_p (rtype, type)) - return false; - frange tmp; - get_frange (tmp, rtype); + get_frange (tmp, r.type ()); return tmp == r; } diff --git a/gcc/value-range-storage.h b/gcc/value-range-storage.h index 4ec0da73059..f25489f32c1 100644 --- a/gcc/value-range-storage.h +++ b/gcc/value-range-storage.h @@ -54,7 +54,7 @@ public: void get_vrange (vrange &r, tree type) const; void set_vrange (const vrange &r); bool fits_p (const vrange &r) const; - bool equal_p (const vrange &r, tree type) const; + bool equal_p (const vrange &r) const; protected: // Stack initialization disallowed. vrange_storage () { } @@ -68,7 +68,7 @@ public: static irange_storage *alloc (vrange_internal_alloc &, const irange &); void set_irange (const irange &r); void get_irange (irange &r, tree type) const; - bool equal_p (const irange &r, tree type) const; + bool equal_p (const irange &r) const; bool fits_p (const irange &r) const; void dump () const; private: @@ -111,7 +111,7 @@ class frange_storage : public vrange_storage static frange_storage *alloc (vrange_internal_alloc &, const frange &r); void set_frange (const frange &r); void get_frange (frange &r, tree type) const; - bool equal_p (const frange &r, tree type) const; + bool equal_p (const frange &r) const; bool fits_p (const frange &) const; private: frange_storage (const frange &r) { set_frange (r); } -- 2.40.0