public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: GCC patches <gcc-patches@gcc.gnu.org>,
	Andrew MacLeod <amacleod@redhat.com>,
	Richard Biener <richard.guenther@gmail.com>,
	mjambor@suse.cz
Subject: Re: [PATCH] Add auto-resizing capability to irange's [PR109695]
Date: Mon, 15 May 2023 20:14:04 +0200	[thread overview]
Message-ID: <10c82daa-8cc3-8e8b-d99a-32b7741b6e3d@redhat.com> (raw)
In-Reply-To: <aab329b9-613b-5069-f04c-bc6974f0f7c3@redhat.com>

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<N> 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


  reply	other threads:[~2023-05-15 18:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-15 10:35 Aldy Hernandez
2023-05-15 10:42 ` Jakub Jelinek
2023-05-15 15:07   ` Aldy Hernandez
2023-05-15 18:14     ` Aldy Hernandez [this message]
2023-05-16  9:24       ` Aldy Hernandez
2023-05-15 11:08 ` Richard Biener
2023-05-15 11:26   ` Jakub Jelinek
2023-05-15 15:03   ` Aldy Hernandez
2023-05-15 17:23     ` Aldy Hernandez
2023-05-15 14:24 ` Bernhard Reutner-Fischer
2023-05-15 14:27   ` Aldy Hernandez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=10c82daa-8cc3-8e8b-d99a-32b7741b6e3d@redhat.com \
    --to=aldyh@redhat.com \
    --cc=amacleod@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=mjambor@suse.cz \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).