Few ideas to reduce template bloat

bearophile bearophileHUGS at lycos.com
Fri Mar 26 13:48:33 PDT 2010


Walter Bright:
> Are you sure LDC isn't doing it at the link step?

This is the post where I have explained it:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=108275

As you can see from the link too llvm source code at the top of my post:
https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_25/lib/Transforms/IPO/MergeFunctions.cpp
that's a LLVM optimization pass, and ldc is spitting out already optimized asm, so it's not something done by the linker.


> Regardless, if you implement a half solution in the compiler, and then a full 
> solution in the linker, you've doubled your effort for the same result.

Right. Is dmd linker able to do that? The Gold linker (http://en.wikipedia.org/wiki/Gold_%28linker%29 ) that I think in future ldc will use may be able to do that.

But you are right, if D modules are compiled separately the compiler can't recognize many cases of duplications.

Bye,
bearophile



More information about the Digitalmars-d mailing list