rust/tests/mir-opt/copy-prop
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
..
borrowed_local.borrowed.CopyProp.panic-abort.diff Use newly exposed Freeze trait. 2024-04-20 19:25:20 +00:00
borrowed_local.borrowed.CopyProp.panic-unwind.diff Use newly exposed Freeze trait. 2024-04-20 19:25:20 +00:00
borrowed_local.compare_address.CopyProp.panic-abort.diff Add tests. 2024-04-20 19:10:23 +00:00
borrowed_local.compare_address.CopyProp.panic-unwind.diff Add tests. 2024-04-20 19:10:23 +00:00
borrowed_local.non_freeze.CopyProp.panic-abort.diff Add tests. 2024-04-20 19:10:23 +00:00
borrowed_local.non_freeze.CopyProp.panic-unwind.diff Add tests. 2024-04-20 19:10:23 +00:00
borrowed_local.rs Auto merge of #123602 - cjgillot:gvn-borrowed, r=oli-obk 2024-05-03 21:50:13 +00:00
branch.foo.CopyProp.panic-abort.diff
branch.foo.CopyProp.panic-unwind.diff
branch.rs mir-opt tests: rename unit-test -> test-mir-pass 2024-04-20 13:19:34 +02:00
calls.multiple_edges.CopyProp.diff
calls.nrvo.CopyProp.diff
calls.rs mir-opt tests: rename unit-test -> test-mir-pass 2024-04-20 13:19:34 +02:00
copy_propagation_arg.arg_src.CopyProp.panic-abort.diff
copy_propagation_arg.arg_src.CopyProp.panic-unwind.diff
copy_propagation_arg.bar.CopyProp.panic-abort.diff
copy_propagation_arg.bar.CopyProp.panic-unwind.diff
copy_propagation_arg.baz.CopyProp.panic-abort.diff
copy_propagation_arg.baz.CopyProp.panic-unwind.diff
copy_propagation_arg.foo.CopyProp.panic-abort.diff
copy_propagation_arg.foo.CopyProp.panic-unwind.diff
copy_propagation_arg.rs mir-opt tests: rename unit-test -> test-mir-pass 2024-04-20 13:19:34 +02:00
custom_move_arg.f.CopyProp.panic-abort.diff
custom_move_arg.f.CopyProp.panic-unwind.diff Fix validation and linting of injected MIR 2024-01-04 23:06:42 +01:00
custom_move_arg.rs mir-opt tests: rename unit-test -> test-mir-pass 2024-04-20 13:19:34 +02:00
cycle.main.CopyProp.panic-abort.diff
cycle.main.CopyProp.panic-unwind.diff
cycle.rs mir-opt tests: rename unit-test -> test-mir-pass 2024-04-20 13:19:34 +02:00
dead_stores_79191.f.CopyProp.after.panic-abort.mir
dead_stores_79191.f.CopyProp.after.panic-unwind.mir
dead_stores_79191.rs mir-opt tests: rename unit-test -> test-mir-pass 2024-04-20 13:19:34 +02:00
dead_stores_better.f.CopyProp.after.panic-abort.mir
dead_stores_better.f.CopyProp.after.panic-unwind.mir
dead_stores_better.rs mir-opt tests: rename unit-test -> test-mir-pass 2024-04-20 13:19:34 +02:00
issue_107511.main.CopyProp.panic-abort.diff Start blocks eagerly 2024-02-12 17:37:05 +01:00
issue_107511.main.CopyProp.panic-unwind.diff Start blocks eagerly 2024-02-12 17:37:05 +01:00
issue_107511.rs mir-opt tests: rename unit-test -> test-mir-pass 2024-04-20 13:19:34 +02:00
move_arg.f.CopyProp.panic-abort.diff
move_arg.f.CopyProp.panic-unwind.diff
move_arg.rs mir-opt tests: rename unit-test -> test-mir-pass 2024-04-20 13:19:34 +02:00
move_projection.f.CopyProp.panic-abort.diff
move_projection.f.CopyProp.panic-unwind.diff Fix validation and linting of injected MIR 2024-01-04 23:06:42 +01:00
move_projection.rs mir-opt tests: rename unit-test -> test-mir-pass 2024-04-20 13:19:34 +02:00
mutate_through_pointer.f.CopyProp.diff
mutate_through_pointer.rs mir-opt tests: rename unit-test -> test-mir-pass 2024-04-20 13:19:34 +02:00
non_dominate.f.CopyProp.diff
non_dominate.rs mir-opt tests: rename unit-test -> test-mir-pass 2024-04-20 13:19:34 +02:00
partial_init.main.CopyProp.diff
partial_init.rs mir-opt tests: rename unit-test -> test-mir-pass 2024-04-20 13:19:34 +02:00
reborrow.demiraw.CopyProp.panic-abort.diff Remove MIR unsafe check 2024-04-03 08:50:12 +00:00
reborrow.demiraw.CopyProp.panic-unwind.diff Remove MIR unsafe check 2024-04-03 08:50:12 +00:00
reborrow.miraw.CopyProp.panic-abort.diff Remove MIR unsafe check 2024-04-03 08:50:12 +00:00
reborrow.miraw.CopyProp.panic-unwind.diff Remove MIR unsafe check 2024-04-03 08:50:12 +00:00
reborrow.remut.CopyProp.panic-abort.diff
reborrow.remut.CopyProp.panic-unwind.diff
reborrow.reraw.CopyProp.panic-abort.diff
reborrow.reraw.CopyProp.panic-unwind.diff
reborrow.rs mir-opt tests: rename unit-test -> test-mir-pass 2024-04-20 13:19:34 +02:00