mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-27 02:53:43 +00:00
The goal of this change is to ensure that llvm will do stack slot
optimization on these temporaries. This ensures that in code like:
```rust
const A: [u8; 1024] = [0; 1024];
fn copy_const() {
f(A);
f(A);
}
```
we only use 1024 bytes of stack space, instead of 2048 bytes.
Please read the rustc-dev-guide chapter on Backend Agnostic Codegen.