about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-09-21 13:48:14 +0000
committerbors <bors@rust-lang.org>2024-09-21 13:48:14 +0000
commit28364822410af31bba5c8adac19cbbfcb9b48717 (patch)
treeac72426b9887c2e17f638f694fc07603da661d5f /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
parentf48c99a0041bb82a750b34cf2570e0e73d6d801c (diff)
parentaa28ee1718bca8d0761e4cfc881e164571ad6683 (diff)
downloadrust-28364822410af31bba5c8adac19cbbfcb9b48717.tar.gz
rust-28364822410af31bba5c8adac19cbbfcb9b48717.zip
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.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
0 files changed, 0 insertions, 0 deletions