Module rustc_mir::transform::copy_prop [] [src]

🔬 This is a nightly-only experimental API. (rustc_private)

Trivial copy propagation pass.

This uses def-use analysis to remove values that have exactly one def and one use, which must be an assignment.

To give an example, we look for patterns that look like:

DEST = SRC
...
USE(DEST)

where DEST and SRC are both locals of some form. We replace that with:

NOP
...
USE(SRC)

The assignment DEST = SRC must be (a) the only mutation of DEST and (b) the only (non-mutating) use of SRC. These restrictions are conservative and may be relaxed in the future.

Structs

CopyPropagation [
Experimental
]