This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: update address taken: don't drop clobbers
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: Marc Glisse <marc dot glisse at inria dot fr>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 16 Oct 2014 13:20:32 +0200
- Subject: Re: update address taken: don't drop clobbers
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 2 dot 02 dot 1406282350110 dot 31815 at stedding dot saclay dot inria dot fr> <CAFiYyc0fRhV09A3C2WT8yQ1ndp9dcyWntCVSPHzhwHb3tgNZLg at mail dot gmail dot com> <alpine dot DEB dot 2 dot 11 dot 1407271853200 dot 22972 at stedding dot saclay dot inria dot fr> <alpine dot DEB dot 2 dot 11 dot 1409071654310 dot 5483 at laptop-mg dot saclay dot inria dot fr> <alpine dot DEB dot 2 dot 11 dot 1410151621380 dot 8286 at stedding dot saclay dot inria dot fr> <543E9BED dot 4070905 at redhat dot com>
On Wed, Oct 15, 2014 at 6:08 PM, Jeff Law <law@redhat.com> wrote:
> On 10/15/14 08:35, Marc Glisse wrote:
>>>
>>>
>>> Would that extra pass be acceptable?
Ugh, rather not. We have too many passes ;)
>>> Otherwise, what do you think should be responsible for cleaning up the
>>> dead assignments?
>>
>>
>> Does anyone have an opinion on which side needs to be improved? As a
>> reminder:
>>
>> - we have a va_list with its address taken by va_start/va_end.
>> - fab lowers va_start/va_end and the list doesn't have its address taken
>> anymore.
>> - update_address_taken replaces the clobber: list =v {}; with an
>> assignment of an undefined value: list_6 = list_2(D);
>> - uninit warns about this.
>>
>> Some possible directions:
>> - "prematurely" optimize in update_address_taken so we don't generate
>> the useless assignment.
>> - add a dce pass before uninit.
>
> I tend to land on the side of minimizing false positives, so the comment
> about PR18501 is a "don't care" to me. If the optimizers remove a dead
> assignment and we no longer warn about a potential uninitialized use in the
> dead assignment, then I consider that good. Not everyone agrees with that
> way of thinking, obviously.
>
> So my inclination would be to evaluate independent of the pr18501 issues.
> ie, what's the compile-time cost vs runtime benefit of running DCE here.
> I'm guessing there's little runtime benefit for this particular case.
>
> So my next line of thinking would be can we arrange to conditionally run
> DCE? ie, have update_address_taken signal that it did something that has a
> reasonable chance of exposing dead code and only run DCE in that case.
> Obviously this only helps if it rarely signals :-) I don't think we have
> any infrastructure for this right now.
>
> Finally I'd look at how difficult it would be to have update_address_taken
> cleanup after itself. If the LHS is in SSA form, then if we find it has no
> uses, can we just remove the assignment completely?
It doesn't even know that it has no uses (the variable still needs to be
written into SSA form). OTOH it is a missed DSE opportunity before
update-address-taken?
As of premature optimization - into-SSA could notice it created SSA
names with no uses and trigger a fast DCE.
Btw, I wonder what this odd folding of variadic builtins is about, and why
it is not done in the stdarg pass (and only there), which would be earlier.
Richard.
> jeff