This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: g++keeps unused objects with virtual functions
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: Stefan Ehrlich <stefan dot ehrlich at ehrlich dot eu>, GCC Development <gcc at gcc dot gnu dot org>, zlynx at acm dot org, Jan Hubicka <hubicka at ucw dot cz>
- Date: Wed, 8 Apr 2015 10:54:01 +0200
- Subject: Re: g++keeps unused objects with virtual functions
- Authentication-results: sourceware.org; auth=none
- References: <55D79922DFF3F742B9F3F1A814CA6B7518FDEB at atvie01vm001 dot ehrlich dot lan> <43BCCAF1-C7A3-4282-A9BA-011E9DB91AD7 at gmail dot com> <55D79922DFF3F742B9F3F1A814CA6B7518FDEC at atvie01vm001 dot ehrlich dot lan> <CAFiYyc2y9zi6s=J0jW3zY206MYUWbqGQRFUuDmrXgKaAoZxnwA at mail dot gmail dot com>
> which shows how the global objects initialization keeps things live.
> Early optimization turns it into
>
> (static initializers for t.C) ()
> {
> <bb 2>:
> NotUsedObject._vptr.CObject = &MEM[(void *)&_ZTV7CObject + 16B];
> return;
>
> }
>
> but we don't have any pass removing stores to globals never read. IPA
> reference computes this
> in some way but doesn't get to export this in a reasonable way - its
> transform stage could DSE
> those though.
We have write only variable detection but
> NotUsedObject/4 (CObject NotUsedObject) @0x7f70d41fe580
> Type: variable definition analyzed
> Visibility: public
> References:
> Referring: _Z41__static_initialization_and_destruction_0ii/9 (addr)
> Availability: not-ready
> Varpool flags:
it stops on fact believing that address of NotUsedObject is taken. Why it is
not considered to be load?
Honza