News for hackers. Stuff that matters.
Re:Zig's New Relationship with LLVM by pedrow on Monday September 28, 2020 @09:02AM (#24616167)
This is interesting stuff. Could you comment about optimization? LLVM has put a lot of effort into optimizing code at various levels, including the LTO stuff. Will Zig match all this by itself, or will a 'Release mode' still use LLVM to produce a final version?
Re:Zig's New Relationship with LLVM by ikskuh on Monday September 28, 2020 @09:05AM (#24616204)
The overall idea is to have a selfhosted compiler for debug and release builds where the release build as ~80% of LLVM performance and use LLVM as an optional dependency to go 100% performance
Re:Zig's New Relationship with LLVM by jedisct1 on Monday September 28, 2020 @11:21AM (#24617575)
The self-hosted compiler is only going to be for debug builds AFAIK.
Re:Zig's New Relationship with LLVM by kristoff_it on Monday September 28, 2020 @09:05AM (#24616202)
LLVM is still going to be used for release builds. As of now, the self-hosted backend is dedicated to producing debug builds without optimizations (and with a few extra runtime inefficiencies, as that's the price for faster in-place binary replacement).
Re:Zig's New Relationship with LLVM by nick_ on Monday September 28, 2020 @09:53AM (#24616586)
Thanks, that's the answer to my question :) Do you know if there has been any plans to implement this build-time optimization upstream in LLVM itself? Perhaps after it's been completed within Zig.
Re:Zig's New Relationship with LLVM by alexnask on Monday September 28, 2020 @10:01AM (#24616664)
While I am not terribly familiar with the LLVM codebase, this kind of improvement would probably require massive internal changes.

One example of this is the fact that codegen needs to be aware of the linker to emit correct code depending on the type of executable that is being generated, since different strategies can and are used for different formats (for example, currently the x86_64 backend will generate different instructions for function calls on ELF and PE/COFF vs MachO).

I would totally get behind LLVM or other compiler toolchains working towards this kind of functionality, but this is hardly something Zig developers could implement in a massive project such as LLVM (which is precisely why we are building our own :))

Re:Zig's New Relationship with LLVM by nick_ on Monday September 28, 2020 @10:27AM (#24616927)
Very interesting. It makes a lot of sense. Do you have a read on how well using the LLVM interpreter modes fill this gap?

EDIT: To be clear, I mean the gap of slow build performance in the feedback look of code-build-check.

Re:Zig's New Relationship with LLVM by theresistor on Monday September 28, 2020 @01:45PM (#24619300)
LLVM's interpreter is atrociously slow. It's only really meant for debugging LLVM itself.
Re:Zig's New Relationship with LLVM by ndesaulniers on Monday September 28, 2020 @07:49PM (#24622550)
We started looking at build times of the Linux kernel with Clang this summer. Turns out that compile times are dominated by Clang, not LLVM. Sounds like different experiences for different frontends.