]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #106908 - cjgillot:copyprop-ssa, r=oli-obk
authorbors <bors@rust-lang.org>
Sun, 29 Jan 2023 13:01:06 +0000 (13:01 +0000)
committerbors <bors@rust-lang.org>
Sun, 29 Jan 2023 13:01:06 +0000 (13:01 +0000)
Implement simple CopyPropagation based on SSA analysis

This PR extracts the "copy propagation" logic from https://github.com/rust-lang/rust/pull/106285.

MIR may produce chains of assignment between locals, like `_x = move? _y`.
This PR attempts to remove such chains by unifying locals.

The current implementation is a bit overzealous in turning moves into copies, and in removing storage statements.

1  2 
compiler/rustc_mir_transform/src/dest_prop.rs
compiler/rustc_mir_transform/src/lib.rs
compiler/rustc_mir_transform/src/simplify.rs

index 6858fa8e524f20bb5ccddee0f0589e5fcfcc4906,8a7c14472ac2f074d342cde0b8c9721ab9e5ce74..abf89e550b14922973d1afeb584eb79ebd97bc97
@@@ -54,8 -54,8 +54,9 @@@ mod const_debuginfo
  mod const_goto;
  mod const_prop;
  mod const_prop_lint;
+ mod copy_prop;
  mod coverage;
 +mod ctfe_limit;
  mod dataflow_const_prop;
  mod dead_store_elimination;
  mod deaggregator;