diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2023-05-13 22:05:24 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-09-24 09:09:04 +0000 |
| commit | db50bd96e50cc7debb1734e1f6d5318f5e0b3095 (patch) | |
| tree | 0c23afb3d54f5ac6919610c6023fecd8b8492f40 /compiler/rustc_mir_transform/src | |
| parent | 1ea93998031d7bb6559ee50bb6b4d04ff4f5f035 (diff) | |
| download | rust-db50bd96e50cc7debb1734e1f6d5318f5e0b3095.tar.gz rust-db50bd96e50cc7debb1734e1f6d5318f5e0b3095.zip | |
Add a paragraph about the assume bitwise equal.
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/gvn.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/compiler/rustc_mir_transform/src/gvn.rs b/compiler/rustc_mir_transform/src/gvn.rs index 0695f9af752..2b96763c297 100644 --- a/compiler/rustc_mir_transform/src/gvn.rs +++ b/compiler/rustc_mir_transform/src/gvn.rs @@ -18,6 +18,31 @@ //! //! By opportunity, this pass simplifies some `Rvalue`s based on the accumulated knowledge. //! +//! # Operational semantic +//! +//! Operationally, this pass attempts to prove bitwise equality between locals. Given this MIR: +//! ```ignore (MIR) +//! _a = some value // has VnIndex i +//! // some MIR +//! _b = some other value // also has VnIndex i +//! ``` +//! +//! We consider it to be replacable by: +//! ```ignore (MIR) +//! _a = some value // has VnIndex i +//! // some MIR +//! _c = some other value // also has VnIndex i +//! assume(_a bitwise equal to _c) // follows from having the same VnIndex +//! _b = _a // follows from the `assume` +//! ``` +//! +//! Which is simplifiable to: +//! ```ignore (MIR) +//! _a = some value // has VnIndex i +//! // some MIR +//! _b = _a +//! ``` +//! //! # Handling of references //! //! We handle references by assigning a different "provenance" index to each Ref/AddressOf rvalue. |
