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 23E303858C50 for ; Mon, 15 May 2023 18:14:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 23E303858C50 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=1684174450; 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=KV8QR+L32m8rP/CRwUdhAvTdr5VzOBDKbELixH17hp8=; b=N7PMACyD3E30E5nhxEad9cVBWJaRQCyPBCL3Ma7lsSk1qKoft7GHuEDgUUvUTQbCMeapae 6E3fNPqv4tSyhQ2l3WOf8wbrMlpT48zdpkZDyl22lkMXJcC4dr7dTXKeNFKAZu8S/B7CX5 V/ignIx9mo5QAFGVHZ3EdY0GN5yg16k= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-120-uaWNQvT2Nxe_DgCL_szZeA-1; Mon, 15 May 2023 14:14:07 -0400 X-MC-Unique: uaWNQvT2Nxe_DgCL_szZeA-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-3078b9943d6so3770338f8f.1 for ; Mon, 15 May 2023 11:14:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684174446; x=1686766446; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KV8QR+L32m8rP/CRwUdhAvTdr5VzOBDKbELixH17hp8=; b=WKZKNlp38c67X6cxvZbejbwhdLSD00ygHI63KQCZRuun6XseJOmF2Wua2KnF+LWX/t cI2cM/MEBbu8Z9WdgwgC0HU5/HNc0CsspefWDXYsH24kC6XFheISEMKx7SkZP6PwxXdY xv/xFVCmtkkI1aKKKuJUOh4flUg59hXJCMueb6w1SK6Q3+c8rFws0VIubNgh4XZl1kIO MbAKOX5I9evK2UF+xFsobgloLPFkC+vMx5i1JZ00UOiK6f5cVNqcbqIj6Byv8GL0KI3E aAIMHA2PyGZyKgrncgJKS/fbbLK2STMruNpUauYw+362gYpDut81+o40a7bEaPV62hj0 Vd9w== X-Gm-Message-State: AC+VfDz9IYoSfFC2YRD1RkdZGVdfYUQ9NeOL9YyJaMZ2vNfFuLqibUlO 73r1cCwP733duXyLZH6Wqc5GLGsXKDxO0TVAFzpCuM3jvqIVtmCh6j0Lwze1kH4HBEN19IA/MIz 18mLC97oXKhc1NiLJgw== X-Received: by 2002:a5d:68c1:0:b0:306:28fa:16a7 with SMTP id p1-20020a5d68c1000000b0030628fa16a7mr27494830wrw.43.1684174446387; Mon, 15 May 2023 11:14:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Tix6QMxX6MSmsyR8pS8NNrYe3yz1vefFujAjfoUZCciYyKJIdF/hWltnGHsQK5hPCxxlLVw== X-Received: by 2002:a5d:68c1:0:b0:306:28fa:16a7 with SMTP id p1-20020a5d68c1000000b0030628fa16a7mr27494815wrw.43.1684174446064; Mon, 15 May 2023 11:14:06 -0700 (PDT) Received: from [192.168.1.201] ([139.47.42.170]) by smtp.gmail.com with ESMTPSA id c16-20020a5d63d0000000b003078c535277sm448695wrw.91.2023.05.15.11.14.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 May 2023 11:14:05 -0700 (PDT) Message-ID: <10c82daa-8cc3-8e8b-d99a-32b7741b6e3d@redhat.com> Date: Mon, 15 May 2023 20:14:04 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH] Add auto-resizing capability to irange's [PR109695] From: Aldy Hernandez To: Jakub Jelinek Cc: GCC patches , Andrew MacLeod , Richard Biener , mjambor@suse.cz References: <20230515103523.100412-1-aldyh@redhat.com> 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: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,BODY_8BITS,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=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 5/15/23 17:07, Aldy Hernandez wrote: > > > On 5/15/23 12:42, Jakub Jelinek wrote: >> On Mon, May 15, 2023 at 12:35:23PM +0200, Aldy Hernandez wrote: >>> gcc/ChangeLog: >>> >>>     PR tree-optimization/109695 >>>     * value-range.cc (irange::operator=): Resize range. >>>     (irange::union_): Same. >>>     (irange::intersect): Same. >>>     (irange::invert): Same. >>>     (int_range_max): Default to 3 sub-ranges and resize as needed. >>>     * value-range.h (irange::maybe_resize): New. >>>     (~int_range): New. >>>     (int_range::int_range): Adjust for resizing. >>>     (int_range::operator=): Same. >> >> LGTM. >> >> One question is if we shouldn't do it for GCC13/GCC12 as well, perhaps >> changing it to some larger number than 3 when the members aren't >> wide_ints >> in there but just trees.  Sure, in 13/12 the problem is 10x less severe >> than in current trunk, but still we have some cases where we run out of >> stack because of it on some hosts. > > Sure, but that would require messing around with the gt_* GTY functions, > and making sure we're allocating the trees from a sensible place, etc > etc.  I'm less confident in my ability to mess with GTY stuff this late > in the game. Hmmm, maybe backporting this isn't too bad. The only time we'd have a chunk on the heap is for int_range_max, which will never live in GC space. So I don't think we need to worry about GC at all. Although, legacy mode in GCC13 does get in a the way a bit. Sigh. And unrealted, but speaking of GC... we should remove all GTY markers from vrange. It should never live in GC. That's why we have vrange_storage for, and that is what we put in the tree_ssa_name. /* Value range information. */ union ssa_name_info_type { /* Range and aliasing info for pointers. */ struct GTY ((tag ("0"))) ptr_info_def *ptr_info; /* Range info for everything else. */ struct GTY ((tag ("1"))) vrange_storage * range_info; } GTY ((desc ("%1.typed.type ?" \ "!POINTER_TYPE_P (TREE_TYPE ((tree)&%1)) : 2"))) info; That should have been the only use of range GC stuff, but alas another one crept in... IPA: struct GTY (()) ipa_jump_func { ... /* Information about value range, containing valid data only when vr_known is true. The pointed to structure is shared betweed different jump functions. Use ipa_set_jfunc_vr to set this field. */ value_range *m_vr; ... }; This means that we can't nuke int_range and default to an always resizable range just yet, because we'll end up with the value_range in GC memory, and resizable part in the heap. That m_vr pointer should be a pointer to vrange_storage. Meh...I'm bumping against my IPA work yet again. I think it's time to start dusting off those patches. Aldy