[patch] opt: Initialize asm printers to avoid DCE

Tobias Grosser tobias at grosser.es
Thu May 15 00:51:05 PDT 2014


Hi,

I would like to ask for review for the following patch:

To avoid dead code elimination of the assembly printers, this patch 
calls InitializeAllAsmPrinters() from opt. This increases the static 
binary size of 'opt' from 50MB -> 52MB on my system (all backends 
compiled) and causes no measurable increase in the time needed to run 
'make check'.

Without initialising the assembly printers a shared library build of opt 
is linked with these libraries whereas for a static build these 
libraries are dead code eliminated. This is problematic for plugins
that use assembly printers, as they neither can rely on opt to provide 
this functionality nor can they link the printers in themselves as this 
breaks with a shared object build of opt.

As the impact is rather minor and for platforms where even a tiny binary 
size increase matters 'opt' is commonly not provided, I don't expect any 
problems. Still, I would like to ask for other opinions.

Cheers,
Tobias

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-opt-Initialize-asm-printers.patch
Type: text/x-patch
Size: 1249 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140515/5869302a/attachment.bin>


More information about the llvm-commits mailing list