Conversation
Update ldc optimization flags to match ldmd behavior. Just ran into a giant performance issue while benchmarking Mir? Took me an hour chatting w/ @9il to find this.
|
Wait, this doesn't seem to be everything. |
|
Let's leave |
|
Summoning @klickverbot and @JohanEngelen for their opinion. |
|
|
Dub build static libraries by default so that wouldn't work. I was very suprised to learn that ldmd2 and ldc2 behave differently w/ regards to
Yes, Kenji made that work for dmd. Also what's the state of LTO support, and what are good places to learn about such ldc internals (newsgroup, github)? |
You can compile to LLVM bitcode ( |
|
We could probably put something in Should we pursue this in this context or just merge the basic optimization flags for now? |
There is not really any reason to opt out of it for. In fact,
It's a historical accident.
The situation is entirely different for us, though, as we are not using DMD's front-end inliner. The latter just doesn't hit a lot of the AST bugs where symbol names depend on the codegen order because it can't handle any remotely complex code anyway. We emit the functions in question as normal to LLVM IR with a special linkage to designate them as for inlining only, and then leave the rest to LLVM's inliner. This way, we are very general, but hit a lot of the AST inconsistencies. |
Let's optimize the other ones for now. I'd also argue that -singleobj is a problematic workaround, and we should be able to achieve the same results with LTO. |
Okay, I was basing this on Johan's remark about it possibly causing linker errors. Can those be considered solved by now, also for static libraries? In that case I think we can just add it as a default flag (except for single-file compilation mode perhaps) and be done with it. |
|
@s-ludwig The linker errors happen for cross-module inlining, but it is default disabled, don't worry about it. It is not related to |
|
Ah okay, I read that sentence too fast. In that case I'd suggest to simply replace the old workaround at dub/source/dub/compilers/ldc.d Line 83 in 3efb665 -singleobj.
|
Update ldc optimization flags to match ldmd behavior.
Just ran into a giant performance issue (50%) while benchmarking Mir, b/c I was using
--compiler=ldc2instead of--compiler=ldmd2.