rust/compiler/rustc_middle
bors 2836482241 Auto merge of #129283 - saethlin:unreachable-allocas, r=scottmcm
Don't alloca for unused locals

We already have a concept of mono-unreachable basic blocks; this is primarily useful for ensuring that we do not compile code under an `if false`. But since we never gave locals the same analysis, a large local only used under an `if false` will still have stack space allocated for it.

There are 3 places we traverse MIR during monomorphization: Inside the collector, `non_ssa_locals`, and the walk to generate code. Unfortunately, https://github.com/rust-lang/rust/pull/129283#issuecomment-2297925578 indicates that we cannot afford the expense of tracking reachable locals during the collector's traversal, so we do need at least two mono-reachable traversals. And of course caching is of no help here because the benchmarks that regress are incr-unchanged; they don't do any codegen.

This fixes the second problem in https://github.com/rust-lang/rust/issues/129282, and brings us anther step toward `const if` at home.
2024-09-21 13:48:14 +00:00
..
src Auto merge of #129283 - saethlin:unreachable-allocas, r=scottmcm 2024-09-21 13:48:14 +00:00
Cargo.toml disable size asserts in the compiler when randomizing layouts 2024-08-31 23:56:45 +02:00
messages.ftl Re-implement a type-size based limit 2024-07-02 15:48:48 -04:00
README.md

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