about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/coverage/mod.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-05-03 21:50:13 +0000
committerbors <bors@rust-lang.org>2024-05-03 21:50:13 +0000
commitd2d24e395a1e4fcee62ca17bf4cbddb1f903af97 (patch)
tree80f6cdd1827141815396f9aa6459ab018a8af9e1 /compiler/rustc_mir_transform/src/coverage/mod.rs
parentbefabbc9e5f6e82e659f9f52040ee0dd40593d8a (diff)
parentc19866f335152cbdd3424b573e5a615963dbe80e (diff)
downloadrust-d2d24e395a1e4fcee62ca17bf4cbddb1f903af97.tar.gz
rust-d2d24e395a1e4fcee62ca17bf4cbddb1f903af97.zip
Auto merge of #123602 - cjgillot:gvn-borrowed, r=oli-obk
Account for immutably borrowed locals in MIR copy-prop and GVN

For the most part, we consider that immutably borrowed `Freeze` locals still fulfill SSA conditions. As the borrow is immutable, any use of the local will have the value given by the single assignment, and there can be no surprise.

This allows copy-prop to merge a non-borrowed local with a borrowed local. We chose to keep copy-classes heads unborrowed, as those may be easier to optimize in later passes.

This also allows to GVN the value behind an immutable borrow. If a SSA local is borrowed, dereferencing that borrow is equivalent to copying the local's value: re-executing the assignment between the borrow and the dereference would be UB.

r? `@ghost` for perf
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/mod.rs')
0 files changed, 0 insertions, 0 deletions