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.133.124]) by sourceware.org (Postfix) with ESMTPS id 86AB73858407 for ; Tue, 4 Oct 2022 12:13:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 86AB73858407 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=1664885622; 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: in-reply-to:in-reply-to:references:references; bh=6weriypOXPVd5OG9q3h8UyseI2fnUuTvjyEZXhIlMIg=; b=Q5n0z2r5YGsknahmHSMALfeQ5+H9dh9UjcPyHq1S+nu6kuRfggDn56Sy4Sy11H/W4yy30j 2dyq4kksbaocc2wHGYnGngCKqPnncjfFE1HFeLJQ1IMZhXHrYGBYl8yFz4FAx5FrOHVhlJ erMw8JNou4Q9LMVflzF9gUfWt1FCJYo= Received: from mail-oi1-f197.google.com (mail-oi1-f197.google.com [209.85.167.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-390-X2phPy_kMBaKcAJtMuQqaQ-1; Tue, 04 Oct 2022 08:13:41 -0400 X-MC-Unique: X2phPy_kMBaKcAJtMuQqaQ-1 Received: by mail-oi1-f197.google.com with SMTP id q38-20020a056808202600b00350508fd168so5227964oiw.21 for ; Tue, 04 Oct 2022 05:13:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=6weriypOXPVd5OG9q3h8UyseI2fnUuTvjyEZXhIlMIg=; b=OVKTEJXwYJ4VRpcyUUBxy6tOeg/wKBRE6Zx45GNPslBWLEM+2qe5Hv8mWfjhfjpfHg mqrvmwSTAjMfPyEdh0actFPbXIuQYv4Qk4B6yTSzVALBBEmMnM6EoFiceyasCrtmqg3K 7MFgxgm5HCjy8FlPRgBu9flMkD6B6fRGZcPFEphanftNfosvhZrpif6PUjfmODHHxj35 4vDjPr6+9Wm7g8rUuNEgvnUyUx0Kj3ZawgDUKSgSEKaqgTeVYm6Ly4sWZ5jjGj0xF0KQ A9rUMpWh1lwcC7TMpx2Ph96dToa3yQzQJUim91TXO9J8bY3JJTbmaheVazcDGLqQAk5x IwwQ== X-Gm-Message-State: ACrzQf0roVOfp7joADDTW7MoBujEXS4u2Nocz5TeHY65g8eUPZh7NGXi lof8WtfHhKJT+eAUQBZKI3PI/0h81e+Njg3clOuP9Aq1CAPzTPCnTteQsE/xjQhVm4u1m7/KMNQ aNGSIjDYEXTPObDb9phQQZfTlBXOW7eZ+Qw== X-Received: by 2002:a05:6808:1a98:b0:34f:8b40:6263 with SMTP id bm24-20020a0568081a9800b0034f8b406263mr6049990oib.265.1664885620383; Tue, 04 Oct 2022 05:13:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4uoMErfQsrxJb9khr8OtpzYL+olGVi5beNmrecD0VfJrJttzvJv2xizXLZtm2+fLs6PbSa1N70a4Y6YxxM1VY= X-Received: by 2002:a05:6808:1a98:b0:34f:8b40:6263 with SMTP id bm24-20020a0568081a9800b0034f8b406263mr6049983oib.265.1664885620145; Tue, 04 Oct 2022 05:13:40 -0700 (PDT) MIME-Version: 1.0 References: <20221004073530.1461390-1-aldyh@redhat.com> In-Reply-To: From: Aldy Hernandez Date: Tue, 4 Oct 2022 14:13:29 +0200 Message-ID: Subject: Re: [COMMITTED] Convert nonzero mask in irange to wide_int. To: Richard Biener Cc: GCC patches X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="000000000000fb16b305ea346316" X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,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 List-Id: --000000000000fb16b305ea346316 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Oct 4, 2022, 13:28 Aldy Hernandez wrote: > On Tue, Oct 4, 2022 at 9:55 AM Richard Biener > wrote: > > > > > > Am 04.10.2022 um 09:36 schrieb Aldy Hernandez via Gcc-patches < > gcc-patches@gcc.gnu.org>: > > > > > > =EF=BB=BFThe reason the nonzero mask was kept in a tree was basically= inertia, > > > as everything in irange is a tree. However, there's no need to keep > > > it in a tree, as the conversions to and from wide ints are very > > > annoying. That, plus special casing NULL masks to be -1 is prone > > > to error. > > > > > > I have not only rewritten all the uses to assume a wide int, but > > > have corrected a few places where we weren't propagating the masks, or > > > rather pessimizing them to -1. This will become more important in > > > upcoming patches where we make better use of the masks. > > > > > > Performance testing shows a trivial improvement in VRP, as things like > > > irange::contains_p() are tied to a tree. Ughh, can't wait for trees = in > > > iranges to go away. > > > > You want trailing wide int storage though. A wide_int is quite large. > > Absolutely, this is only for short term storage. Any time we need > long term storage, say global ranges in SSA_NAME_RANGE_INFO, we go > through vrange_storage which will stream things in a more memory > efficient manner. For irange, vrange_storage will stream all the > sub-ranges, including the nonzero bitmask which is the first entry in > such storage, as trailing_wide_ints. > > See irange_storage_slot to see how it lives in GC memory. > That being said, the ranger's internal cache uses iranges, albeit with a squished down number of subranges (the minimum amount to represent the range). So each cache entry will now be bigger by the difference between one tree and one wide int. I wonder if we should change the cache to use vrange_storage. If not now, then when we convert all the subranges to wide ints. Of course, the memory pressure of the cache is not nearly as problematic as SSA_NAME_RANGE_INFO. The cache only stores names it cares about. Aldy --000000000000fb16b305ea346316--