mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Rollup merge of #154297 - RalfJung:mir-opt-comments, r=dianqk
fix/extend some mir-opt comments Looks like CopyProp was refactored without updating that comment. And for GVN, I think this is what you had in mind @cjgillot but would be great if you could have a look.
This commit is contained in:
@@ -58,7 +58,8 @@ fn is_required(&self) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
/// Utility to help performing substitution of `*pattern` by `target`.
|
||||
/// Utility to help performing substitution: for all key-value pairs in `copy_classes`,
|
||||
/// all occurrences of the key get replaced by the value.
|
||||
struct Replacer<'a, 'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
unified: DenseBitSet<Local>,
|
||||
|
||||
@@ -48,8 +48,15 @@
|
||||
//! # Handling of references
|
||||
//!
|
||||
//! We handle references by assigning a different "provenance" index to each Ref/RawPtr 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:
|
||||
//! This ensure that we do not spuriously merge borrows that should not be merged. For instance:
|
||||
//! ```ignore (MIR)
|
||||
//! _x = &_a;
|
||||
//! _a = 0;
|
||||
//! _y = &_a; // cannot be turned into `_y = _x`!
|
||||
//! ```
|
||||
//!
|
||||
//! On top of that, we consider all the derefs of an immutable reference to a freeze type to give
|
||||
//! the same value:
|
||||
//! ```ignore (MIR)
|
||||
//! _a = *_b // _b is &Freeze
|
||||
//! _c = *_b // replaced by _c = _a
|
||||
|
||||
Reference in New Issue
Block a user