Rollup merge of #59290 - oli-obk:trivial_move_prop, r=davidtwco

Run branch cleanup after copy prop

This is preliminary work for https://github.com/rust-lang/rust/pull/59288#issuecomment-474277172 which gets rid of `if` in the HIR.

cc @rust-lang/wg-mir-opt 	@Centril
This commit is contained in:
Mazdak Farrokhzad 2019-03-19 15:17:03 +01:00 committed by GitHub
commit 7f7829fa8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 0 deletions

View File

@ -285,6 +285,7 @@ fn optimized_mir<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx
&simplify_branches::SimplifyBranches::new("after-const-prop"),
&deaggregator::Deaggregator,
&copy_prop::CopyPropagation,
&simplify_branches::SimplifyBranches::new("after-copy-prop"),
&remove_noop_landing_pads::RemoveNoopLandingPads,
&simplify::SimplifyCfg::new("final"),
&simplify::SimplifyLocals,

View File

@ -0,0 +1,22 @@
fn main() {
match { let x = false; x } {
true => println!("hello world!"),
false => {},
}
}
// END RUST SOURCE
// START rustc.main.SimplifyBranches-after-copy-prop.before.mir
// bb0: {
// ...
// switchInt(const false) -> [false: bb3, otherwise: bb1];
// }
// bb1: {
// END rustc.main.SimplifyBranches-after-copy-prop.before.mir
// START rustc.main.SimplifyBranches-after-copy-prop.after.mir
// bb0: {
// ...
// goto -> bb3;
// }
// bb1: {
// END rustc.main.SimplifyBranches-after-copy-prop.after.mir