Do you think if statement as expression would be nice to have in D?

Walter Bright newshound2 at digitalmars.com
Tue Jun 7 18:27:32 UTC 2022


On 6/7/2022 1:44 AM, max haughton wrote:
> Unfortunately the dmd optimizer and inliner are somewhat buggy so most 
> "enterprise" users actually avoid them like the plague or have fairly hard-won 
> scars. At least one of our libraries doesn't work with -O -inline, many others 
> cases have similar issues.

I am not aware of this. Bugzilla issues, please?


> optimization isn't just about adding special cases, the sheer amount of 
> optimizations dmd would have to learn on top of an already horrific codebase in 
> the backend (note that to start with the register allocator is pretty bad, but 
> isn't easily replaced) means while it's technically possible it's practically 
> just not realistic.

Everybody says that, but I just go and add the optimizations people want anyway.


> The IR used by the backend is also quite annoying to work with. SSA is utterly 
> dominant in compilers (and has been since the late 90s) for a reason. It's not 
> it's fault because it's so old but the infrastructure and invariants you get 
> from it are just nothing even close to being easy to work on versus even GCC 
> before they realized LLVM was about to completely destroy them (almost no one 
> does new research with GCC anymore mostly because LLVM is easier to work on).

Triples *are* SSA, in that each node can be considered an assignment to a temporary.


> This IR and the lack of structure around operations on it is why dmd has so many 
> bugs wrt things like SIMD code generation.

SSA has nothing whatsoever to do with SIMD code generation.

The SIMD problems have all turned out to be missed special cases (SIMD is very 
complex). If you look at the PRs I made to fix them, they're all small. Not 
indicative of any fundamental problem.



More information about the Digitalmars-d mailing list