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 A19FC3858D32 for ; Tue, 18 Apr 2023 10:59:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A19FC3858D32 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=1681815596; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=M6I+RsAGX80wvOmxfO9OLHqNZZB85RAiBsJEMrcS/Ko=; b=VYZkyw226LQEENgziBwCmA1Yhytjn7lo63yV+aAT4G4X578H/CcUafL5CHpt8h0kYrC1C4 /KrBR2/Lo7t/fCuYxjL/cyTs+C6fiqULVPeoEVOcdHLYSKE0WXQeio1OXyCRB7YCvQeQZY xWX+RdBNVu14WoMHp7K2TabtFXdrgXo= 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-391-sZidyldFPW-maLcVFwnL5A-1; Tue, 18 Apr 2023 06:59:54 -0400 X-MC-Unique: sZidyldFPW-maLcVFwnL5A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8EE8A101A531; Tue, 18 Apr 2023 10:59:54 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.194.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2161DC15BA0; Tue, 18 Apr 2023 10:59:46 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 33IAxqTs112373 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 12:59:52 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 33IAxpV5112372; Tue, 18 Apr 2023 12:59:51 +0200 Date: Tue, 18 Apr 2023 12:59:51 +0200 From: Jakub Jelinek To: Aldy Hernandez Cc: GCC patches , Andrew MacLeod , Richard Biener Subject: Re: [PATCH] Add inchash support for vrange. Message-ID: Reply-To: Jakub Jelinek References: <20230418090637.253140-1-aldyh@redhat.com> <20230418090637.253140-2-aldyh@redhat.com> <6acb5cf5-43ab-7139-ac7f-6006dc3641c4@redhat.com> MIME-Version: 1.0 In-Reply-To: <6acb5cf5-43ab-7139-ac7f-6006dc3641c4@redhat.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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: On Tue, Apr 18, 2023 at 12:50:58PM +0200, Aldy Hernandez wrote: > --- a/gcc/value-range.cc > +++ b/gcc/value-range.cc > @@ -232,6 +232,58 @@ vrange::dump (FILE *file) const > pp_flush (&buffer); > } > > +namespace inchash > +{ > + > +void > +add_vrange (const vrange &v, inchash::hash &hstate, > + unsigned int) > +{ > + if (v.undefined_p ()) > + { > + hstate.add_int (VR_UNDEFINED); > + return; > + } > + // Types are ignored throughout to inhibit two ranges being equal > + // but having different hash values. This can happen when two > + // ranges are equal and their types are different (but > + // types_compatible_p is true). > + if (is_a (v)) > + { > + const irange &r = as_a (v); > + if (r.varying_p ()) > + hstate.add_int (VR_VARYING); > + else > + hstate.add_int (VR_RANGE); Shouldn't this also hstate.add_int (r.num_pairs ()); ? Or is that unnecessary because different number of add_wide_int calls will likely result in different hashes then? Otherwise LGTM. > + for (unsigned i = 0; i < r.num_pairs (); ++i) > + { > + hstate.add_wide_int (r.lower_bound (i)); > + hstate.add_wide_int (r.upper_bound (i)); > + } > + hstate.add_wide_int (r.get_nonzero_bits ()); > + return; > + } Jakub