Module rustc_mir::transform::copy_prop [−][src]
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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
ConstantPropagationVisitor |
[ Experimental ]
|
CopyPropagation |
[ Experimental ]
|
Enums
Action |
[ Experimental ]
|
Functions
eliminate_self_assignments |
[ Experimental ]
|