dmd codegen improvements

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Tue Aug 18 13:47:09 PDT 2015


On Tuesday, 18 August 2015 at 20:28:48 UTC, Walter Bright wrote:
> On 8/18/2015 12:38 PM, deadalnix wrote:
>> And honestly, there is no way DMD can catch up.
>
> I find your lack of faith disturbing.
>
> https://www.youtube.com/watch?v=Zzs-OvfG8tE&feature=player_detailpage#t=91

Let's say I have some patches in LLVM and a pretty good 
understanding of how it works. There are some big optimizations 
that DMD could benefit from, but a lot of it is getting 
heuristics just right and recognize a sludge of patterns.

For instance this: 
http://llvm.org/docs/doxygen/html/DAGCombiner_8cpp_source.html is 
what you get to recognize patterns created by legalization. For 
more general patterns: 
https://github.com/llvm-mirror/llvm/tree/master/lib/Transforms/InstCombine

And that is just the general case pass. You then have a sludge of 
passes that do canonicalization (GVN for instance) in order to 
reduce the amount of pattern other passes have to match, and 
others looking for specialized things (SROA, LoadCombine, ...) 
and finally a ton of them looking for higher level things to 
change (SimplifyCFG, Inliner, ...).

All of them require a cheer amount of pure brute force, by 
recognizing more and more patterns, while other required fine 
tuned heuristics.

Realistically, D does not have the man power required to reach 
the same level of optimization, and have many higher impact task 
to spend that manpower on.


More information about the Digitalmars-d mailing list