This is the mail archive of the
mailing list for the GCC project.
Re: [RFA] [tree-optimization/80576] Handle non-constant sizes in DSE
- From: Jeff Law <law at redhat dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 9 Sep 2019 14:10:51 -0600
- Subject: Re: [RFA] [tree-optimization/80576] Handle non-constant sizes in DSE
- References: <firstname.lastname@example.org> <alpine.DEB.email@example.com> <firstname.lastname@example.org> <CAFiYyc0MiMQSPHbc7aE388F4+ViChazd9DwEyt440FO4OsqXww@mail.gmail.com> <email@example.com> <CAFiYyc2fMGGc7JEDdvfqJid4TbhFvbROh8=++RoRjOg3K6aHrg@mail.gmail.com> <firstname.lastname@example.org> <CAFiYyc0UhXffAHhWvvi1geCnHTmAjvEdfPokc-6ERaLVH36Rvg@mail.gmail.com>
On 8/26/19 3:00 AM, Richard Biener wrote:
> On Fri, Aug 23, 2019 at 9:19 PM Jeff Law <email@example.com> wrote:
>> On 8/22/19 4:46 AM, Richard Biener wrote:
>>>>> Also you seem to use this info to constrain optimization when you
>>>>> might remember that types of addresses do not carry such information...
>>>>> Thus it should be "trivially" possible to write a testcase that is miscompiled
>>>>> after your patch. I also don't see this really exercised in the
>>>>> testcases you add?
>>>> Arggh. You're absolutely correct. I must be blocking out that entire
>>>> discussion from last summer due to the trama :-)
>>>> If the destination is the address of a _DECL node, can we use the size
>>>> of the _DECL?
>>> Yes, but this should already happen for both invariant ones like &a.b.c
>>> and variant ones like &a.b[i].c in ao_ref_init_from_ptr_and_size.
>> I don't see that in ao_ref_init_from_ptr_and_size. AFAICT if you don't
>> know the size when you call that routine (size == NULL), then you end up
>> with the ref->size and ref->max_size set to -1.
>> Am I missing something here?
> Ah, of course. ao_ref_from_ptr_and_size would need to be extended
> to constrain max_size. So what I was
> saying is that ao_ref_init_from_ptr_and_size should get you
> a DECL ao_ref_base () from which you could constrain max_size with.
> Or rather ao_ref_from_ptr_and_size should be extended do that,
> mimicing what get_ref_base_and_extent does at the end in the
> if (DECL_P (exp)) case (mind flag_unconstrained_commons!).
So I was going to use get_ref_base_and_extent from within
ao_ref_init_from_ptr_and_size to capture these cases, but
get_ref_base_and_extent internally uses TYPE_SIZE to get the maximum
size of the referenced object.
That likely represents a codegen bug waiting to happen.
I'll see if I can refactor just the bits we want so that we're not