Announcing the codegen working group


#1

At the recent (not so recent anymore but procrastination is strong) Rust work week in Berlin, we formed a working group to improve the code generation in rustc. The scope of this working group ranges from finding low-hanging fruits in the existing code to writing new MIR optimisations when it’s deemed the way to go.

Our goals are to provide a central location where we can gather and share information on ongoing efforts. My very first priority is to reenable the MergeFunctions pass.

Join us on IRC (#wg-codegen). We also have a repository that will later get moved to rust-lang-nursery when the people who can do that wake up (damn them timezones).

I’ll publish newsletters here starting from next week, and the first one will include everything that I did since the WG was created in Berlin. And also beautiful bread pictures.

Welcome to Rust’s first codegen working group. I wish you all the best baguettes you deserve. :baguette_bread:


#2

Can you give more details by what code generation means? Is it about macros or is there more?


#3

I believe they’re referring to the machine code generated by rustc. The particular issue about the MergeFunctions pass is about reenabling a useful llvm optimization that reduces binary sizes, but I imagine in general this group will focus on improving the llvm IR (what rustc gives to llvm to compile). Time spent in llvm is roughly proportional to the amount of IR given, so if rustc can generate better IR without much effort llvm won’t have to spend as long a time trying to optimize it.

Edit: The linked github repo perhaps best explains what they have envisioned:

Why?

While rustc produces decent binary code, there are huge opportunities for improvement, be it performance-wise or code size-wise. This working group intends to find ways to make it better.

Goals

  • Find low-hanging fruits for easy gains, be it with more LLVM metadata, better data layouts or peephole optimisations.
  • Improve LLVM itself for how it’s used by the Rust compiler.
  • Design new MIR-level optimisations.

#4

You might be thinking of the compiler performance working group?


#5

I’m getting dizzy with all the WGs we have now :stuck_out_tongue:


#6

Great news! I love the rate of Rust development so far, it really shows how much the devs care about users. Rust it very fast already (ported a project from D and very happy with the result), and this announcement makes me even happier, especially given my interest in using Rust in ARM microcontrollers. Looking forward to great future blog posts about compiler internals and the improvements in them.