rust/compiler/rustc_middle
bors e7c502d930 Auto merge of #109597 - cjgillot:gvn, r=oli-obk
Implement a global value numbering MIR optimization

The aim of this pass is to avoid repeated computations by reusing past assignments. It is based on an analysis of SSA locals, in order to perform a restricted form of common subexpression elimination.

By opportunity, this pass allows for some simplifications by combining assignments. For instance, this pass could be able to see through projections of aggregates to directly reuse the aggregate field (not in this PR).

We handle references by assigning a different "provenance" index to each `Ref`/`AddressOf` rvalue. This ensure that we do not spuriously merge borrows that should not be merged. Meanwhile, we consider all the derefs of an immutable reference to a freeze type to give the same value:
```rust
_a = *_b // _b is &Freeze
_c = *_b // replaced by _c = _a
```
2023-09-27 21:06:30 +00:00
..
src Auto merge of #109597 - cjgillot:gvn, r=oli-obk 2023-09-27 21:06:30 +00:00
Cargo.toml Replace in-tree rustc_apfloat with the new version of the crate 2023-07-26 10:20:15 -04:00
messages.ftl don't point at const usage site for resolution-time errors 2023-09-14 22:34:05 +02:00
README.md

For more information about how rustc works, see the rustc dev guide.