Repository navigation
Conversation
|
LLM disclosure: LLMs were used to generate the boilerplate for the MIR tests, but each test was manually reviewed and adjusted before committing. LLMs were also used to audit this pass against the rest of the compiler MIR transforms and Miri semantics. |
6745385 to
96e6975
Compare
96e6975 to
7736978
Compare
This comment has been minimized.
This comment has been minimized.
7736978 to
eab2d36
Compare
eab2d36 to
53be078
Compare
This comment has been minimized.
This comment has been minimized.
53be078 to
579316a
Compare
579316a to
6256aaa
Compare
4d906d5 to
07bdf02
Compare
This comment has been minimized.
This comment has been minimized.
07bdf02 to
74b0f10
Compare
74b0f10 to
3f8e6da
Compare
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
|
I think this is a bit similar to #142531. I don't actually see any mir-opt pass that uses storage's UB in the real world. Should we have a dedicated StorageReconstruction pass placed later in the pipeline? |
|
Removing storage statements and reconstructing them later, would lose information about ends of storage ranges. Consider a local which is borrowed and never moved. The best we could do, is to end its storage when function returns. Ideally we would make decisions based on an actual measurements. We could extend perf benchmarks, e.g., by including a sum of stack adjustments from function prologues as an approximation of stack usage. |
|
Essentially what @tmiasko said. The main issue is that place unification has deleted all storage statements for merged locals, so at that point the only record of where local lifetimes end is in the post-unification liveness matrix. This matrix must be used as the source for storage reconstruction within the pass. |
Depends on #163338
This PR extends the
MoveEliminationpass from rust-lang/rfcs#3943 to reconstructStorageLive/StorageDeadstatements for all locals by using the liveness information collected byPreciseLiveness.r? tmiasko