diff options
| author | bors <bors@rust-lang.org> | 2022-12-18 18:44:37 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-12-18 18:44:37 +0000 |
| commit | d0dc9efff14ac0a1eeceffd1e605e37eeb8362a0 (patch) | |
| tree | a8a822106633ae58a80f28af77cc817111af9d36 /compiler/rustc_mir_transform/src | |
| parent | 37efc8107293edb5970551920ba1128240b87c68 (diff) | |
| parent | 22379779b5842c4347b966e783a09e238f32369e (diff) | |
| download | rust-d0dc9efff14ac0a1eeceffd1e605e37eeb8362a0.tar.gz rust-d0dc9efff14ac0a1eeceffd1e605e37eeb8362a0.zip | |
Auto merge of #105876 - matthiaskrgr:rollup-a9dgzjt, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #96584 (Fix `x setup -h -v` should work) - #105420 (Remove dead code after destination propagation) - #105844 (Make the x tool use the x and x.ps1 scripts) - #105854 (remove redundant clone) - #105858 (Another `as_chunks` example) - #105870 (avoid .into() conversion to identical types) - #105875 (don't destuct references just to reborrow) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/const_prop.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_mir_transform/src/dest_prop.rs | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/compiler/rustc_mir_transform/src/const_prop.rs b/compiler/rustc_mir_transform/src/const_prop.rs index 044b7ce65bd..e384cfe1659 100644 --- a/compiler/rustc_mir_transform/src/const_prop.rs +++ b/compiler/rustc_mir_transform/src/const_prop.rs @@ -701,8 +701,8 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { BinOp::Mul if const_arg.layout.ty.is_integral() && arg_value == 0 => { if let Rvalue::CheckedBinaryOp(_, _) = rvalue { let val = Immediate::ScalarPair( - const_arg.to_scalar().into(), - Scalar::from_bool(false).into(), + const_arg.to_scalar(), + Scalar::from_bool(false), ); this.ecx.write_immediate(val, &dest) } else { diff --git a/compiler/rustc_mir_transform/src/dest_prop.rs b/compiler/rustc_mir_transform/src/dest_prop.rs index 3e45319431c..74d8337653f 100644 --- a/compiler/rustc_mir_transform/src/dest_prop.rs +++ b/compiler/rustc_mir_transform/src/dest_prop.rs @@ -129,6 +129,7 @@ use std::collections::hash_map::{Entry, OccupiedEntry}; +use crate::simplify::remove_dead_blocks; use crate::MirPass; use rustc_data_structures::fx::FxHashMap; use rustc_index::bit_set::BitSet; @@ -235,6 +236,12 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation { apply_merges(body, tcx, &merges, &merged_locals); } + if round_count != 0 { + // Merging can introduce overlap between moved arguments and/or call destination in an + // unreachable code, which validator considers to be ill-formed. + remove_dead_blocks(tcx, body); + } + trace!(round_count); } } |
