[PATCH] Add a separate llvm.global_ctors entry for linkonce_odr data initializers

Reid Kleckner rnk at google.com
Thu Aug 22 10:17:53 PDT 2013


On Thu, Aug 22, 2013 at 10:09 AM, Rafael Espíndola <
rafael.espindola at gmail.com> wrote:

> > +  } else if (D->getInstantiatedFromStaticDataMember()) {
> > +    // Initializers of static data members of class template
> specializations are
> > +    // not guaranteed to run in any order with respect to the rest of
> the
> > +    // initializers in a TU.  As a consequence, we can put them into
> their own
> > +    // llvm.global_ctors entry.  This should allow GlobalOpt to fire
> more often.
> > +    AddGlobalCtor(Fn);
> > +    DelayedCXXInitPosition.erase(D);
>
> Is there a standard section you can quote or refer to in here?
>

[basic.start.init] p2, but maybe I have it wrong here:
"Definitions of explicitly specialized class template static data members
have ordered initialization. Other class template static data members
(i.e., implicitly or explicitly instantiated specializations) have
unordered initialization."

I guess I should add a test for an explicitly specialized class template,
and not an explicitly instantiated class template.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130822/9a0c763b/attachment.html>


More information about the cfe-commits mailing list