3 ms·
> which I think is relatively new in all the major C++ compilers. LTO has been available in gcc since 2009 and even longer in clang AFAIK. MSVC had LTO for...
by jcelerier 8y ago
> which I think is relatively new in all the major C++ compilers.
LTO has been available in gcc since 2009 and even longer in clang AFAIK. MSVC had LTO for... I don't know but googling a bit shows that visual studio 2005 supports /GL.
- iainmerrick 8y agoYeah, sorry, I should have clarified “relatively recent” as meaning the last 10 years or so. That’s recent for C++! :) This stuff is being actively worked on so I don’t know if merging identical template instantiations is a thing yet. Any idea?
- jcelerier 8y agoMSVC has /OPT:ICF which does this. GCC has -fipa-icf, and the GNU Gold linker has --icf={safe,all} options (since it's operating on ASM it needn't be at the compiler level). In both cases it does not only work with templates, but with any kind of function. However if you use --icf=all, some subtle bugs can appear since function pointers that would compare different in a default build would now compare equal. I have never been bitten by those.
- iainmerrick 8y agoCool! I’ll give those a try.