Stream: cranelift

Topic: Optimizing compile time


view this post on Zulip Farooq (Jun 11 2025 at 09:00):

Hello.

I'm using cranelift as a compiler backend for my project. I need very fast compile times. Using cranelift 0.113, it shows that there are lots of room for improvement. Notably verification and functions/methods in cranelift_codegen::ir::dfg consume a lot. Tips to further improve these areas are very welcome. BTW, what does verification mean? I didn't find anything in the docs of verify_function.

Thanks in advance.

view this post on Zulip bjorn3 (Jun 11 2025 at 14:21):

The IR verifier checks that the input clif ir follows all the rules of clif ir. You can disable the enable_verifier option to disable it. For example: https://github.com/rust-lang/rustc_codegen_cranelift/blob/30c48bcb55e10518e4e59a78dcab439a0b327725/src/lib.rs#L298

Cranelift based backend for rustc. Contribute to rust-lang/rustc_codegen_cranelift development by creating an account on GitHub.

view this post on Zulip bjorn3 (Jun 11 2025 at 14:21):

The IR verifier is known to be somewhat slow. I would recommend enabling it during development, but disabling it for release builds.

view this post on Zulip bjorn3 (Jun 11 2025 at 14:22):

If something is rejected by the IR verifier, disabling the IR verifier often causes a panic later on during compilation.

view this post on Zulip Farooq (Jun 11 2025 at 17:00):

Alright thanks. Since I'm using 0.113 and the latest is 0.120, would upgrading to latest have advantages for me? I can't easily find changelogs about cranelift in the repo.


Last updated: Dec 06 2025 at 07:03 UTC