I learned quite recently that one of the limiting factors in the Rust compiler’s performance is the LLVM IR it produces being of poor quality. This means that LLVM itself takes much longer to produce code. Are there any initiatives to address this?
Yes, I guess?: Cranelift, which is a LLVM-like library written in Rust. This could be used for faster debug builds in the future.
There's a Rust backend using Cranelift [2].
If you mean addressing the poor quality of LLVM IR directly, then I don't know.
It's unclear. There were discussions on the rustc Zulip that recently pointed to LLVM being actually quite performant at canonicalizing poor-quality IR; so any time saved in the backend by producing better IR is offset by the additional time spent in the front-end to produce that IR.
(I'm not a compiler developer, don't quote me on this)
I thought (maybe incorrectly) that most of the time is spent on linking in Rust codebase. Aside: out of curiosity, how did you find out about this fact/quirk about LLVM IR?
I guess the memory reduction from data structures might help rust-analyzer too? That would be pretty useful since it's always running in the background.