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 7AB5B3858D28 for ; Tue, 18 Apr 2023 11:33:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7AB5B3858D28 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=1681817631; 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=IvXq3/QTeQXHON8EjVKoTIimACrTxn5PMJNVMYJQmZc=; b=MGJ6mVoNLaqJVzhn8zrIxoFGMW6UvJd95nlCKTHYJTN9CWzywqfxSzAmUOD+59YkJz6XyE kQhBtLX6dOpjnr5HsGTrH7G8nymLZq0AlAp69E6gY1Kz0P4RkKx07PDM1KAULCawR+Hylm a5Ntvs3AYXW/dssxKQf6Qr+k8P7bmzA= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-425-P1_N2GlYORupEX_7EUL0tg-1; Tue, 18 Apr 2023 07:33:50 -0400 X-MC-Unique: P1_N2GlYORupEX_7EUL0tg-1 Received: by mail-wm1-f69.google.com with SMTP id c20-20020a05600c171400b003f173d94427so2599029wmn.1 for ; Tue, 18 Apr 2023 04:33:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681817629; x=1684409629; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IvXq3/QTeQXHON8EjVKoTIimACrTxn5PMJNVMYJQmZc=; b=j7l7/NEgRoFV9cd8IdXXEvYA02DoU8TtoHIYUxggUN93EkSBLADurKGFjPBi+7QqKW UrFmKM4a2TD8HOdN2pYkwVQI/QopYvTLlfAyNmVZfKbaLIYFvK/vhg7dsF2gcxNV/lf6 tlAHIzrwJ5NlUWip9pwRDb0XOJczTVvXL3mFf/aLZ2QNK5pqdabLWw0WdWLE9TwrrNB7 1aSaftUaK/I/cwp9ZMmYC5zRqndtNhbyOfgQuabdmoRDpvb4+EILl10z6f2v/Uh71k7Y /Rdjzbcj7IzBaJQE6vv9N/DnxpvpHfJ9egaQNyo2I1HNEUivJeWNr299XkmGmPF80Aok cXsw== X-Gm-Message-State: AAQBX9dWmrG6/rvJohkd8MzG+B7BSI5EblSiui6jDl9NFEgRBhFequdr P7l8O3ifod8wJkV04hgTu6TZgdd+mxN45VhxZa9OBs24eS6mjS11R89sGiwrKnjHpWkhjr/y7j9 FRo8JR+gufbRzpqoBDw== X-Received: by 2002:a05:600c:3791:b0:3f1:7331:38b1 with SMTP id o17-20020a05600c379100b003f1733138b1mr5110707wmr.14.1681817628947; Tue, 18 Apr 2023 04:33:48 -0700 (PDT) X-Google-Smtp-Source: AKy350ZJPPYnU/zlu0lYxsWK26MgQ6z8iYgCMFqzujYH29zFQFh/UHvlUowKbCYTRZSGNUT/v/4kHg== X-Received: by 2002:a05:600c:3791:b0:3f1:7331:38b1 with SMTP id o17-20020a05600c379100b003f1733138b1mr5110695wmr.14.1681817628684; Tue, 18 Apr 2023 04:33:48 -0700 (PDT) Received: from [192.168.1.201] ([139.47.42.170]) by smtp.gmail.com with ESMTPSA id m9-20020a7bca49000000b003f172db455dsm6877569wml.32.2023.04.18.04.33.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 18 Apr 2023 04:33:48 -0700 (PDT) Message-ID: Date: Tue, 18 Apr 2023 13:33:47 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH] Add inchash support for vrange. To: Jakub Jelinek Cc: GCC patches , Andrew MacLeod , Richard Biener References: <20230418090637.253140-1-aldyh@redhat.com> <20230418090637.253140-2-aldyh@redhat.com> <6acb5cf5-43ab-7139-ac7f-6006dc3641c4@redhat.com> From: Aldy Hernandez In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no 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 4/18/23 12:59, Jakub Jelinek wrote: > 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? That was my thinking, and we could save one write. I can add the num_pairs() if you prefer. I don't have a strong opinion. Aldy