[patch] Teach GlobalDCE how to remove empty global_ctor entries

Reid Kleckner rnk at google.com
Fri May 2 11:42:45 PDT 2014


On Thu, May 1, 2014 at 9:29 PM, Nico Weber <thakis at chromium.org> wrote:

> > Do you know why? At least for the empty case it should be valid to
> > drop constructors of any priority.
>
> I don't know. Constructors with init priority are rare, and empty
> constructors with init priority are probably rarer still though.


llvm.global_ctors is unordered, which is what allows globalopt to run only
some of the ctors without worrying about changing program semantics because
it statically initialized something before dynamically running one of the
ctors it couldn't optimize.

If the ctors aren't all standard priority, globalopt would have to
carefully only evaluate ctors with high priority, and if any remain after
optimization, stop optimization there, because the remaining ones run first.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140502/d2866ca7/attachment.html>


More information about the llvm-commits mailing list