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

Too early dump I guess. At mainline I get empty constructor:
        .type   _GLOBAL__sub_I_NotUsedObject, @function
_GLOBAL__sub_I_NotUsedObject:
.LFB6:
        rep ret

not ideal, but still an improvement ;)
The problem is that write only var is removed only at late optimization
and then it is too late to remove the unreachable function.

Honza
> 
> Honza

Reply via email to