Files
rust/compiler/rustc_codegen_llvm
bors b998449636 Auto merge of #156816 - saethlin:loop-attributes, r=JonathanBrouwer,folkertdev
Add unstable loop unrolling hint attributes



Tracking issue: https://github.com/rust-lang/rust/issues/156874

This adds as new attribute `#[unroll]`/`#[unroll(full)]`/`#[unroll(never)]`/`#[unroll(16)]` (or any u32).

`#[unroll]` is behind a new feature gate `#![feature(loop_hints)]` because I intend to add an attribute for loop vectorization as well. If a user wants to turn off loop unrolling to locally minimize code size, LLVM may vectorize the loop even though it isn't unrolled which can produce a similar code size explosion.
2026-06-16 08:40:13 +00:00
..
…

The codegen crate contains the code to convert from MIR into LLVM IR, and then from LLVM IR into machine code. In general it contains code that runs towards the end of the compilation process.

For more information about how codegen works, see the rustc dev guide.