rust/compiler/rustc_mir_transform
bors d2d24e395a 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
2024-05-03 21:50:13 +00:00
..
src Auto merge of #123602 - cjgillot:gvn-borrowed, r=oli-obk 2024-05-03 21:50:13 +00:00
Cargo.toml bump itertools to 0.12 2024-03-08 12:34:05 +03:00
messages.ftl Remove MIR unsafe check 2024-04-03 08:50:12 +00:00