[LLVMdev] Best way to clean up empty global_ctors

Nick Lewycky
2014-05-01T20:01:54Z

On 1 May 2014 11:12, Rafael Espíndola <rafael.espindola at gmail.com>
wrote:

> On 1 May 2014 14:08, Reid Kleckner <rnk at google.com> wrote:
> > I talked about this with Nick in person months ago, and my
understanding
> is
> > that GlobalOpt is also an enabling optimization that needs to run
early.
> > For example, if we can eliminate an initializer to an internal global
> with
> > no other stores to it, we can propagate the result.
> >
> > Maybe we should run it twice.
>
> That is probably fine, we just have to make sure compile time doesn't
> surfer too much.
>

There are many cases where another run of globalopt at the end would clean
things up.

I have a few concerns. One is that globalopt can miscompile, and I'm afraid
of making it do more or learn new tricks because that may expose its
miscompiley underbelly. The second is that a late run of globalopt opens up
all manner of new opportunities for the rest of the scalar optimizers,
which we don't run again. That's a sign that we should be designing it
differently, I just haven't thought about how exactly.

Teaching -globaldce about the ctors and dtors list sounds like a great plan
to me.

Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20140501/800050a7/attachment.html>