[LLVMdev] Best way to clean up empty global_ctors

Reid Kleckner rnk at google.com
Wed Apr 30 16:59:13 PDT 2014


Can we strengthen globalopt to symbolically execute at most one direct call
to any given function, or is that crazy talk?


On Wed, Apr 30, 2014 at 4:48 PM, Nico Weber <thakis at chromium.org> wrote:

> Hi,
>
> I'd like to fix PR19590, which is about llvm.global_ctors containing
> functions that end up being empty after optimization (which causes the
> linker to add useless init_array entries to the output binary).
> globalopt removes empty functions from llvm.global_ctors, but by the
> time the function becomes empty globalopt has already run and it
> doesn't run again.
>
> I'm wondering what the best fix is:
> 1. Should globalopt run once more after all other passes have run?
> 2. Or should the llvm.global_ctors optimization code in globalopt be
> moved into a helper function somewhere that's called from both
> globalopt and a new optimization pass cdtoropt that does nothing but
> remove empty functions from llvm.global_ctors and llvm.global_dtors?
> Then only this new pass would be added after all other passes. (This
> new pass should run very quickly, it doesn't have to do much.)
>
> Thanks for any advice,
> Nico
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140430/9f5f4db4/attachment.html>


More information about the llvm-dev mailing list