about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-04-03 19:17:33 +0000
committerbors <bors@rust-lang.org>2025-04-03 19:17:33 +0000
commit00095b3da4f23d9b3e7a809ac6a4e2b2530df84c (patch)
treeb653d6e3549184a6dd09a5cb8738b7acda5ca760 /compiler/rustc_codegen_ssa/src
parent82eb03ec6220ee435e0e07fdaf3f0a68a79aab17 (diff)
parent7d44887374ee667bd5aeb5e861032b8ce4093b29 (diff)
downloadrust-00095b3da4f23d9b3e7a809ac6a4e2b2530df84c.tar.gz
rust-00095b3da4f23d9b3e7a809ac6a4e2b2530df84c.zip
Auto merge of #132527 - DianQK:gvn-stmt-iter, r=oli-obk
gvn: Invalid dereferences for all non-local mutations

Fixes #132353.

This PR removes the computation value by traversing SSA locals through `for_each_assignment_mut`.

Because the `for_each_assignment_mut` traversal skips statements which have side effects, such as dereference assignments, the computation may be unsound. Instead of `for_each_assignment_mut`, we compute values by traversing in reverse postorder.

Because we compute and use the symbolic representation of values on the fly, I invalidate all old values when encountering a dereference assignment. The current approach does not prevent the optimization of a clone to a copy.

In the future, we may add an alias model, or dominance information for dereference assignments, or SSA form to help GVN.

r? cjgillot

cc `@jieyouxu` #132356
cc `@RalfJung` #133474
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
0 files changed, 0 insertions, 0 deletions