[LLVMdev] LLVM project binary size

Mike Stump mrs at apple.com
Tue May 27 14:10:31 PDT 2008


On May 25, 2008, at 11:29 PM, Nicolas Capens wrote:
> I’m a little bit worried about the sheer size of the resulting  
> binaries of a project using LLVM.

I'd identify all the optimization passes you don't want to use, and  
then see who is pulling them in.  Then, you can add controls as  
necessary so that projects that don't want them can use those controls  
to make them disappear.

For example, take the hypothetical:

   if (doing_opt_pass_35)
     opt_pass_35();

where that variable can wind up being set in some way the optimizer  
cannot see. If you add:

   if (gate_35 && doing_opt_pass_35)
     opt_pass_35();

and then have:

   const int gate_35 = 0;

in your project, then this reduces to turning on the link time  
optimizations and ensuring the optimizer is at least smart enough to  
remove that reference.  This kinda assumes you're using llvm's link  
time optimizer (or someone elses).



More information about the llvm-dev mailing list